Page 1 of 1

[Guide] In-editor placement randomization

Posted: Thu Jul 24, 2014 11:52 am
by wolfenswan
Randomizing the location of units and groups is fairly straightforward and easy to do without any scripting. However, it might not be too obvious if you're not used to the editor and as I'm not aware of an up-to-date guide for this I figured it might be best to make one. Hope it helps. :science101:

Randomization of groups and units:

1. Semi-randomization: Marker-method
This is a great method to add a random element while avoiding the pitfalls of full randomization. Simply place any type of marker ("empty" recommended) and use the grouping tool (F2) to link a group leader or vehicle with one or more markers. At mission start the unit will either be at it's default location or at one of the markers. Note: If the unit is a group leader it's group members will only be moved if they are set to be "in formation".

2. Full randomization: Placement radius
This is very straightforward: Simply increase the value for "placement radius" in the unit window in the editor. For a group it's enough to set the group leader's value as all members will be moved as well, as long as their "Special" field ist set to be "In Formation". The game will do it's best to avoid placing units in buildings or other "bad" spots.

You can combine these two: If you group a unit with placement radius > 0 to several markers, they will first be placed at one of those markers, then the placement radius will be applied second.

Combining Waypoints and Unit randomization:

Problem: Spatial waypoints won't work
The majority of waypoints people know and use are probably the "spatial waypoints", i.e. waypoints placed somewhere in the open terrain:
Image taken from BIKI

These are obviously of no use for unit randomization, as they'll always be placed at their in-editor location and not adjust dynamically.

Solution: Attached waypoints
Less commonly used but very useful for unit randomization are attached waypoints. To attach a waypoint, simply select the waypoint tool (F4) and double-click on a unit or object. You'll see a little red square for a waypoint attached to an object and on dragging the unit around the waypoint will move with it.

What's useful for us is that the waypoint is initialized after the unit has been placed, thus wherever it ends up after randomization. If for example you attach a sentry waypoint to the leader of a randomly placed group they'll act as a sentry where-ever they'll end up.

You can also combine this with functions that are commonly called from Waypoint Activiation fields (e.g. BIS_fnc_taskPatrol or ws_fnc_taskDefend) for further functionality.

Random Patrol Module
Found under Modules>Site>Random Patrol this module allows semi-randomization of groups with better control over waypoints.. It's a useful replacement to the above methods if you have very specific paths in mind.

One of the NATO groups will be put in either the patrol pattern (left) or at the hold marker (right). Everything else will be deleted.

Re: [Guide] In-editor placement randomization

Posted: Thu Jul 24, 2014 8:00 pm
by Kefirz
Great guide!

What kind of randomization happens in Inter and all the xEOLA's? (with the random objectives)
Does that involve scripting?

Re: [Guide] In-editor placement randomization

Posted: Sat Jul 26, 2014 9:38 am
by wolfenswan
xEola's do involve scripting (at least the cache placement) but a stub exists that reduces this to placing markers for the mission makers (can be found in the general mission making forum).

Randomly placing players is slightly trickier (and I should probably at a warning about this to the OP) due to the way the engine works.

Re: [Guide] In-editor placement randomization

Posted: Thu Aug 07, 2014 4:24 pm
by lietuvis10
Is there any way to randomize units to be placed inside biuldings?

Re: [Guide] In-editor placement randomization

Posted: Thu Aug 07, 2014 7:28 pm
by wolfenswan
If you download the FA tailored FE template of F3 from here it includes my set of functions. Two of these - taskDefend and createGarrison - are meant to place infantry in buildings.