Jump to content
Sign in to follow this  
Signaller

A10 loadout Script won't work on dedi server

Recommended Posts

I've made a simple A10 loadout selection script for Domination, it works perfectly in the editor, but when run on a dedicated server the loadout appears on the A10 for about 5 seconds then reverts to the default loadout.

Not being the most knowledgeable scripter (& that's an understatement) I'm a little confused as to why this won't work on a dedi & would greatly appreciate guidance with this.

Thanks

Signaller

Called from addaction via object

this addAction["load 8 GBU-12 Laser Guided Bombs","scripts\loadout1.sqf"];

//8 GBU 14s, 14 Hydras, GAU8 cannon


ch50 removeMagazinesTurret ["2Rnd_Sidewinder_AH1Z",[-1]];
ch50 removeMagazinesTurret ["2Rnd_Maverick_A10",[-1]];
ch50 removeMagazinesTurret ["4Rnd_GBU12",[-1]];

ch50 removeWeapon "SidewinderLaucher_AH1Z";
ch50 removeWeapon "MaverickLauncher";
ch50 removeWeapon "BombLauncherA10";


{ch50 addMagazineTurret ["4Rnd_GBU12",[-1]];} forEach [1,2];
      	ch50 addWeapon "BombLauncherA10";

Share this post


Link to post
Share on other sites

maybe issue is locality, i see the commands should work from local to global but anyhow, try this:

place in init.sqf:

ch50Loadout1 = false;

place a repeated trigger

cond:

isServer AND ch50Loadout1

on act:

ch50Loadout1 = false;
_null = [] spawn {
ch50 removeMagazinesTurret ["2Rnd_Sidewinder_AH1Z",[-1]];
ch50 removeMagazinesTurret ["2Rnd_Maverick_A10",[-1]];
ch50 removeMagazinesTurret ["4Rnd_GBU12",[-1]];

ch50 removeWeapon "SidewinderLaucher_AH1Z";
ch50 removeWeapon "MaverickLauncher";
ch50 removeWeapon "BombLauncherA10";


{ch50 addMagazineTurret ["4Rnd_GBU12",[-1]];} forEach [1,2];
     ch50 addWeapon "BombLauncherA10";
};

in your "scripts\loadout1.sqf" place this only:

ch50Loadout1 = true;
publicVariable "ch50Loadout1";

this should activate the script on the server only everytime you use the action.

edit: experiment with removing isServer AND from the condition to run it on all clients..

this is only major guesswork on my part btw.

Edited by Demonized
added edit.

Share this post


Link to post
Share on other sites

Problem solved, Demonized your an absolute star many thanks m8 =)

maybe issue is locality, i see the commands should work from local to global but anyhow, try this:

place in init.sqf:

ch50Loadout1 = false;

place a repeated trigger

cond:

isServer AND ch50Loadout1

on act:

ch50Loadout1 = false;
_null = [] spawn {
ch50 removeMagazinesTurret ["2Rnd_Sidewinder_AH1Z",[-1]];
ch50 removeMagazinesTurret ["2Rnd_Maverick_A10",[-1]];
ch50 removeMagazinesTurret ["4Rnd_GBU12",[-1]];

ch50 removeWeapon "SidewinderLaucher_AH1Z";
ch50 removeWeapon "MaverickLauncher";
ch50 removeWeapon "BombLauncherA10";


{ch50 addMagazineTurret ["4Rnd_GBU12",[-1]];} forEach [1,2];
     ch50 addWeapon "BombLauncherA10";
};

in your "scripts\loadout1.sqf" place this only:

ch50Loadout1 = true;
publicVariable "ch50Loadout1";

this should activate the script on the server only everytime you use the action.

edit: experiment with removing isServer AND from the condition to run it on all clients..

this is only major guesswork on my part btw.

Share this post


Link to post
Share on other sites

Yeah I think addWeapon and it's buddies only work on the machine where the unit is local, hence you were having the problems you described and hence the solution Demonized gave worked.

If you're inside the plane when you use the action, though, you might still have some problems.

Share this post


Link to post
Share on other sites
Yeah I think addWeapon and it's buddies only work on the machine where the unit is local, hence you were having the problems you described and hence the solution Demonized gave worked.

If you're inside the plane when you use the action, though, you might still have some problems.

That shouldn't be a problem as you can't call the script from inside the aircraft, although someone else may be able to call it whilst your inside as long as your still in the hangar.

If anyone would like to try the script I've uploaded it

here http://www.datafilehost.com/download-63eae3f7.html

would appreciate any feedback =)

Edited by Signaller

Share this post


Link to post
Share on other sites

why not just make the action available to just the pilot? i dont see any issues with being inside differ from being outside as galzohar is claiming.

you can add a pilot only can see the action condition like this:

_idx = this addAction ["A 10 Loadout", "scriptname.sqf", [], 0, false, true, "", "[b]driver _target == _this[/b]"];

ive higlighted the condition part of the action, it takes special variables:

_target = the object the action is on.

_this = the one doing the calling of the action.

the above condition will only make the action visible to anyone being the driver.

so no problem with "outsiders" activating the loadout messing it up for the pilot.

And again: There should be no whatsoever difference in activating the action on the inside or the outside.

locality is the same, player is the same, vehicle is the same.

If you for some reason need the pilot to exit to change loadout, then you can assign some keys to the pilot using setVariable and using _Target getvariable in the condition of the action.

many posibilitys.

Share this post


Link to post
Share on other sites

When you are a pilot the vehicle is local to you. When you are not the pilot the vehicle is local to the server.

Of course if you make the action available only for the pilot (while he's sitting inside) while making the script only run on the pilot's machine, everything *should* work correctly, and should be easy to make as well.

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  

×