Jump to content
Sign in to follow this  
DesolateChris

Arma 2 Spawn Units on Trigger Problem

Recommended Posts

Hello,

So I've started making a mission where you HOLD an area against waves of attacking enemies.

Scripts all work, but only to an extent...

As this is designed for multiplayer, unfortunately the script does not work properly as dependent on the number of players determines the number of enemies.

E.G, if there is a group of infantry designed to spawn when a trigger is set off, if there are 5 players, it will spawn 5 groups of infantry on that position rather than just the desired 1 (as you can see this would be quite problematic as I have 2 tanks spawn in at some point in the mission).

Here is the script I use which spawns in the units and gives them waypoints:

_TaskGroup2 = [(getMarkerPos "SpawnPoint1"), EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup;

_wp1 = _TaskGroup2 addWaypoint [(getMarkerPos "wp1a"), 0]; 
_wp1 setWaypointType "SAD";
_wp1 setWaypointStatements ["true", ""]; 

_TaskGroup3 = [(getMarkerPos "SpawnPoint2"), EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Motorized" >> "TK_INS_MotorizedGroup")] call BIS_fnc_spawnGroup;

_wp1 = _TaskGroup3 addWaypoint [(getMarkerPos "wp2a"), 0]; 
_wp1 setWaypointType "GETIN";
_wp1 setWaypointStatements ["true", ""]; 

_wp2 = _TaskGroup3 addWaypoint [(getMarkerPos "wp2b"), 0]; 
_wp2 setWaypointType "MOVE";
_wp2 setWaypointStatements ["true", ""]; 

_wp3 = _TaskGroup3 addWaypoint [(getMarkerPos "wp2c"), 0]; 
_wp3 setWaypointType "GETOUT";
_wp3 setWaypointStatements ["true", ""]; 

_wp4 = _TaskGroup3 addWaypoint [(getMarkerPos "wp2d"), 0]; 
_wp4 setWaypointType "SAD";
_wp4 setWaypointStatements ["true", ""]; 

_TaskGroup4 = [(getMarkerPos "SpawnPoint3"), EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Motorized" >> "TK_INS_MotorizedGroup")] call BIS_fnc_spawnGroup;

_wp1 = _TaskGroup4 addWaypoint [(getMarkerPos "wp3a"), 0]; 
_wp1 setWaypointType "GETIN";
_wp1 setWaypointStatements ["true", ""]; 

_wp2 = _TaskGroup4 addWaypoint [(getMarkerPos "wp3b"), 0]; 
_wp2 setWaypointType "MOVE";
_wp2 setWaypointStatements ["true", ""]; 

_wp3 = _TaskGroup4 addWaypoint [(getMarkerPos "wp3c"), 0]; 
_wp3 setWaypointType "GETOUT";
_wp3 setWaypointStatements ["true", ""]; 

_wp4 = _TaskGroup4 addWaypoint [(getMarkerPos "wp3d"), 0]; 
_wp4 setWaypointType "SAD";
_wp4 setWaypointStatements ["true", ""]; 

Thanks in Advance

---------- Post added at 08:02 ---------- Previous post was at 07:25 ----------

Also the trigger is

INDEP - Not Present - Once - OnAct is above script -

Share this post


Link to post
Share on other sites

in trigger condition try Isserver that may make it only run on the server and not on each client.

Share this post


Link to post
Share on other sites
in trigger condition try Isserver that may make it only run on the server and not on each client.

Good news and bad news :D

Good news is, that worked! Only the desired number of units spawn now..

On the other hand, despite the trigger being ACTIVATED BY INDEP NOT PRESENT, it starts the trigger countdown on mission start, meaning the first wave of enemies comes in even if the Independent units within the trigger are still there...

Share this post


Link to post
Share on other sites

I'm not really into MP but try

this and Isserver

that should preserve the original conditions and add the IsServer so both need to be true.

Share this post


Link to post
Share on other sites
I'm not really into MP but try

this and Isserver

that should preserve the original conditions and add the IsServer so both need to be true.

Awesome! That works PERFECTLY, thank you so much for your help :D

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  

×