Jump to content
Sign in to follow this  
LtAnderton159

Creating units with trigger, problem of multiplication.

Recommended Posts

Hello !

In my last mission, i have 3 triggers for the creation of units.

In one of them, i writed :

group2 = Creategroup EAST;

"O_Soldier_TL_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "lieutenant"];

"O_Soldier_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "sergent"];

"O_Soldier_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"];

"O_Soldier_GL_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"];

"O_Soldier_AR_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"];

"O_Soldier_M_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"];

WP2 setWaypointType "SEEK AND DESTROY";

WP2 = group2 addWaypoint [getMarkerPos "groupe2w", 100];

But, when we played it, we were 7 and the trigger created 7 x 6 units and its true for the two others.

How can i solve this problem ? I would like to create only one group by one trigger and not seven or more !

Thanks you for your help !

Share this post


Link to post
Share on other sites
if (!isServer) exitWith {}; 

group2 = Creategroup EAST; 
"O_Soldier_TL_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "lieutenant"]; 
"O_Soldier_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "sergent"]; 
"O_Soldier_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"]; 
"O_Soldier_GL_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"]; 
"O_Soldier_AR_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"]; 
"O_Soldier_M_F" createUnit [getMarkerPos "spawn2", group2,"", 0.6, "corporal"]; 
WP2 setWaypointType "SEEK AND DESTROY"; 
WP2 = group2 addWaypoint [getMarkerPos "groupe2w", 100];

Edited by Blitzer134

Share this post


Link to post
Share on other sites
In the On Condition field of the triggers try this:

this && isServer; 

Thanks you, that is working :)

Can you explain me what is doing exactly "isServer" ? Thank you again.

Share this post


Link to post
Share on other sites
So basically if you wanted your SP mission to be MP compatible you need to run this in every trigger?

Think about it this way. What ever is in the activation field of the trigger will run across all players connected to the mp server and if I'm not mistaken including the server. So in the condition box this(this being the current trigger) && isServer(being that the mission is on a server or host computer) will run the script only once.

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  

×