OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Blanco on 12 Jan 2004, 20:51:58

Title: respawn 50m from leader
Post by: Blanco on 12 Jan 2004, 20:51:58
Is there a script for Coop/Team missions (with respawn) , when you die, you respawn about 50 or 100m from the leader, so you don't have to run kilometers to rejoin your teammates.

It's not very realistic; I know, but it's more fun to play.

 
Title: Re:respawn 50m from leader
Post by: Terox on 13 Jan 2004, 18:05:42
The following will Re locate the player once respawned to the Group Leader
enter the following line into the "INIT.sqs"
 [] exec "Respawn.sqs"

and then create the following "RESPAWN.sqs" script


#START
@!alive player
@ alive player
Player setpos (getpos (leader player))
goto "START"

The group leader is a different kettle of fish
To respawn the group leader to the battle, then the best thing to do is create various empty markers, and for different stages of the mission, make a boolean variable become true

like the following

When stage 1 of mission has been completed, then create a boolean as follows

Stageone = true

and the next stage

Stagetwo = true


For each stage place an empty marker,  lets call these markers "StageA" and "StageB"

your respawn script would then look like this


#START
@!alive player
@ alive player
?(Stagetwo): goto "AtStageTwo"
?(Stageone): goto "AtStageOne"
Player setpos (getpos (leader player))
goto "START"


#ATSTAGETWO
Player setpos (getmarkerpos "StageB")
goto "START"

#ATSTAGEONE
Player setpos (getmarkerpos "StageA")
goto "START"

If youn wanted only the group leader to respawn here, then you would have problems everytime a player respawned and the leader was actually in respawn, so the best thing to do is have all players respawn at these markers (Or rather relocate to them after spawning)


If you still insisted on spawning them near the leader then you would have to use the setrelpos command to position them 50m away
Title: Re:respawn 50m from leader
Post by: Blanco on 13 Jan 2004, 18:22:29
thx, Terox

I tried some things and I came up with the same solution.

About the problem with the leader in respawn :
Maybe it can be solved with a

@alive (leader player)

before you setpos the player to make sure the leader's is not in respawn.

Spawning the player 50m behind the leader is a problem because I'm never sure he will be setposed behind him. When the leader is fleeing you will be setposed in the frontline...if you know what I mean.