Jump to content
Sign in to follow this  
evilnate

Weapon & Ammo Loadout Scripts

Recommended Posts

I am using a SQS script that has several types of weapon loadouts so if I want to make a change to the loadout, it can be done globaly instead of each units' init fields.

The problem I am having is that this only works as a local server (i.e. clicking preview, listen server) but not on a dedicated server. There is a gamelogic named "server" as well. If someone could explain my problem I would love it! Here is the script that is called:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; *****************************************************

; EXAMPLE:

; Type this code into the INITIALIZATION box of the crate.

; [this,"light" or "heavy"] Exec "loadout.sqs"

; *****************************************************

; Get the parameters given

_crate = _this Select 0

_loadout = _this Select 1

goto _loadout

#eastheavy

clearmagazinecargo _crate

clearweaponcargo _crate

_crate AddWeaponCargo ["AK74",10]

_crate AddWeaponCargo ["AK74GL",10]

_crate AddWeaponCargo ["AKS74U",10]

_crate AddWeaponCargo ["AKS74UN",10]

_crate AddWeaponCargo ["PK",10]

_crate AddWeaponCargo ["SVD",10]

_crate AddWeaponCargo ["KSVK",10]

_crate AddWeaponCargo ["Makarov",10]

_crate AddWeaponCargo ["MakarovSD",10]

_crate AddWeaponCargo ["RPG7V",10]

_crate AddWeaponCargo ["STRELA",10]

_crate AddWeaponCargo ["NVgoggles",50]

_crate AddWeaponCargo ["Binocular",50]

_crate AddMagazineCargo ["30Rnd_545x39_AK",50]

_crate AddMagazineCargo ["30Rnd_545x39_AKSD",50]

_crate AddMagazineCargo ["FlareWhite_GP25",20]

_crate AddMagazineCargo ["FlareGreen_GP25",20]

_crate AddMagazineCargo ["FlareYellow_GP25",20]

_crate AddMagazineCargo ["SmokeShellRed",20]

_crate AddMagazineCargo ["SmokeShellGreen",20]

_crate AddMagazineCargo ["SmokeShell",20]

_crate AddMagazineCargo ["1Rnd_HE_GP25",50]

_crate AddMagazineCargo ["FlareRed_GP25",20]

_crate AddMagazineCargo ["100Rnd_762x54_PK",50]

_crate AddMagazineCargo ["10Rnd_762x54_SVD",50]

_crate AddMagazineCargo ["5Rnd_127x108_KSVK",50]

_crate AddMagazineCargo ["8Rnd_9x18_Makarov",50]

_crate AddMagazineCargo ["8Rnd_9x18_MakarovSD",50]

_crate AddMagazineCargo ["PG7V",50]

_crate AddMagazineCargo ["PG7VR",50]

_crate AddMagazineCargo ["STRELA",50]

_crate AddMagazineCargo ["Pipebomb",50]

_crate AddMagazineCargo ["HandGrenade",50]

_crate AddMagazineCargo ["Mine",50]

_crate AddMagazineCargo ["MineE",50]

goto "done"

#westheavy

clearmagazinecargo _crate

clearweaponcargo _crate

_crate AddWeaponCargo ["M16A2",10]

_crate AddWeaponCargo ["M16A2GL",10]

_crate AddWeaponCargo ["M4",10]

_crate AddWeaponCargo ["M4GL",10]

_crate AddWeaponCargo ["M4AIM",10]

_crate AddWeaponCargo ["M4A1SD",10]

_crate AddWeaponCargo ["M4SPR",10]

_crate AddWeaponCargo ["M4A1",10]

_crate AddWeaponCargo ["M4A1GL",10]

_crate AddWeaponCargo ["G36K",10]

_crate AddWeaponCargo ["G36C",10]

_crate AddWeaponCargo ["G36A",10]

_crate AddWeaponCargo ["MP5A5",10]

_crate AddWeaponCargo ["MP5SD",10]

_crate AddWeaponCargo ["M249",10]

_crate AddWeaponCargo ["M240",10]

_crate AddWeaponCargo ["M24",10]

_crate AddWeaponCargo ["M107",10]

_crate AddWeaponCargo ["M9",10]

_crate AddWeaponCargo ["M9SD",10]

_crate AddWeaponCargo ["M136",10]

_crate AddWeaponCargo ["JAVELIN",10]

_crate AddWeaponCargo ["STINGER",10]

_crate AddWeaponCargo ["LaserDesignator",10]

_crate AddWeaponCargo ["NVgoggles",50]

_crate AddWeaponCargo ["Binocular",50]

_crate AddMagazineCargo ["30Rnd_556x45_Stanag",50]

_crate AddMagazineCargo ["30Rnd_556x45_StanagSD",50]

_crate AddMagazineCargo ["FlareWhite_M203",20]

_crate AddMagazineCargo ["FlareGreen_M203",20]

_crate AddMagazineCargo ["FlareYellow_M203",20]

_crate AddMagazineCargo ["SmokeShellRed",20]

_crate AddMagazineCargo ["SmokeShellGreen",20]

_crate AddMagazineCargo ["SmokeShell",20]

_crate AddMagazineCargo ["20Rnd_556x45_Stanag",50]

_crate AddMagazineCargo ["1Rnd_HE_M203",50]

_crate AddMagazineCargo ["FlareRed_M203",20]

_crate AddMagazineCargo ["30Rnd_556x45_G36",50]

_crate AddMagazineCargo ["200Rnd_556x45_M249",50]

_crate AddMagazineCargo ["100Rnd_762x51_M240",50]

_crate AddMagazineCargo ["5Rnd_762x51_M24",50]

_crate AddMagazineCargo ["10Rnd_127x99_M107",50]

_crate AddMagazineCargo ["30Rnd_9x19_MP5",50]

_crate AddMagazineCargo ["30Rnd_9x19_MP5SD",50]

_crate AddMagazineCargo ["15Rnd_9x19_M9",50]

_crate AddMagazineCargo ["15Rnd_9x19_M9SD",50]

_crate AddMagazineCargo ["M136",50]

_crate AddMagazineCargo ["JAVELIN",50]

_crate AddMagazineCargo ["STINGER",50]

_crate AddMagazineCargo ["Pipebomb",50]

_crate AddMagazineCargo ["HandGrenade",50]

_crate AddMagazineCargo ["Mine",50]

_crate AddMagazineCargo ["MineE",50]

_crate AddMagazineCargo ["LaserBatteries",30]

goto "done"

#westlight

clearmagazinecargo _crate

clearweaponcargo _crate

_crate AddWeaponCargo ["M4SPR",2]

_crate AddMagazineCargo ["30Rnd_556x45_Stanag",20]

_crate AddMagazineCargo ["20Rnd_556x45_Stanag",20]

_crate AddMagazineCargo ["5Rnd_762x51_M24",20]

_crate AddMagazineCargo ["Pipebomb",20]

goto "done"

#westlrsniper

removeallweapons _crate

_crate AddMagazine "10Rnd_127x99_M107"

_crate AddMagazine "10Rnd_127x99_M107"

_crate AddMagazine "10Rnd_127x99_M107"

_crate AddMagazine "10Rnd_127x99_M107"

_crate AddMagazine "10Rnd_127x99_M107"

_crate AddMagazine "10Rnd_127x99_M107"

_crate AddWeapon "M107"

_crate AddMagazine "Pipebomb"

_crate AddMagazine "Pipebomb"

_crate AddMagazine "HandGrenade"

_crate AddMagazine "SmokeShellRed"

_crate AddWeapon "Binocular"

goto "done"

#westofficer

removeallweapons _crate

_crate AddMagazine "30Rnd_556x45_Stanag"

_crate AddMagazine "30Rnd_556x45_Stanag"

_crate AddMagazine "30Rnd_556x45_Stanag"

_crate AddMagazine "30Rnd_556x45_Stanag"

_crate AddMagazine "30Rnd_556x45_Stanag"

_crate AddMagazine "30Rnd_556x45_Stanag"

_crate AddWeapon "M16A2"

_crate AddMagazine "M136"

_crate AddMagazine "M136"

_crate AddWeapon "M136"

_crate AddMagazine "SmokeShellRed"

_crate AddMagazine "SmokeShellRed"

;_crate AddWeapon "SmokeShellRed"

_crate AddWeapon "Binocular"

goto "done"

#done

exit

Share this post


Link to post
Share on other sites

Where are you exec'ing it from (trigger, script, init field)? Btw, game logic named server doesn't do anything unless you refer to it (like ?(local server):[] exec "script.sqs"), but last I heard BIS added a new command to check for the server, making this method pointless anyway.

Share this post


Link to post
Share on other sites
Quote[/b] ] Where are you exec'ing it from (trigger, script, init field)?
I am am execing from each units' init field, but not every single unit. Is there a more logical way? I've also tried execing in the init.sqs (i.e. [p2,"weastheavy"] exec "ammo.sqs"; ) and no dice.
Quote[/b] ]Btw, game logic named server doesn't do anything unless you refer to it (like ?(local server):[] exec "script.sqs"), but last I heard BIS added a new command to check for the server, making this method pointless anyway.
Thanks for update, I've read this recommended before a long time ago and have been adding it coop misisons "just because". I'll have to read up more about it and learn it's true function.

Share this post


Link to post
Share on other sites

Ok, first, if you're not refering specifically to the unit whose init field you're putting it in, if you have it in one init field you don't need it in any others, writing '[p2,"weastheavy"] exec "ammo.sqs"' in more than one init field will only execute the script on crate p2 multiple times (resulting in a way overloaded crate). Second, init fields are global space (meaning every client + the server executes the stuff in it), so even writing it in just one init field will cause the script to be repeatedly executed X amount of times for the number of clients, each time running only local to that client/the server. Whether or not that is a bad thing depends on the script. I'm not exactly sure of the locality of the effects of addWeapon/MagazineCargo anymore (yea I should know but I'm not up to date on these things), but assuming it hasn't changed then executing from a single init field will give you the required effect. Lastly, I just want to clarify whether or not you're actually using "weastheavy", since obviously there's no "weast" side and you've made a typing error, so if you are then it's not going to execute properly.

Share this post


Link to post
Share on other sites

"weastheavy" was a typo and p2 was a example of the playable unit's name instead of a crate.

The way the script is actualy being executed in the mission is adding this in the playable unit's init field. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this,"westheavy"] Exec "ammo.sqs"

Everything works fine in the editor and making a new server in game, just don't know why it won't work in a DS enviroment. banghead.gif

Share this post


Link to post
Share on other sites
"weastheavy" was a typo and p2 was a example of the playable unit's name instead of a crate.

The way the script is actualy being executed in the mission is adding this in the playable unit's init field. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this,"westheavy"] Exec "ammo.sqs"

Everything works fine in the editor and making a new server in game, just don't know why it won't work in a DS enviroment.  banghead.gif

Well that won't work. If it's in the playable unit's init, then 'this' refers to that unit, not the ammo crate. Put it in the ammo crate's init field and it should work.

Share this post


Link to post
Share on other sites
Quote[/b] ]Well that won't work. If it's in the playable unit's init, then 'this' refers to that unit, not the ammo crate. Put it in the ammo crate's init field and it should work.

Sorry for not being clear. I am not wanting to add this loadout to a ammo crate, just the unit that is execing the script. I want the unit to have this loadout on his persons when the mission starts.

Again, it does work on a local server, just not dedicated environment.

Share this post


Link to post
Share on other sites

Well, ok, but the "westheavy" loadout is only for weapon containers, if you're using that parameter it won't work on infantry (or is this unit a vehicle?). Sorry, if that's not it then I really can't tell you why it's not working.

Share this post


Link to post
Share on other sites
Well, ok, but the "westheavy" loadout is only for weapon containers, if you're using that parameter it won't work on infantry (or is this unit a vehicle?). Sorry, if that's not it then I really can't tell you why it's not working.

From now on I will stop using examples and explain exactly what i'm trying to do to avoid any more confusion. I am actualy wanting to add the "westlight" loadout to a unit. It works on a local server but not a dedicated server. I'll just have to assume that this is a bug with the game and *hope* that it gets fixed in the next patch. I've been running into all sorts of bugs with arma, very frustrating indeed...

Thanks for trying to help me Kyle! notworthy.gif

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  

×