[aps]gnat 28 Posted June 15, 2006 I thought I had this shyt sorted, but it seems not ..... Â I have a "Multi-gun" addon that I want MP compatible. The script lines that createvehicles the extra weapons is after a; Quote[/b] ]? (!local Server) : exit I'm using a "Server" gamelogic in the editor, yet I still get multiple creations of the same weapons on each addon! It looks like it may be one copy per player on the server ! The create-weapons script is fired once from the main addon's (ship) INIT event. Any idea what is the best way to ensure when I INIT an Addon only ONE firing (on Server I guess) of the appropraite script (that createvehicles) happens? Share this post Link to post Share on other sites
raedor 8 Posted June 15, 2006 You've done it in the correct way, it's even better to use the vehicle you attached the EH to (then you don't need the additional logic):<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!local (_this select 0):exit Show us more of your scripts, maybe you're starting them more times? Or you forgot to update the clients to the latest verion? Share this post Link to post Share on other sites
[aps]gnat 28 Posted June 15, 2006 Or you forgot to update the clients to the latest verion? Arh ! Â Â theres a point! Did the other tester also DL the last Upload I did !!! Thanks raedor ..... I'll try/check both suggestions FYI, latest edits; CPP Quote[/b] ]init = "[_this select 0] exec ""\GNT_Frigates\scr\OHPInit.sqs""; "; OHPInit.sqs Quote[/b] ];-------------------------------? (!local Server) : exit _vcl = _this select 0 ?!local _vcl : exit _sp = {\GNT_Frigates\scr\} [_vcl] exec _sp + {OHPAllGun.sqs} [_vcl] exec _sp + {Onumber.sqs} [_vcl] exec _sp + {Ozod.sqs} #quit exit OHPAllGun.sqs Quote[/b] ]; By Gnat, based on; ; Tailgun script by Footmunch ; Adapted from SA8Gecko's multi gun script placeIt = loadFile "\GNT_Frigates\scr\placeIt.sqf" nameIt = loadFile "\GNT_Frigates\scr\nameit.sqf" _boat = _this select 0 ;?!local _boat: exit _AVi = []; ; create some logics to use as cargo _logicX1 = "logic" createVehicle [0,0,0]; _logicX1 moveInCargo _boat _logicX2 = "logic" createVehicle [0,0,0]; _logicX2 moveInCargo _boat _logicX3 = "logic" createVehicle [0,0,0]; _logicX3 moveInCargo _boat ; kill the cargo so they dont cause CTDs _logicX1 setdamage 1 _logicX2 setdamage 1 _logicX3 setdamage 1 _exit = 0 ; if only the dead logics are aboard then this was ; meant to be a empty plane - skip adding the gunners ? count (crew _boat) ==3: goto "crtGun" ; Get the pilot and the group _pilot = driver _boat _pilot_grp = group _pilot "SoldierWPilot" createunit [getpos _boat, _pilot_grp,"", 0.95, "PRIVATE"] "SoldierWPilot" createunit [getpos _boat, _pilot_grp,"", 0.95, "PRIVATE"] ; Now get the whole group _tunits = units _pilot_grp ; And the turret gunners will be the last of the group (added latest) _gunner1 = _tunits select (count(_tunits) -1) [_gunner1] join grpNull _gunner2 = _tunits select (count(_tunits) -2) [_gunner2] join grpNull ; Create the gun itself #crtGun ; check if the choppers name is one of a list _name=[_this select 0] call nameIt ?_name == "": goto "NoName" _Npost = 1 #nameloop ; if its on the list then create the turrets under names GGunName = format ["%1_G_%2",_name,_Npost] call format ["%1 =""Phalanx"" createVehicle getpos _boat",GGunName] ?(_Npost == 1) : _gun1 = call format ["%1",GGunName]; _Npost = 2 GGunName = format ["%1_G_%2",_name,_Npost] call format ["%1 =""RGM84Tur"" createVehicle getpos _boat",GGunName] _gun2 = call format ["%1",GGunName] goto "IsIt" #NoName ; since the chopper hasnt a special name, just create turrets _gun1 = "Phalanx" createvehicle[0,0,0] _gun2 = "RGM84Tur" createvehicle[0,0,0] #IsIt ; And put the gunner in _gunner1 moveingunner _gun1 _gunner2 moveingunner _gun2 _Deck = "OHPDeck" createvehicle[0,0,0] ; Was a 'point backwards' routine, but now only a "Combat" routine [_gunner1, _boat, _gun1, _Deck] exec "\GNT_Frigates\scr\OHPCIWScycle.sqs" [_gunner2, _boat, _gun2] exec "\GNT_Frigates\scr\RGM84Cycle.sqs" ; Set the direction relative to chopper _gun1 setdir ((direction _boat) + 180) _gun2 setdir ((direction _boat) + 0) _Deck setdir ((direction _boat) + 0) #MainLoop [_logicX1,_gun1,_boat,_pos,0,180] call placeIt [_logicX2,_gun2,_boat,_pos,0,0] call placeIt [_logicX3,_Deck,_boat,_pos,0,0] call placeIt @ (true) ~0.005 ; check if a dead logic has been forced out by AI or player ?!(_logicX1 in _boat) : goto "Swapcargo" ?!(_logicX2 in _boat) : goto "Swapcargo" ?!(_logicX3 in _boat) : goto "Swapcargo" ; check if pilot has bailed out ? (!(driver _boat in _boat) || !(alive driver _boat)) and _exit == 0 and (position _boat select 2) > 20: goto "loop2" ? (isNull _gun1) : goto "DeadG" ? (isNull _gun2) : goto "DeadG" ? (isNull _Deck) : goto "DeadG" goto "MainLoop" #loop2 _exit = 1 _gunner1 = gunner _gun1 _gunner2 = gunner _gun2 if ((alive gunner _gun1) and (_gunner1 in _gun1)) then {_gunner1 action ["EJECT",_gun1];} if ((alive gunner _gun2) and (_gunner2 in _gun2)) then {_gunner2 action ["EJECT",_gun2];} if (alive gunner _boat) then {gunner _boat action ["EJECT",_boat]} unassignVehicle _gunner1 unassignVehicle _gunner2 goto "MainLoop" #Swapcargo ; if the logic has been forced out of cargo, force intruder out and put logic back ; usually only 0 element of array is intruder (but may not, this needs work) _allcrew = crew _boat _array = [] "if (_x != driver _boat && _x != gunner _boat) then {_array = _array + [_x]}" foreach _allcrew (_array select 0) action ["EJECT",_boat] ?!(_logicX1 in _boat) : _logicX1 moveincargo _boat ?!(_logicX2 in _boat) : _logicX2 moveincargo _boat ?!(_logicX3 in _boat) : _logicX3 moveincargo _boat goto "MainLoop" #DeadG ~4 deletevehicle _logicX1 deletevehicle _logicX2 deletevehicle _logicX3 exit Share this post Link to post Share on other sites