Home   Help Search Login Register  

Author Topic: Is it possible to make soldiers respawn in a vehicle?  (Read 1806 times)

0 Members and 1 Guest are viewing this topic.

Commando

  • Guest
Is it possible to make troops respawn in a ch47 or the c130 aircraft when they have died?
If so how do I do?
I know the basic about respawning, making a respawn marker for east and west namned respawn_west and respawn_east.
And making a working description.ext file with music in and respawn,  :D. But how do I make respawn inside a vehicle?

Thanks for any help  :)

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Is it possible to make soldiers respawn in a vehicle?
« Reply #1 on: 17 Dec 2002, 19:13:08 »
I'm not sure if there's an eventhandler that knows when a unit has respawned, but you can definitely use one that checks when a unit dies.  E.g.:

this addEventHandler ["killed", {_this exec "playerKilled.sqs"}]

In the playerKilled.sqs script, put the following code:

Code: [Select]
; Wait until the unit is alive again.

@ alive (_this select 0)

; Move the unit into the cargo space of a C-130 named "c130"

(_this select 0) moveInCargo c130

exit

See if that works.
Ranger

Commando

  • Guest
Re:Is it possible to make soldiers respawn in a vehicle?
« Reply #2 on: 17 Dec 2002, 19:14:39 »
Oki thanks I'll try that!  :D

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Is it possible to make soldiers respawn in a vehicle?
« Reply #3 on: 17 Dec 2002, 19:20:50 »
No problem at all.  That was a fast reply. :)

I forgot to be a little more specific.  First, you need Resistance to use the eventhandlers.  I hope you have that.

Second, you have to put that addEventHandler code in the initialization field of every unit that you want to be able to respawn in the indicated vehicle.

Good luck!
Ranger

Commando

  • Guest
Re:Is it possible to make soldiers respawn in a vehicle?
« Reply #4 on: 17 Dec 2002, 19:53:24 »
mmm well that explains why my soldier respawned in the water... :P
i made a trigger and put it in the init field and not in the soldiers init field.. :-[

Ah well, thanks for replying fast to :D
Well I was online on msn messenger and it shows a small pop up window every time I recieve a mail to my hotmail.. 8)
Pretty nice thing to have, even though icq is less buggy..
Cya later.

Commando

  • Guest
Re:Is it possible to make soldiers respawn in a vehicle?
« Reply #5 on: 20 Dec 2002, 01:06:48 »
mmm well I still have a problem... the soldier I have it respawns in the water still, need help.. :P

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Is it possible to make soldiers respawn in a vehicle?
« Reply #6 on: 20 Dec 2002, 19:28:11 »
Hmm.  First, double check if the killedPlayer.sqs script is being called by putting in hint messages before and after the @ alive... line.  As I haven't tested my own idea, I don't know if it's working.  :P

If you have verified that the script is called, and that it detects that the player is alive and executes the remainder of the script, then try adding a brief delay in the script.  E.g.:

Code: [Select]
;Try adding a delay here.
~0.1

; Wait until the unit is alive again.

@ alive (_this select 0)

;Or, try adding one here instead.
~0.1

; Move the unit into the cargo space of a C-130 named "c130"

(_this select 0) moveInCargo c130

exit

Try one of the two delays.  See which one works.  I don't see why either would work, but it's something to try.

If those don't do anything, verify that (_this select 0) is really the right array element to get the player.  I think that's the right one, but I could be wrong.  To test that, add the following code at the top of that script:

Code: [Select]
hint format ["Respawned Unit: %1",(_this select 0)]

Remove any other error-checking hints you may have added.  If the resulting hint is something like, "Alpha Black 1", then the element is correct.  If not, then I'll have to go figure out which one it is, or you can guess and check until you get the right one.
Ranger