Jump to content
Sign in to follow this  
bauhaus

Respawning with the weapon you had when you died.

Recommended Posts

Hi, I have a mission that I am working on and wondered if there was a way to make it so that when you got killed and respawned that you would respawn with the weapon you had when you died.

I know how to have it so you respawn with a specific weapon via a trigger at the respawn area, but I was hoping to figure out a way to have you get the same weapon you had when you died (other than running to your old corpse and taking that one).

Anyone have any idea on this?

Share this post


Link to post
Share on other sites

Try this:  create a trigger, SWITCH--REPEATEDLY, condition "!alive unitname", activation "[unitname] exec "checkweapon.sqs"", deactivation "[unitname] exec "giveweapon.sqs""

* For "checkweapon.sqs", put something along the lines of the following:

_theunit = _this select 0

? _theunit hasWeapon "m16" : heldWeapon = "m16"

? _theunit hasWeapon "m21" : heldWeapon = "m21"

? _theunit hasWeapon "m60" : heldWeapon = "m60"

...and so on...

* And then for "giveweapon.sqs":

_theunit = _this select 0

? heldWeapon = "m16" : goto giveM16

? heldWeapon = "m21" : goto giveM21

? heldWeapon = "m60" : goto giveM60

#giveM16

_theunit removeAllWeapons; _theunit addWeapon "m16"; _theunit addMagazine "m16"; _theunit addMagazine "m16"; _theunit addMagazine "m16"; _theunit addMagazine "m16"

exit

...and so on down the line.

If this is for multiple human players, I *think* you need to add a game logic unit (I give it the name "SERVER") and change the condition to "(local SERVER) AND !alive unitname", so that only one computer (the server) runs the script.

Oh, and to support multiple soldiers, each soldier must have its own uniquely named "heldWeapon" variable.

- PlaneShifter -

(Edited by PlaneShifter at 2:55 pm on Nov. 29, 2001)

(Edited by PlaneShifter at 2:56 pm on Nov. 29, 2001)

Share this post


Link to post
Share on other sites

Also, I forgot to mention that the map was a DM map.

Thanks for the help, I'll give that a shot and see how it goes.

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  

×