Home   Help Search Login Register  

Author Topic: Respawning in SP  (Read 1243 times)

0 Members and 1 Guest are viewing this topic.

DBR_ONIX

  • Guest
Respawning in SP
« on: 19 Nov 2003, 22:58:53 »
Is it possible?
I have an idea that would seriously benifit (IE, make it playable) if, when you die, you apper back at the base, fit (No weapons, that you would get at an ammo box etc).. As if a medivac picked you up, took you to a hospital, back to the base... All in a second!

Any one know how??

Thanks a million
- Ben

m21man

  • Guest
Re:Respawning in SP
« Reply #1 on: 20 Nov 2003, 00:40:09 »
I think that at the moment you die in single player, the game ends. Maybe something like this would work:
Code: [Select]
#loop
@(getdammage player > .9)
player setdammage 0
removeallweapons player
player setpos getmarkerpos "respawn"
goto "loop"
« Last Edit: 20 Nov 2003, 15:38:38 by m21man »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Respawning in SP
« Reply #2 on: 20 Nov 2003, 20:33:55 »
Nah, I don't think scripts are "fast" enough to catch that before the player dies. Use an eventhandler instead. I KNOW that you can make yourself invincible with one, so I'm sure you could do "respawns" like this as well.

Maybe something like this:

player addeventhandler ["Killed", {player setdammage 0; removeallweapons player; player setpos getmarkerpos "respawn"}]

I haven't tried using a killed EH on the player though. I know that using a "hit" EH, you can make yourself invincible like so:

player addeventhandler ["hit", {player setdammage 0}]

So maybe you would need to use a "hit" EH instead:

player addeventhandler ["hit", {if (damage player > 1) then {player setdammage 0; removeallweapons player; player setpos getmarkerpos "respawn}]

Let me know which one works  ::)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

DBR_ONIX

  • Guest
Re:Respawning in SP
« Reply #3 on: 22 Nov 2003, 18:22:45 »
I will :)
I'll try in a bit...
- Ben

Offline KJAM

  • Contributing Member
  • **
  • Why Me, Whats it For?
    • Nightstalker mod
Re:Respawning in SP
« Reply #4 on: 22 Nov 2003, 20:54:38 »
Quote
player addeventhandler ["Killed", {player setdammage 0; removeallweapons player; player setpos getmarkerpos "respawn"}]
this one does NOT work, all it does is teleport the dead body


BUT!!!
Quote
player addeventhandler ["Hit", {player setdammage 0; removeallweapons player; player setpos getmarkerpos "respawn"}]
DOES work

and
Quote
player addeventhandler ["hit", {if (damage player > 1) then {player setdammage 0; removeallweapons player; player setpos getmarkerpos "respawn}]

does NOT work

DBR_ONIX

  • Guest
Re:Respawning in SP
« Reply #5 on: 22 Nov 2003, 21:02:13 »
What should I use for the "spawn" thing.. Game logic?
Sorry :)
But with the game logic, named spawn, weird tings happened... Liike if I grenaded my self, Opfp closed.. If someone shot me, I few to the other (Teleported) to the very corner of the island (water and  beige/orange floor)

Killed doesn't work..

So what should I use for the spawn... Stupid question.. But I don't know!
:)
- Ben

DBR_ONIX

  • Guest
Re:Respawning in SP
« Reply #6 on: 22 Nov 2003, 21:03:18 »
BTW What about
... hit", {if (damage player > 0.5) then {player s

Would this work?
- Ben