milobr 0 Posted December 10, 2006 Sorry for bothering with this stupid questions, but.. I made a very, very simple script that adds weapons and ammo to any character in-game. It's like that: Quote[/b] ]this addMagazine "30Rnd_545x39_AK"this addMagazine "30Rnd_545x39_AK" this addWeapon "AK74" exit But when the character runs it, he only gets the AK without any ammo. Can anyone help me? Thanks. Share this post Link to post Share on other sites
Vänskä 0 Posted December 10, 2006 Sorry for bothering with this stupid questions, but..I made a very, very simple script that adds weapons and ammo to any character in-game. It's like that: Quote[/b] ]this addMagazine "30Rnd_545x39_AK"this addMagazine "30Rnd_545x39_AK" this addWeapon "AK74" exit But when the character runs it, he only gets the AK without any ammo. Can anyone help me? Thanks. this addweapon "AK74"; this addMagazine "30Rnd_545x39_AK" You have to put this on your units init field. If you use it in another context you have to replace "this" with your units name. Share this post Link to post Share on other sites
milobr 0 Posted December 10, 2006 But I put "[this] exec "ak74.sqs" in the init field of the units I want to give the AK. They all get the AK, but no ammo. I suppose "this" in the script is replaced by the unit which is executing it, right? Anyway, thanks for the help. I'll check it out. Share this post Link to post Share on other sites
Lolsav 0 Posted December 10, 2006 addweapon command has always have to be placed before the addmagazine command to make it work. Edit: Oh make sure you start with RemoveAllWeapons this before trying adding new weapons Share this post Link to post Share on other sites
MrZig 0 Posted December 10, 2006 addweapon command has always have to be placed before the addmagazine command to make it work.Edit: Oh make sure you start with RemoveAllWeapons this before trying adding new weapons No, you are wrong about the placement, although a removeallweapons this certainly helps from manually removing the other mags/weapons. But you can put addmagazine and should put addmagazine before addweapon. This is because if you put addweapon afterwards, you have to reload. Oh, and makesure to use this at the end. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this switchweapon primaryweapon this Anyways, back to the original dismayimafy. Quote[/b] ]But I put "[this] exec "ak74.sqs" in the init field of the units I want to give the AK. They all get the AK, but no ammo. I suppose "this" in the script is replaced by the unit which is executing it, right?Anyway, thanks for the help. I'll check it out. Exec your script like this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This exec "Ammoscript.sqs" Use this script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> removeallweapons _this _this addMagazine "30Rnd_545x39_AK" _this addMagazine "30Rnd_545x39_AK" _this addWeapon "AK74" _this selectweapon (primaryweapon _this) exit Share this post Link to post Share on other sites
milobr 0 Posted December 10, 2006 Thanks, MrZig, ir worked. Share this post Link to post Share on other sites