Jump to content
meatshield

spawning compositions on random marker?

Recommended Posts

so, i'm trying to find a way of getting a custom composition (just fortifications and a few guys, no waypoints or anything) to spawn at mission start in one of several areas. Google threw up a bunch of stuff ranging from non working scripts to using BIS_fnc_ObjectsGrabber and BIS_fnc_ObjectsMapper .. which i just cant get my head around as the wiki is typically sparse in how to actually use the damn things if you dont know how to script already, and the few threads i've found are equally vague to a non scripter  :sad:

 

Any help available for a non scripter??

Share this post


Link to post
Share on other sites

..which whilst works fine, spanws everything via add actions and doesn't contain any information for a non scripter on how to use it to spawn a custom composition on marker A,B or C randomly at mission start.

 

When your level of scripting is limited to

execVM "scripts\scriptname.sqf";

being told "when you want to spawn a composition.."

_compReference = [ COMP_NAME, POS_ATL, OFFSET, DIR, ALIGN_TERRAIN, ALIGN_WATER ] call LARs_fnc_spawnComp;

 

is like telling someone to build a rocket and go get some moon dust :sad:

 

it really does make you wonder just how hard it is to make a mission where there's a base in one of 2/3 possible locations and you have to go find out which one its at (with the base being random for re playability) :sad:

Share this post


Link to post
Share on other sites
On 10/14/2018 at 3:52 PM, meatshield said:

so, i'm trying to find a way of getting a custom composition (just fortifications and a few guys, no waypoints or anything) to spawn at mission start in one of several areas. Google threw up a bunch of stuff ranging from non working scripts to using BIS_fnc_ObjectsGrabber and BIS_fnc_ObjectsMapper .. which i just cant get my head around as the wiki is typically sparse in how to actually use the damn things if you dont know how to script already, and the few threads i've found are equally vague to a non scripter  :sad:

 

Any help available for a non scripter??

The best way to do something like this for a no-scripter (it take some time to do it but it work), its to create mission template on the same map and export in SQF, create a folder in your main scenario (missions) and create a bunch of blank .sqf, for exemple mission1.sqf, mission2.sqf,  mission3.sqf,.... Create your template, save and export to sqf, copy the scripted mission template in your main scenario, in one of this blank .sqf.

 

When its done :

in the initServer.sqf  : [] execVM "init_mission.sqf";

 

in the init_mission.sqf :

 

sleep 3600;
 while {true} do {

execVM (selectRandom ["missions\mission1.sqf","missions\mission2.sqf","missions\mission3.sqf","missions\mission4.sqf","missions\mission5.sqf","missions\mission6.sqf","missions\mission7.sqf","missions\mission8.sqf","missions\mission9.sqf","missions\mission10.sqf","missions\mission11.sqf","missions\mission12.sqf","missions\mission13.sqf","missions\mission14.sqf","missions\mission15.sqf","missions\mission16.sqf","missions\mission17.sqf","missions\mission18.sqf","missions\mission19.sqf","missions\mission20.sqf","missions\mission21.sqf","missions\mission22.sqf","missions\mission23.sqf","missions\mission24.sqf","missions\mission25.sqf","missions\mission26.sqf","missions\mission27.sqf","missions\mission28.sqf","missions\mission29.sqf","missions\mission30.sqf","missions\mission31.sqf","missions\mission32.sqf","missions\mission33.sqf","missions\mission34.sqf","missions\mission35.sqf","missions\mission36.sqf","missions\mission37.sqf","missions\mission38.sqf","missions\mission39.sqf","missions\mission40.sqf"]);
[{hint "Something is going on check your map for more info";},"BIS_fnc_spawn",true,true] call BIS_fnc_MP;
sleep (random 3600 +3600);


};

 

The script will wait 1 h before start, and pick ramdomly a new template every 1h + random 1h, in that exemple you will get 40 random generated mission, on each new mission there will be a hint to tell you that something happen.

With this exemple its recommended to put a trigger that will delete everything on each template (1h cooldown) because the template can be duplicated.

 

After you can use it the way you want, for exemple detect a player in a 5km X 5km with a trigger and execute randomly 1 template, like this you can create many template for one area, (10 for exemple) and pick one randomly.

 

Trigger : AO_1

Detection : player/present (executed on server)

Activation : [] execVM "AO_1.sqf";

 

Create a folder AO_1 and put in all your exported template, (mission1, mission2...etc...

 

AO_1.sqf

execVM (selectRandom ["AO_1\mission1.sqf","AO_1\mission2.sqf","AO_1\mission3.sqf","AO_1\mission4.sqf","AO_1\mission5.sqf","AO_1\mission6.sqf","AO_1\mission7.sqf","AO_1\mission8.sqf","AO_1\mission9.sqf","AO_1\mission10.sqf"]);

 

So when a player enter the trigger AO_1 one of your exported template will be generated.

 

This method take some time, but it work.

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hey @damsous,

 

Please, is there a way to make the "mission", which is a composition de-spawn after the tasks of that mission are complete?

 

This way, the objects would not simply disappear in front of you when you reach the maximum time limit.

 

Share this post


Link to post
Share on other sites
On 4/4/2020 at 11:48 AM, quickdagger said:

Hey @damsous,

 

Please, is there a way to make the "mission", which is a composition de-spawn after the tasks of that mission are complete?

 

This way, the objects would not simply disappear in front of you when you reach the maximum time limit.

 

Yes, just add the line to pick up randomly a new task  with a trigger that detect if the task is completed.

Share this post


Link to post
Share on other sites

Thank you for answering @damsous but I am not a scripts person. Actually I have no idea about how to do that.

 

Would you mind, please, sharing the exact code I should add and where?

Share this post


Link to post
Share on other sites

In your mission template add a trigger that cover the where the object are placed (for exemple opfor not present) and add this in activation :

{ if (([thistrigger ,_x] call  bis_fnc_inTrigger)) then {{deleteVehicle _x} foreach crew _x;deleteVehicle _x} } foreach allMissionObjects "All"-[thistrigger]; execVM (selectRandom ["mission1.sqf","mission2.sqf","mission3.sqf","mission4.sqf","mission5.sqf","mission6.sqf","mission7.sqf","mission8.sqf","mission9.sqf","mission10.sqf"]); 

So every object inside the trigger area will be deleted and a new template will be created when all the opfor die.

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

×