OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: zeev on 18 Jun 2004, 08:26:53
-
Hello. Im working on a single player map, and i need respawn script for a player. If it possible, please help me writing this script. Thanks.
-
I'm 99 % sure that is impossible. Sorry. :-\
:beat: *Gets Shot* :beat:
-
Let's say there is 100 topics about this in the forums. 99 of them must say that it's impossible, as I would have said too, but with a quick search I found this thread
http://www.ofpec.com/yabbse/index.php?board=8;action=display;threadid=14853;start=15
There it's said that respawn for player is possible in SP. I haven't tried it so don't ask me anything more.
You can fake AI respawn in SP with a clever createunit spell. There must be topics about that too in the forums.
Cheers.
-
Yeah, why haven't I thought of that before? Although I would recommend using the EH "killed" instead of getdammage in a loop.
:beat. *Gets Shot* :beat:
-
I've experimented with this sort of thing for beta testing purposes, although I was making an invincibility script rather than a respawn one. If you want to make it "foolproof" I'd recommend an eventhandler "killed" and an eventhandler "hit" and a looping script checking damage state. The problems arise when you get multiple hits or hits from odd things like your own grenade.
-
I need to disable the "You are dead, retry, end" screen, because there is a 30 sec respawn script built in the mission i want to edit. Is it possible?
-
That screen comes when OFP has realised you're dead. In other words, you must make the unit NOT dead before OFP can notice that he was dead at some point. This is exactly what macguba said.
_unit = player
#loop
?getdammage _unit >= 1: titlecut ["","black out",0.000001]; _unit setdammage 0; _unit setpos getmarkerpos "start"
goto "loop"
The above would check if player's damage is 1 or above and if so, it would heal the unit and move him to a marker called start. That script will check the units damage as fast as it can. The question is how fast does OFP check the players condition - pretty fast.
As macguba I've tried these things too, as every "let's-see-if-this-works-ofp-editor" has, and come to the conclusion that sometimes it works and sometimes OFP is just faster than your computer :D
-
Let's be very clear about what's happening here. Respawn is not possible in SP. However, it is possible to fake it, as Armsty, Artak and I have suggested.
If you are trying to convert a MP mission to SP, while preserving respawn, one of the things you need to do is throw out the respawn script - as a whole, it's irrelevant. However, you may be able to salvage and use substantial parts of it in your fake respawn script.
If you want a 30s delay you'll need to decide what the player is going to do for that time. You may be able to use a specator script. Alternatively you could setPos the player immediatly to a position 30s run away from the weapon and vehicle depot.
-
Hmm...
What about suppling a modiyed scripts.pbo.. With the Onplayerkilled script... So it doesn't end the mission when he's killed
Dunno
The dead event handler is useless, you can't bring him back to life
The hit one doesn't work if your hit by an explosion, like a grenade or mortar
- Ben
-
Hmmm, maybe I'm missing something to see what the big difference is between getting complicated with scripting and just making it a MP mission with respawn. i.e., I've played my MP Respawn mission solo in testing so many times I've lost count. I'm only using:
Respawn = "INSTANT";
RespawnDelay = 15;
in the description.ext
Plus a line in the weaponsrespawn script which adds random placement to the respawn area.
The other difference might be Intro/outro cutscene, but we all know that can be done internally in the mission, as well.
So what gives? :-\