Jump to content
Sign in to follow this  
shuko

SHK_randomStartForPlayerGroup

Recommended Posts

Since the question how to randomize player group position at the start of a mission pops up on this forum weekly. Last time here.

I made this for that thread, but tried to keep it generic enough to be useable in other missions as well.

This is a script that is run from an object's init field. It will be executed before players receive their selected units (simplifies the move process as all units are still local to the server).

Parameter you need to define is the list of possible starting locations, either markers or objects.

Optional parameters you can give are unit list and a script. With unit list you can select units that are to be moved. It's required when making SP mission, but in MP missions it's not needed as the script then just uses the playableunits variable.

As the 3rd parameter you can give a name of a SQF script that will be executed after the units are moved.

Parameters:
 Positions     Array       A list containing markers or objects from which the position is taken from.
 Units         Array       A list of units to be moved. If not given, playableunits is used.
 Script        SQF Script  Name of an optional SQF script to be run.
   Parameters available in the script:
     0: Position of the randomly selected marker/object.
     1: Random number that was used to select the position.
     2: All parameters passed to SHK_randomStartForPlayerGroup.sqf

Examples:
 [["mPosStart0","mPosStart1","mPosStart2"]] call compile preprocessfile "SHK_randomStartForPlayerGroup.sqf"
 [["mPosStart0","mPosStart1","mPosStart2"],units grpAlpha] call compile preprocessfile "SHK_randomStartForPlayerGroup.sqf"
 [[pos0,pos1,pos2],[man1,man2,man3]] call compile preprocessfile "SHK_randomStartForPlayerGroup.sqf"
 [[pos0,pos1,pos2],[],"someScript.sqf"] call compile preprocessfile "SHK_randomStartForPlayerGroup.sqf"

SHK_randomStartForPlayerGroup.sqf

Example mission

Edited by Shuko

Share this post


Link to post
Share on other sites

Works perfect shk !

Thanks for that script. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×