Jex =TE= 0 Posted June 14, 2008 I'm trying to get to grips with scripting here and I'm already suffering. I have placed 2 civilians and using the "init.sqs" I have made them unfriendly to West - works fine. I have placed 1 civvy and used; [islandCiv1] exec "CivWeapon.sqs"; This sqs file contains this addWeapon "m16a2"; this addMagazine "30Rnd_556x45_Stanag"; this addMagazine "30Rnd_556x45_Stanag"; this addMagazine "30Rnd_556x45_Stanag"; Works fine. I then add a second Civ called IslandCiv2 and use; [islandCiv2] exec "CivWeapon.sqs"; Now when I preview it only gives civ2 an M16. So I thought, OK I'll just make 2 .sqs and give them the same code as above (this addweap..) and name the file CivWeapon2.sqs. So now I have [islandCiv1] exec "CivWeapon.sqs"; [islandCiv2] exec "CivWeapon2.sqs"; But only Civ2 has an M16 still??? Help!? Share this post Link to post Share on other sites
=Odin= 0 Posted June 14, 2008 G'day, forget the scripts and add this line into each civs init. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> this addWeapon "m16a2";{this addMagazine "30Rnd_556x45_Stanag"} foreach [0,0,0,0,0,0,0,0,0,0]; should work mate Odin Share this post Link to post Share on other sites
Mr-Murray 0 Posted June 14, 2008 Hi Please always place the weapon at least! So the weapon will be loaded automatically. Like this: this addMagazine "30Rnd_556x45_Stanag"; this addMagazine "30Rnd_556x45_Stanag"; this addMagazine "30Rnd_556x45_Stanag"; this addWeapon "m16a2"; If you giving the weapon at first it won´t be loaded at start. Cheers Mr-Murray Share this post Link to post Share on other sites
raedor 8 Posted June 14, 2008 [<unit name>, [<weapon name>], [[<mag name>,<mag count>]]] execVM "ammoScript.sqf" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_u = _this select 0; if (count (weapons _u) > 0) then { removeAllWeapons _u }; { for "_i" from 1 to (_x select 1) do { _u addMagazine (_x select 0) }; } forEach (_this select 2); { _u addWeapon _x } forEach (_this select 1); You can add more weapons in the weapons array and more mags in the mag array, example:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[player, ["m16", "LAW"], [["M16mag",5], ["law", 2]]] execVM "ammoScript.sqf" Share this post Link to post Share on other sites
Cloughy 0 Posted June 17, 2008 Also dont any weapon scripts have to be launched from the Init line of the uint? I may be wrong. Also in MP, any unit in the players group has to have the add gear command in the init line. I tried once with scripts and it sometimes adds weapons and sometimes doesnt. Specially on the player. Cheers GC Share this post Link to post Share on other sites
TeRp 1 Posted June 17, 2008 You're using "this" wrong. Checkout the following tutorial on the usage of this & _this http://ofpec.com/ed_depo....cat=xyz Share this post Link to post Share on other sites