[Guide] In-editor placement randomization

Party-approved future science plus handbooks for the revolution
Post Reply
User avatar
wolfenswan
Posts: 1208
Joined: Wed May 25, 2011 4:59 pm

[Guide] In-editor placement randomization

Post by wolfenswan » Thu Jul 24, 2014 11:52 am

Intro:
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".
Image

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.
Image

Tip:
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
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.

Tip:
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.

Image
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.

User avatar
Kefirz
Posts: 440
Joined: Sun Mar 11, 2012 11:44 am

Re: [Guide] In-editor placement randomization

Post by Kefirz » Thu Jul 24, 2014 8:00 pm

Great guide!

What kind of randomization happens in Inter and all the xEOLA's? (with the random objectives)
Does that involve scripting?
''I am not going against tanks'' - Tryteyker, MAT gunner.
''Downboated so much, it's an u-boat now.'' - Boberro.
''Sorry, I meant hon hon hon baguette baguette Eiffel Tower'' - Mabbott

User avatar
wolfenswan
Posts: 1208
Joined: Wed May 25, 2011 4:59 pm

Re: [Guide] In-editor placement randomization

Post by wolfenswan » Sat Jul 26, 2014 9:38 am

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.

lietuvis10
Posts: 46
Joined: Tue Jul 22, 2014 9:14 pm

Re: [Guide] In-editor placement randomization

Post by lietuvis10 » Thu Aug 07, 2014 4:24 pm

Is there any way to randomize units to be placed inside biuldings?

User avatar
wolfenswan
Posts: 1208
Joined: Wed May 25, 2011 4:59 pm

Re: [Guide] In-editor placement randomization

Post by wolfenswan » Thu Aug 07, 2014 7:28 pm

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.

Post Reply