OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: The-Architect on 13 Mar 2004, 08:26:29

Title: Respawn in SP
Post by: The-Architect on 13 Mar 2004, 08:26:29
Is it possible to have a respawn in single player?
Title: Re:Respawn in SP
Post by: MGeo on 13 Mar 2004, 09:14:11
No. I think it is not possible. I tried to do something like that but it doesn't work. Only in multiplayer. Maybe there is a script for this but i am not sure it will be possible.
Title: Re:Respawn in SP
Post by: DBR_ONIX on 13 Mar 2004, 10:52:25
It is possible!
If you download Castle Ruins (ofp.info news achive I think.. Search should find it)
I de-pbo-ed it.. And theres file called respawn_z1.sqs

I'll look in to later..
- Ben
Title: Re:Respawn in SP
Post by: icarus_uk on 13 Mar 2004, 11:41:29
If you want to respawn in single player, you make the mission as a multiplayer mission, allow only one possible position to choose and tell people that while the mission is in the multiplayer missions menu, its only for one person.

You cant respawn in regular single player.
Title: Re:Respawn in SP
Post by: Maddmatt on 13 Mar 2004, 11:44:48
I once managed to do an sp respawn, but after you respawn nothing happens when you press escape and enemies dont seem to attack you. You have normal control over your character but the only way to exit the game then is by ALT+F4.
Title: Re:Respawn in SP
Post by: Artak on 13 Mar 2004, 12:16:50
"Respawn" in SP is possible but highly unreliable. Basicly, what you want to do is to either have a script detect when the player is killed, then heal and setpos him or use eventhandler to lauch a script which does the same. The whole process must be done in a flash; before ofp notices that the player has been killed.. I assume we're talking about < 0.5 seconds.
Anywho, as said there's a high propability of the player becoming a vegetable. The script could look something like this.


;SPrespawn.sqs
;SP respawn test
;place a marker on the map and name it as 'start'
;place a trigger with condition true and on activation: [] exec "SPrespawn.sqs"

#start
@!alive player
titlecut ["aww crap","Black Out",0.000001]
player setdammage 0
player setpos getmarkerpos "start"
~3
titlecut ["respawn respawn..","Black In",5]
goto "start"
Title: Re:Respawn in SP
Post by: DBR_ONIX on 13 Mar 2004, 20:53:11
You can use this addeventhandler ["hit","setpos this getpos respawn; this setdammage 0"]
But if you get hit by a small round.. You still respawn..
The dead respawn doesn't work, it just moves a corpse around (setdammage mustn't work after the player is dead or something)

The export it as mutliplayer thing would work perfectly.. It's just not ideal..
In the readme for that, tell them to host a LAN game, load the mission and drag there name on to it..

Only things are you don't get savegames in multiplayer.. But if you respawn, that shouldn't be a prob..

- Ben
Title: Re:Respawn in SP
Post by: Tactician on 14 Mar 2004, 10:09:36
It might be more reliable to use Artak's script (I assume it works sometimes?) and change the @ to a very fast loop, maybe even a loop without delay (although I've never used loops without delays and can't claim to know how they work).
Title: Re:Respawn in SP
Post by: icarus_uk on 14 Mar 2004, 13:25:07
They cycle every frame.
Title: Re:Respawn in SP
Post by: DBR_ONIX on 14 Mar 2004, 15:04:14
And they do a pretty good job of screwing up the game by crashing it :P

The castle ruins II script is basicly:
A trigger that if the players dammage, the script sets playerdead to true or 1
And a looping script with a 0.01 delay, that checks if the playerdead is true
Then playmoves "combattodying"
Then setpos's the player to a coord and setdammage's them to 0

It seems to work okay.. I didn't get a You Are Dead screen, even though I got killed a few times

- Ben
Title: Re:Respawn in SP
Post by: The-Architect on 17 Mar 2004, 18:05:36
What about respawning as the next in command as part of a team?
Surely if it's possible in MP, the scripting or whatever can be switched to SP play.