Jump to content
-ami- mofo

Artillery script half works

Recommended Posts

Hi guys, I have a scorcher called arty1 and an invisible marker called arty_target1

 

Then I have a trigger with activation as "radio alpha" and in the on act I have 

Quote

arty1 doArtilleryFire [getmarkerpos "arty_target1", "32Rnd_155mm_Mo_shells", 10]; 

arty1 addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];

 

This is a co-op MP mission and works as it should for the mission host.. but for any other player the radio alpha only results in the scorchers gun barrel pointing skywards (and kind of wiggling a bit)... but nothing comes out?! 

Does anyone know why this happens and what I need to change so that the scorcher actually fires for the non host players?

 

Thanks.

Share this post


Link to post
Share on other sites

Makes it sound like a locality issue. Try..

//arty1 init box
this addEventHandler ["fired", {(_this select 0) setVehicleAmmo 1}];

As you do not want to be re-adding the event every time the vehicle fires. Just add it once on all computers when the mission loads, this way if the vehicle ever changes locality it will already be set up to reload itself as the Fired EH only triggers where the vehicle is local.

 

//init.sqf
TAG_fnc_artyFire = {
    arty1 doArtilleryFire [getMarkerPos "arty_target1", "32Rnd_155mm_Mo_shells", 10];
};

Make a function for the artillery fire on all machines.

 

//In radio action
if ( isServer ) then {
    [] remoteExec [ "TAG_fnc_artyFire", arty1 ];
};

Then as radio triggers activate on all machines, just make the servers versions do anything and set it to call the function where arty1 is local by using remoteExec.

  • Like 1

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

×