OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Viking on 25 Aug 2002, 00:03:03
-
Is it possible to respawn units in Single Missions? If so, can someone tell me how?
-
I believe that it is not possible. I know if would have to be done via a script, but I think there was some problem with it still ending, b/c even if it checks every 0.0000000000000001 seconds, he is still dead long enough for it to end.
Daniel J Bryant
-
hmm its pretty much impossible
-
erm, the deathscenescriptthingy.sqs is what makes it impossible to keep playing or respawn, but what if you made your own deathscene.sqs and put it ingame, and had it activate when a trigger detects if your player is dead.
if you rename the script to match the name fo the official deathscene script, it will override it, and thus you wont die???
-
I was just looking for a script to respawn enemy soldiers if they are killed. (handy in a mission with alot of units)
-
What you want are the createsquad scripts over at -
http://www.backoff.ch/ofp/
-
Thanks! How about someone made a sample mission? One that people get respawned if killed? Possible?
-
Just make a script called "onplayerkilled.sqs" and put in it:
_player = ap
_respawn = gamelogic
~1
titletext ["You were killed","PLAIN",1]
_player setpos _respawn
_player setdammage 0
exit
I think that it should work...
-
Gastovski!
Could you explain that abit better, please. And in case you misunderstood, I am looking for a script that makes the enemy respawn when killed, so that there are always enemy soldiers coming at u. (Good for BHD missions)! :)
-
Download the createsquad scripts like I mentioned in my earlier post. Spend some time learning how to use them. There's a sample mission included with the scripts.
For checking how many units are left in a group and spawning more to join the fight you could use a small script like this:
;---------------------------------------------
#loop
? NOT(alive player) : exit
?(("Alive _x" count units groupname) <= 3): [] exec "spawn.sqs"; exit
~5
goto "loop"
;--------------------------------------------
-
Hehe I thought you wanted a respawn for the player...
I will explain though...
"_player = ap" - Assigns the variable _player as ap (players name
"_respawn = gamelogic" - Assigns the var _respawn as gamelogic (The position that you want the player/unit to respawn)
"~1" - Wait approximately 1 second
"titletext ["You were killed","PLAIN",1]" - Print 'You were killed' on the screen
"_player setpos _respawn" - Move _player to _respawn
"_player setdammage 0" - Make it so _player is not damaged in any way
"exit" - Exit the script
And the code said above should work too... ;D
-
Thanks
-
How do you suggest using it? Instead of having to make a script for every D*** enemy unit in the mission. Please!
-
The script I wrote will check 1 enemy group. If you have 4 groups, of lets say 9 soldiers, you need to copy the script 4 times and put the proper groupnames in each one. Using the createsquad scripts, you can spawn a new group into the battle as each of the first groups take high casualties.
-
Does this work repeatedly? Like if one group takes high casualties, then aother group gets spawned, and if they get high casualties, ANOTHER group gets spawned, etc.
Does it work like that? Do you have infinite enemies?
-
CrashnBurn! Could oyu post that script again, but only with a groupname in it(say Foxtrot)? And also please answer the question above.
-
I'll make you a sample mission, but it's gonna take me a little while. Check back later this afternoon. It's 5:30 AM my time now.
-
[attachment deleted by admin]