Jump to content
Sign in to follow this  
wass24

Setting up respawn points in a building?

Recommended Posts

I am making a deathmatch mission where everyone is on the same side (west) and are fighting in a 2 story building. I want multiple respawn points into the rooms on either floor so when you die you will randomly respawn in another room in the building. When I tried to use markers, they either respawned on the roof or outside the building. Please help.

Share this post


Link to post
Share on other sites

setpossing your markers (or gamelogics) up to a specific height should do the trick

this setpos [getpos this select 1, getpos this select 2, +4]

+10 will put them on the roof in Petrovice

Share this post


Link to post
Share on other sites

How do you give a marker a height?

Can you respawn from a gamelogic?

Share this post


Link to post
Share on other sites

If the building has predefined positions (in the editor, place a "move" waypoint right on top of the building and see if the WP has a field for the different positions or in game, see if you can move a unit to a particular position by selecting a unit and by pointing at the building, selecting a buildingpos to move to), you can use this:

this setpos (buildingname buildingpos position#)

I think that you can even replace the position# with (random #) where the # is replaced by the total number of positions in the building. Currently at work so I cannot verify the random feature.

                                                 Wadmann

Share this post


Link to post
Share on other sites

One way to do it if you're only allowing Players to spawn is to create a trigger in the mission editor, set it to Repeatedly and for the condition put

Alive Player

OnActivation

[player] exec "randomrespawn.sqs"

Then create a script named RandomRespawn.sqs

You'll also need the positions that you wish the players to respawn in, so I'd recommend placing a chair or something in the map, and then in the onInit blank, put

this setPos [(getpos this select 0),(getpos this select 1), 5]

This will set the object in the same position, except you adjust the Z value to get it exactly on the floor that you wish. Once you've confirmed that the object is in the position you wish (by going into the mission and looking at the chair) then you can change the object to an invisible H or something and give it a name like spawn1.

After you've set your spawn locations by placing those objects, then you can crate the randomrespawn.sqs file.

Let's say you placed 4 spawn locations named spawn1, spawn2, spawn3 and spawn4 using the above method, then just put something like this in the script:

Quote[/b] ]

_unit = _this select 0

;;You don't need local _unit if you're using Alive Player to

;;exec the script since Player is always local to the client.

?!Local _unit : Exit

_num = Random 1

_spawn = getPos spawn1

?_num >.25 && _num <= .5 : _spawn = getPos spawn2

?_num >.5 && _num <=.75 : _spawn = getPos spawn3

?_num >.75 : _spawn = getPos spawn4

Exit

If you want to make it so AI also respawn to these spots, then you'll need to name each unit in the map and create a separate trigger for each one. Let's say you named the units

U1, U2, U3, U4, etc.

Then instead of Alive Player in the condition of the trigger, it would be:

condition: Alive U1

onActivation: [u1] exec "randomRespawn.sqs"

And you'd need to make a trigger for each unit. Make sure to set it to trigger repeatedly.

There's plenty of ways to do this, so you might find a better way. You also might have to trouble-shoot the method since I'm just writing this off the top of my head.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×