Home   Help Search Login Register  

Author Topic: Soldier respawn as initialized Script  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

NeZz_DK

  • Guest
Soldier respawn as initialized Script
« on: 03 Oct 2005, 11:38:54 »
Quote

requiredVersion "1.91"
? not local Server : exit


; script usage [Soldier,30] exec "soldierRespawn.sqs"  in init field of the soldier after the weapons have been added to the soldier.
_soldier = _this select 0

; change the delay of the respawn here lige _delay = 30 if you dont want to specify it at script startup
_delay = _this select 1

; setting up all start values

_pos = getPos _soldier
_dir = getDir _soldier
_weapons = weapons _soldier
_magazines = magazines _soldier

;loops when alive
#alive
~3


? not alive _soldier : goto "notalive"

goto "alive"


#notalive
~_delay

removeAllWeapons _soldier

; resets soldiers position and direction as it was when the script was started
_soldier setPos _pos
_soldier setDir _dir

; adds all weapons and magazines that the unit had at the startup of the script
"_soldier addMagazine _x" forEach _magazines
"_soldier addWeapon _x" forEach _weapons

;and the magic respawn takes place
_soldier setDammage 0
_soldier selectWeapon primaryWeapon _soldier

goto "alive"


Hey I just created this script it respawns soldiers as the were when the script was initialized,

some credits goes to doolittle because I got the basic idea from his vehicle respawn script

description.ext should be set to something like this
respawn = 3
respawndelay = 1000

(respawndelay should be higher then the respawn used in the script) so I just set it to 1000 in my missions,

and remember to put a game logic named Server in the game :-)

the init of the script is  [Soldier,delay] exec "soldierRespawn.sps" in the init field after any weapons have been added to the soldier

tell me what you think

by the way at the moment its only player compatible, dont use it for AI respawning they dont shoot at you when they are respawned this way
« Last Edit: 03 Oct 2005, 13:55:58 by NeZz_DK »

Offline Smooth Operator

  • Members
  • *
Re: Soldier respawn as initialized Script
« Reply #1 on: 03 Mar 2007, 16:35:38 »
i know you wrote this quite a while ago, but i just started my first map today and you have solved ALL my problems. i was JUST looking at that damned vehicle respawn script and thought "you know, there HAS to be a way to apply this to troops". well done sir...well done.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Soldier respawn as initialized Script
« Reply #2 on: 24 Oct 2007, 01:59:20 »
There is a problem with this. If an AI unit killed the soldier, then after the soldier is respawned no Ai units will target it. A better way to do it is to delete the soldier then use the createUnit command to make a new soldier. This new soldier will now be targetable by AI units.