Jump to content
Sign in to follow this  
Gloopy

init.sqf question (I searched)

Recommended Posts

Hopefully this is a nice simple one to answer, but searched the wiki and found nothing and searched here too.

This is my init.sqf

["MediumTentCamp_napa", 0, (getmarkerpos "camp")] execVM "Createcomposition.sqf";
["heli_park_ru1", 0, (getmarkerpos "camp_1")] execVM "Createcomposition.sqf";
["mediumtentcamp2_ru", 90, (getmarkerpos "camp_2")] execVM "Createcomposition.sqf";
["fuel_dump_ru1", 0, (getmarkerpos "camp_3")] execVM "Createcomposition.sqf";
construct = "Land_A_BuildingWIP" createVehicle (getMarkerPos "conmarker"); 
construct1 = "Land_A_CraneCon" createVehicle (getMarkerPos "conmarker1");

For some reason, Land_A_BuildingWIP and Land_A_CraneCon are spawning a few times, sometimes twice, sometimes 3 times. Each one spawns a little bit north of the other. Have tried to replicated running a local multiplayer server and can't do it, when I play it online it's running from my dedicated server. As far as i can tell the three compositions aren't spawning multiple times unless they're spawning inside each other and I can't see them.

Someone share their infinite wisdom with me please :) It takes a hell of a lot more than two satchel charges to blow up 3 construction yards.

Share this post


Link to post
Share on other sites

The init script is run on all connected machines once at mission start (server, clients and jip-clients). That means that on a dedicated server with #X clients the script is executed 1+#X times and as the command 'createVehicle' has global effect, the 'LAND_A_*' objects objects are created 1+#X as well. To make sure that some code is only run once on mission start, put this if-clause around it:

if(isServer) then {
     // code to be run only on the server
};

Share this post


Link to post
Share on other sites

You sir,

Are a hero.

Regards

-Gloopy

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  

×