JoeDeath 0 Posted June 5, 2007 Does anyone know how to make your solder have certain items at respawn? Like NV goggles. Better yet does anyone know how to make these items already active (example: NV goggles on and activated at time of respawn)? Answer to either question would be appreciated... Thanks Share this post Link to post Share on other sites
kocrachon 2 Posted June 5, 2007 I dont know how to activate them, but to give it to them, name each soldier you want to give it to and then this in on the init area. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">name addWeapon "NVGoggles" Share this post Link to post Share on other sites
JoeDeath 0 Posted June 5, 2007 Will this give the item to the solder after he respawns? Bassically I am trying to give the players night vision for the entire game reagrdles if they respawn. It's a night CTF map. I have NV in crates scattered around the map but if the player could just attomatically start with them regardles if there respawning form death or not it would be great. I know how to have them start with NV... it's respawning with NV that seems difficult. I'll expeirment with the advice you gave. Share this post Link to post Share on other sites
kocrachon 2 Posted June 5, 2007 oh respawn, hmm, what kind of respawning are you doing? Respawn at base? or respawn group? Share this post Link to post Share on other sites
mr.peanut 1 Posted June 6, 2007 You need a script that rearms the player. In unit's init: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul = this execVM "rearm.sqf" rearm.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (player == _this) then {  while {TRUE} do  {    waitUntil (not alive player);    sleep 1;    waitUntil (alive player);    add your weapons here;  }; }; (Code is untested. I think the infinite while do loop limitations have been fixed in ArmA) Share this post Link to post Share on other sites
maddogx 13 Posted June 6, 2007 @Mr.Peanut: That will only work for player units. What if I wanted to apply it to an AI unit? I've tried scripts like this on AI but to no effect. Also, as for infinity loops, I use a workaround: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> for [{_loop=0},{_loop>=0},{_loop=_loop}] do { Â // Code }; There is no limitation on that. Share this post Link to post Share on other sites
mr.peanut 1 Posted June 6, 2007 With AI units, the only way I can think of is the old fashioned method of passing the units names into a script via strings. Unit's name is p1 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul = ["p1"] execVM "rearm.sqf" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = compile _this select 0; if (local call _unit) then { while {TRUE} do { waitUntil (not alive (call _unit)); sleep 1; waitUntil (alive (call _unit)); (call _unit) addWeapons. your weapons here; }; }; At least, this is how the problem was overcome in OFP. Not sure if it will work in ArmA. Share this post Link to post Share on other sites
Guest Posted June 6, 2007 people go on wiki and search before posting here to know how to add weapons and stuff to a player ... Share this post Link to post Share on other sites
VanhA 10 Posted June 7, 2007 For player units try "weapons_respawn" script by Toadlife , edited by Norrin... It can be modified for soldiers to spawn with start up gear or gear one has upon dying. Share this post Link to post Share on other sites
kocrachon 2 Posted June 7, 2007 people go on wiki and search before posting here to know how to add weapons and stuff to a player ... addweapon doesn't work for respawning players. He knows how to add a weapon, his issie is making it be on the player as they respawn, not when he starts. Share this post Link to post Share on other sites
JoeDeath 0 Posted June 7, 2007 Thanks all for the help I will try the sricpt tonight or over the weekend. Not real expierenced so I may be back to ask more questions. Share this post Link to post Share on other sites
JoeDeath 0 Posted June 7, 2007 OH... One more thing can you give me an example of what you would type in the "add weapon here section". is it like "this addweapon "NVGoggles"; this addweapon "AK74"; ect... or this addweaponcagro ["AK74",1]; I am ussuming the first example since thats how you controll what the player starts with. Share this post Link to post Share on other sites
norrin 9 Posted June 8, 2007 OH... One more thing can you give me an example of what you would type in the "add weapon here section". is it like "this addweapon "NVGoggles"; this addweapon "AK74"; ect... or this addweaponcagro ["AK74",1]; I am ussuming the first example since thats how you controll what the player starts with. Just add the weapons you want the way your normally would in the unit's init line in the editor ie. this addweapon "NVGoggles" (as you suggested in your post). What Toadlife's script then does is it keeps a track of what weapons the unit started the mission with or what weapons he died with and then re-adds them when the unit respawns, so as long as its in the init line of the unit the script does the rest of the work. Here's the code for the ArmA version of Toadlife's script <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;Universal Weapons Respawn Script v1.04 (March 31, 2003) revised (March, 2007) ;Required Version: ArmA ;original by toadlife revised by norrin for ArmA ;toadlife@toadlife.net ;intialize like this: ["unitname",0] exec "weapons_respawn.sqs" ; Or this: ["unitname",1] exec "weapons_respawn.sqs" ; ; * "unitname" = The name of the player the script runs on (must be enclosed by quotes!) ; * 0/1 = method of repleneshing weapons ; **if method is 0, the player gets the same weapons he started out with every time ; **if method is 1, the player gets the same weapons he had when he died ; ; Advanced example method of initializing script - put the following lines in your init.sqs, ; and replce the unit names with your own: ;_units = ["w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18"] ;{[_x,0] exec {weapons_respawn.sqs}} foreach _units ; ; ~(1 + (random 0.3)) _name = _this select 0 _method = _this select 1 _hasrifle = false _unit = call compile format["%1",_name] ?(_method == 0):_return = "checklocal";goto "guncheck" #checklocal _unit = call compile format["%1",_name] ?(local _unit):goto "respawnloop" ~(1 + (random 3)) goto "checklocal" #respawnloop @!alive _unit #checkmethod ?(_method == 1):_return = "waitforlife";goto "guncheck" #waitforlife @alive call compile format["%1",_name] _unit = call compile format["%1",_name] removeAllWeapons _unit ?_hasrifle:_guns = _guns - [_prigun];_guncount = count _guns _c = 0 while {_c <= (_magcount - 1)} do {_unit addmagazine (_mags select _c); _c = _c + 1} _c = 0 while {_c <= (_guncount - 1)} do {_unit addweapon (_guns select _c); _c = _c + 1} ?_hasrifle:_unit addweapon _prigun;_gun = _guns + [_prigun] ;//If unit has a rifle select it ?_hasrifle:goto "selectrifle" ;//No rifle - if unit has a pistol, select it ?_unit hasweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0):_unit selectweapon ((weapons _unit - [secondaryweapon _unit,"Binocular","NVGoggles"]) select 0);goto "respawnloop" ;//No rifle or pistol, select secondary weapon _unit selectweapon secondaryweapon _unit goto "respawnloop" #selectrifle ;// BUG WORKAROUND! - Added to compensate for selectweapon bug ;// Any gun with more than one muzzle (grenadelaunchers) cannot be selected with selectweapon! ;// Default Grenadelaunchers supported - Add your own types if you need to. _unit selectweapon _prigun ?_prigun == "M16A2GL":_unit selectweapon "M16Muzzle" ?_prigun == "M16A4GL":_unit selectweapon "M16Muzzle" ?_prigun == "M16A4_ACG_GL":_unit selectweapon "M16Muzzle" ?_prigun == "M4GL":_unit selectweapon "M4Muzzle" ?_prigun == "M4A1GL":_unit selectweapon "M4Muzzle" ?_prigun == "AK74GL":_unit selectweapon "AK74Muzzle" goto "respawnloop" #guncheck _guns = weapons _unit _mags = magazines _unit ~(1 + (random 0.5)) _guncount = count _guns _magcount = count _mags ?_unit hasweapon (primaryweapon _unit):_hasrifle = true;_prigun = primaryweapon _unit;goto _return _hasrifle = false goto _return Share this post Link to post Share on other sites