Jump to content
Sign in to follow this  
doomanchu

Group Spawn Trigger

Recommended Posts

Not sure what I'm doing wrong here. I've got a script to spawn a group from a trigger.

I have an invisible helicopter pad named (obj01) where I want them to spawn, but nothing is happening.

Spawn Script: (westobj01.sqf)

WestGrp01 = Creategroup WEST;
_Leader="USMC_Soldier_SL" createUnit [getPos "obj01", WestGrp01, "nul=[this,"obj01","NOFOLLOW"] execVM "ups.sqf"; WestGrp01=this", 0.5, "Sergeant"];
_Unit2="USMC_Soldier_AR" createUnit [getPos "obj01", WestGrp01, "", 0.5, "Corporal"];
_Unit3="USMC_Soldier" createUnit [getPos "obj01", WestGrp01, "", 0.5, "Private"];
_Unit4="USMC_Soldier_LAT" createUnit [getPos "obj01", WestGrp01, "", 0.5, "Private"];
exit

Trigger On Act:

null = execVM "westobj01.sqf";

Also, how do I go about getting them to parachute into the area when they spawn?

Thanks for any help... this has been driving me crazy for the last few days.

Edited by doomanchu

Share this post


Link to post
Share on other sites
Not sure what I'm doing wrong here. I've got a script to spawn a group from a trigger.

I have an invisible helicopter pad named (obj01) where I want them to spawn, but nothing is happening.

Spawn Script: (westobj01.sqf)

WestGrp01 = Creategroup WEST;
_Leader="USMC_Soldier_SL" createUnit [getPos "obj01", WestGrp01, "nul=[this,"obj01","NOFOLLOW"] execVM "ups.sqf"; WestGrp01=this", 0.5, "Sergeant"];
_Unit2="USMC_Soldier_AR" createUnit [getPos "obj01", WestGrp01, "", 0.5, "Corporal"];
_Unit3="USMC_Soldier" createUnit [getPos "obj01", WestGrp01, "", 0.5, "Private"];
_Unit4="USMC_Soldier_LAT" createUnit [getPos "obj01", WestGrp01, "", 0.5, "Private"];
exit

Trigger On Act:

null = execVM "westobj01.sqf";

Also, how do I go about getting them to parachute into the area when they spawn?

Thanks for any help... this has been driving me crazy for the last few days.

null =[] execVM "westobj01.sqf";

i have done this with a Marker.. dont know if this to problem ?!.

Share this post


Link to post
Share on other sites

a snippet from my group respawn. _spawn comes from a marker on map

_spawn = getmarkerpos _marker;
_wp1 = getmarkerpos _markwp1;
_eGrp = createGroup EAST;
_ldr = _egrp createUnit ["RU_Soldier_SL",_spawn, [], 0, "NONE"];
[_ldr] join grpNull;
_grpname = group _ldr;
_man = _grpname createUnit ["USMC_Soldier",_spawn, [], 0, "NONE"];
[_man] join _grpname;

sleep 5;

_grpname addwaypoint [_wp1, _rad1];
[_grpname, 1] setWPPos _wp1;
[_grpname, 1] setWaypointType _wptype;

works really well. and testing on dedi

Share this post


Link to post
Share on other sites

Doomanchu - I am not sure your syntax for creating the units is correct.

Bellow is the script I use to create a group and then get them to patrol using the UPS script.

You will see I call the UPS script at the end and its linked to the leader unit to correctly activate.

GroupSquad1 = CreateGroup East;

_leader = GroupSquad1 createUnit ["RU_Soldier_SL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_Marksman", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_leader = leader GroupSquad1;

[_leader,"TaskB1"] execVM "ups.sqf";

Edited by Starlight

Share this post


Link to post
Share on other sites

Starlight, what is the "TaskB1" at the end of your script please?

Share this post


Link to post
Share on other sites

TaskB1 is the name of the marker that defines the area of the UPS patrol zone in my mission

In a similar way getMarkerPos "Squad1" where Squad1 is the name of a marker that locates where this group will spawn on the map.

This thread Scripting Help - Respawning AI units has a test mission posted by Norrin that sets up several patrol zones and respawning AI. It will help a lot to look at this and dissect some of the stuff he is doing to get a better understanding

Edited by Starlight

Share this post


Link to post
Share on other sites

Starlight thank you very much! That works perfect.

Now I just have to figure out how to get them to parachute into the area when they spawn!

Thanks again.

Share this post


Link to post
Share on other sites

Ran into another problem.

My triggers are set up so that both teams can capture/recapture objectives. So, my triggers are set up for "repeatedly".

Something funny is happening with them like that... it seems that each trigger fires as many times as there are players connected to the server. If 2 players are online then each trigger fires 2 times, if 3 players are online then the triggers fire 3 times, etc. We had about 5 players helping test the mission and things got bad! Instead of the 4 AI patrols spawning, we had 20 spawning!

The Triggers:

Trigger 1:

Activation: OPFOR (Not Present) Repeatedly

Condition: this;

On Act: obj01a = true;

Trigger 2:

Activation: Independent (Not Present) Repeatedly

Condition: this;

On Act: obj01b = true;

Trigger 3:

Activation: BLUFOR (Present) Repeatedly

Condition: this and obj01a and obj01b;

On Act: "obj01" setMarkerColor "ColorBlue"; hint "BLUFOR has captured the area"; null = execVM "westobj01a.sqf";

Here's the spawn script that trigger 3 calls.

WestGrp01a = CreateGroup WEST;
_leader = WestGrp01a createUnit ["USMC_Soldier_SL", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_AR", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_LAT", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_leader = leader WestGrp01a;
[_leader,"obj01","NOFOLLOW"] execVM "ups.sqf";

How do I prevent the triggers going off like that?

Thanks for any help.

Share this post


Link to post
Share on other sites

Are you running this as a coop where your PC hosts or via a dedicated server?

I have seen threads discussing the "isServer" requirement for dedicated servers to make sure players sync with triggered / called scripts.

If its your own PC, then I am not sure, I cannot test at the moment, my PC has gone off for a new motherboard, back at the start of next week :(

Share this post


Link to post
Share on other sites

Seems the "isServer" is what I'm missing. I dug around and found two possible solutions. I'll have to test later this weekend and see what happens.

Option 1:

?! (isServer): exit
WestGrp01a = CreateGroup WEST;
_leader = WestGrp01a createUnit ["USMC_Soldier_SL", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_AR", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_LAT", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_leader = leader WestGrp01a;
[_leader,"obj01","NOFOLLOW"] execVM "ups.sqf";

Option 2:

if(isServer) then
{
WestGrp01a = CreateGroup WEST;
_leader = WestGrp01a createUnit ["USMC_Soldier_SL", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_AR", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_LAT", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_leader = leader WestGrp01a;
[_leader,"obj01","NOFOLLOW"] execVM "ups.sqf";
};

Share this post


Link to post
Share on other sites

Hi, I seem to be having a problem spawning EAST units?

If I try the above, it works fine without any problems...

if(isServer) then
{
WestGrp01 = CreateGroup WEST;
_leader = WestGrp01 createUnit ["USMC_Soldier_SL", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = WestGrp01 createUnit ["USMC_Soldier_AR", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = WestGrp01 createUnit ["USMC_Soldier", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = WestGrp01 createUnit ["USMC_Soldier_LAT", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_leader = leader WestGrp01;
};

But when I do the exact same for EAST they wont spawn at all??

if(isServer) then
{
EastGrp01 = CreateGroup EAST;
_leader = EastGrp01 createUnit ["RU_Soldier_SL", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01 createUnit ["RU_Soldier", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01 createUnit ["RU_Soldier", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01 createUnit ["RU_Soldier", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_leader = leader EastGrp01;
};

However, if I change CreateGroup EAST to CreateGroup WEST the Russian's spawn and they start killing each other?? I'm confused...

"se" is the marker I want them to spawn at.

---------- Post added at 05:21 PM ---------- Previous post was at 03:35 PM ----------

NVM got it sorted...

Added _sidehq createcenter east

Seems to of worked

Edited by Gaffa

Share this post


Link to post
Share on other sites

Moving onto my next question now that everything else is working, need help getting the patrols to parachute into the area when they spawn.

Spawn Script:

?! (isServer): exit
WestGrp01a = CreateGroup WEST;
_leader = WestGrp01a createUnit ["USMC_Soldier_SL", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_AR", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit = WestGrp01a createUnit ["USMC_Soldier_LAT", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_leader = leader WestGrp01a;
[_leader,"obj01","NOFOLLOW"] execVM "ups.sqf";

Parachute Script I found:

this setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
this flyinheight 1000;
this setvelocity [0,0,0];
[this] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";

Trying to find a way to mix those two scripts together.

Share this post


Link to post
Share on other sites

Is there a way to make them spawn and you can give them waypoints afther that?

Because i want you to trigger the "Russian Army" so then a massive force must spawn and by using waypoints it will attack the BLUFOR bases.

Share this post


Link to post
Share on other sites

Can you not just set it for each _unit? So...

?! (isServer): exit
WestGrp01a = CreateGroup WEST;
_leader = WestGrp01a createUnit ["USMC_Soldier_SL", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_leader setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_leader flyinheight 1000;
_leader setvelocity [0,0,0];
[_leader] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_unit = WestGrp01a createUnit ["USMC_Soldier_AR", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_unit flyinheight 1000;
_unit setvelocity [0,0,0];
[_unit] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_unit = WestGrp01a createUnit ["USMC_Soldier", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_unit flyinheight 1000;
_unit setvelocity [0,0,0];
[_unit] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_unit = WestGrp01a createUnit ["USMC_Soldier_LAT", [(getMarkerPos "obj01a") select 0,(getMarkerPos "obj01a") select 1,0], [], 3, "FORM"];
_unit setpos [getpos this select 0, getpos this select 1,(getpos this
select 2) +1000];
_unit flyinheight 1000;
_unit setvelocity [0,0,0];
[_unit] exec "ca\air2\halo\data\Scripts\HALO_init.sqs";
_leader = leader WestGrp01a;
[_leader,"obj01","NOFOLLOW"] execVM "ups.sqf";

Wouldn't that work?

---------- Post added at 11:39 AM ---------- Previous post was at 11:36 AM ----------

Is there a way to make them spawn and you can give them waypoints afther that?

Because i want you to trigger the "Russian Army" so then a massive force must spawn and by using waypoints it will attack the BLUFOR bases.

Yes...

_sideHQ = createCenter EAST;

West setFriend [East,0];
East setFriend [West,0];

EastGrp01a = Creategroup EAST;
_leader = EastGrp01a createUnit ["RU_Soldier_TL", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_GL", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_GL", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_Medic", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_Marksman", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_MG", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_MG", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_unit = EastGrp01a createUnit ["RU_Soldier_Marksman", [(getMarkerPos "se") select 0,(getMarkerPos "se") select 1,0], [], 3, "FORM"];
_leader = leader EastGrp01a;
wp1 = EastGrp01a addwaypoint [position wpe, 0];
wp1 setwaypointtype "MOVE";
wp1 setWaypointCombatMode "RED";
wp1 setWaypointFormation "LINE";
wp1 setWaypointSpeed "NORMAL";
wp1 setWaypointBehaviour "AWARE";
wp2 = EastGrp01a addwaypoint [position target, 0];
wp2 setwaypointtype "SAD";
wp2 setWaypointCombatMode "RED";
wp2 setWaypointFormation "LINE";
wp2 setWaypointSpeed "NORMAL";
wp2 setWaypointBehaviour "AWARE";

"se" is the marker where they spawn

"wpe" is the first waypoint

"target" is the second waypoint

You can only use objects as waypoints, so use a invisible H and give it a name that you can refer to in your script.

Edited by Gaffa

Share this post


Link to post
Share on other sites

Thanks alot about the script, but i am having some problems whit making them actually spawn, I'v put a marker up named se and made a trigger with the codec to run the script but they do not spawn?

Share this post


Link to post
Share on other sites

With the script I gave you above, save it as test.sqf

Ok you have the "se" marker. Then place a invisible H and name it "wpe" which can be found under objects. Now create a trigger with the following...

Condition: True (This can be whatever you like but will use true for testing)

On Act: [] exec "test.sqf"

Make sure you have the following at the top of the script...

_sideHQ = createCenter EAST;

West setFriend [East,0];
East setFriend [West,0];

And it should work fine

Share this post


Link to post
Share on other sites

Got it all working, Thanks for your efforts mate!

Share this post


Link to post
Share on other sites

One qeustion though, How to make them spawn already flying? Cause the aircraft just dies when spawned xP

Share this post


Link to post
Share on other sites

Got another problem, The infantry spawn just fine, but armored/ aircraft units dont seem to spawn

Share this post


Link to post
Share on other sites

GroupSquad1 = CreateGroup East;

_leader = GroupSquad1 createUnit ["RU_Soldier_SL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_Marksman", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_MG", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_LAT", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_GL", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_unit = GroupSquad1 createUnit ["RU_Soldier_AR", [(getMarkerPos "Squad1") select 0,(getMarkerPos "Squad1") select 1,0], [], 3, "FORM"];

_leader = leader GroupSquad1;

[_leader,"TaskB1"] execVM "ups.sqf";

I dont get this to work ... i created east.sqf and copy pasted that ... ups script i installed and set a marker with Squad1 and a trigger with this on activation null = execVM "westobj01.sqf"; but i dont see AI spawning ... what am i doing wrong ?

Share this post


Link to post
Share on other sites

Use Functions, make your life easy! :)

Place the Function Module, then:

GroupSquad1 = [getMarkerPos "Squad1", East, 12] call BIS_fnc_SpawnGroup;
_leader = leader GroupSquad1;
[_leader,"TaskB1"] execVM "ups.sqf"; 

Share this post


Link to post
Share on other sites
Did you call it?

GoGoGadgetAISpawn = [] execVM "east.sqf"

yes null [the marker position] = execVM "east.sqf"; thats right isnt it ? ...

That with Function Modul i dont understand i put this

GroupSquad1 = [getMarkerPos "Squad1", East, 12] call BIS_fnc_SpawnGroup;

_leader = leader GroupSquad1;

[_leader,"TaskB1"] execVM "ups.sqf";

in the script east.sqf right ?

I placed Function Modul and called it BIS_fnc_SpawnGroup .... but how does it spawn with a trigger ?

Edited by tobmic

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  

×