Jump to content
Sign in to follow this  
ange1u5

Help with respawns for individual players after passing a trigger/checkpoint...

Recommended Posts

So I recently released this mission to the public: http://forums.bistudio.com/showthread.php?165940-MP-RC-The-Great-Altis-Highway-Race

Its almost where I want it to be, but the final thing I really want to implement I have no idea how to do properly (or if its possible). Along the route of this race are 6 checkpoints where you can pick up fresh, undamaged cars to race in. I would like to set it so players can respawn at these checkpoints after they pass them but only at the individual level. I have tried using the respawn module and I can successfully get it to activate once players pass the trigger. Unfortunately it activates for ALL players rather than just the individual passing. Is it possible to do this?

I would also like to have it so when the player dies, you get the map on screen allowing you to choose where to respawn (like in BECTI for example), but again not sure how to implement this. This feature however is not so important, just more an afterthought.

Any help on this appreciated!

Share this post


Link to post
Share on other sites

createMarkerLocal for respawn_west and setMarkerPos that as you reach checkpoints.

For the respawn menu, check the Mission Presentation sticky.

Share this post


Link to post
Share on other sites

Cool, can you elaborate on that a bit for me? Is createMarkerLocal/setMarkerPos meant to be done in the editor or through the sqf/ext files? I need context on how to use them =P

Thanks again.

Share this post


Link to post
Share on other sites

Instead of placing the markers on the map you'd run a script on each player to create the markers locally. Then in the checkpoints you'd move them. So yeah, SQF files. :) I'm in the middle of something at the moment, but I'll whip up an example later or just search for "createMarkerLocal respawn_west" and you should find something I bet.

Share this post


Link to post
Share on other sites

Much appreciated Kylania! If you could post an example that would be awesome as I'm still quite noobish at all this scripting stuff and my brain has frozen at all the googling I've been doing about things these past few days :D

Share this post


Link to post
Share on other sites

Bis_fnc_addRespawnPosition is capable of adding a respawn position to a specified unit only.

[unit, "respawnMarkerName"] call BIS_fnc_addRespawnPosition

Just dont use markers named respawn_SIDE# as these are available to all units of that side without having to add the position.

Share this post


Link to post
Share on other sites

Many thanks Kylania and Larrow. I've had a play around with it, but I think the trigger condition needs adjusting since all players will be in a car when they pass the trigger. I did just test it with your demo mission by being in a car and the trigger won't fire.

The COND is PlayerOne in thislist && local PlayerOne right?

I use the code this && (vehicle player in thislist) for other triggers (again provided by you Kylania!) so how can I adapt the trigger COND for it to work with vehicles?

Edited by ange1u5

Share this post


Link to post
Share on other sites

That's exactly how. vehicle player will trigger for the player himself or the player's vehicle.

Share this post


Link to post
Share on other sites

Awesome, it does indeed work. I thought maybe it would require a bit of extra code but good to know it doesn't! Thanks again for your help :)

Edit: nm I think I got it working \o/

Edited by ange1u5

Share this post


Link to post
Share on other sites

Ok yes, it does work, brilliant. Now onto the next problem to solve. When a player passes through the trigger, he's ending up dragging ALL the respawn points to the new checkpoint. Ithink its because this && (vehicle player in thislist) is when any player enters the trigger, therefore its setting off all the triggers for all specific players, thus moving the respawn. Can this && (vehicle player in thislist) be refined further so only specific player in this list as it were activates the trigger?

Share this post


Link to post
Share on other sites

I realise I probably shouldn't do this but buuuuuummmmppp!! :P

Share this post


Link to post
Share on other sites

Are you sure it's the trigger activating all machines or is that just your assumption? It would be the first time I see any trigger with "player" in it to active for someone else than the player alone.

PS. Using "this" in a condition when you already use "thislist" is not needed, because thislist uses the trigger settings already.

Share this post


Link to post
Share on other sites

No I've tested it with another player. I let him go past the trigger, I can see on the map that all markers end up moving when he passes the triggers, I kill myself and end up at that new spawn point despite the fact I've never passed the triggers myself :(

Share this post


Link to post
Share on other sites

You'll wanna move the checkpoints to a script. Delete all the respawn markers on the map. move cp1 through whatever to where your checkpoints are. Delete the checkpoint triggers you have on the map.

Add this to init.sqf: (get rid of the waitUntil script done thing that never finishes too)

[] execVM "checkpoints.sqf";

checkpoints.sqf:

_marker = createMarker ["mrkp1", getPos player];
_marker setMarkerShape "ICON"; 
_marker setMarkerType "respawn_unknown";
_marker setMarkerColor "ColorGreen";

{
_trig = createTrigger ["EmptyDetector", getPos _x ];
_trig setTriggerActivation ["ANY", "PRESENT", false];
_trig setTriggerArea [20, 50, -32, false];
_trig setTriggerStatements ["this && (vehicle player in thislist)", "hint 'Checkpoint Reached!'; 'mrkp1' setMarkerPos getPos thistrigger; [player, 'mrkp1'] call BIS_fnc_addRespawnPosition; ", ""];

} forEach [cp1, cp2]; // add other cpx as needed

That'll add a trigger which moves the mrkp1 marker and respawn point for each player to each passed checkpoint.

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  

×