Home   Help Search Login Register  

Author Topic: @Alive reloading him with the weapons he just died with  (Read 1076 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Getting a respawning soldier to load up with the weapons he died with

I can think of two approaches

1) Taking the weapons of the corpse and giving them to the respawner

2) Finding out what weapons the corpse has and giving an identical set  to the respawner (barring a few rounds from a half loaded magazine)




I need to do this to rearm a player who was illegally killed by a player shooting from or into a safezone

Any help would be appreciated
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

B-2-0

  • Guest
Re:@Alive reloading him with the weapons he just died with
« Reply #1 on: 26 May 2003, 06:38:11 »
Hi Terox, Toadlife's universal weapons respawn script allows you to respawn a player with the same weapons he died with....

--------------------------------------------------------------

;Universal Weapons Respawn Script v1.04 (March 31, 2003)
;Required Version: 1.85
;by toadlife
;toadlife@toadlife.net
;intialize like this: ["unitname",0] exec "thisscript.sqs"
;            Or this: ["unitname",1] exec "thisscript.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.xsqs}} foreach _units
;
;



~(random 0.3)
requiredVersion "1.85"
_name = _this select 0
_method = _this select 1
_hasrifle = false
_unit = call format["%1",_name]
?_method == 0:_return = "checklocal";goto "guncheck"

#checklocal
_unit = call 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 format["%1",_name]
_unit = call format["%1",_name]
_unit removemagazine (magazines _unit select 0)
_unit removeweapon (weapons _unit select 0)
"_unit addmagazine _x" foreach _mags
?_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 == "M16GrenadeLauncher":_unit selectweapon "M16Muzzle"
?_prigun == "Ak74GrenadeLauncher":_unit selectweapon "AK74Muzzle"
?_prigun == "Ak47GrenadeLauncher":_unit selectweapon "AK47Muzzle"
goto "respawnloop"


#guncheck
_guns = weapons _unit
_mags = magazines _unit
~(random 0.5)
_guncount = count _guns
_magcount = count _mags
?_unit hasweapon (primaryweapon _unit):_hasrifle = true;_prigun = primaryweapon _unit;goto _return
_hasrifle = false
goto _return
---------------------------------------------------------------------------------------

Maybe this will help ;)
« Last Edit: 26 May 2003, 06:40:18 by B-2-0 »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:@Alive reloading him with the weapons he just died with
« Reply #2 on: 26 May 2003, 11:03:40 »
thanks, was working late last night on a project and put this up to give me a headstart today, tacticians is less complicated and therefore requires less interaction by a mapmaker, making his system easier to implement

Tacticians is based on this
Due to the fact its more portable, its better for a map template

Thanks for responding mate
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123