Jump to content
Sign in to follow this  
capncoolio

Scripting a limited respawn system!

Recommended Posts

Hi guys, I joined because I've been trying to write this script for hours and I've come up blank.

What I want to do is make it so that my MPMission ends any given player (of 4) dies 5 times.

I've been going around and around in circles all night, and I've got nothing :(

Any help would be appreciated.

Thanks,

capncoolio.

Share this post


Link to post
Share on other sites

All the major respawn scripts feature limited count respawn options. Are you using one of those? :)

Share this post


Link to post
Share on other sites
All the major respawn scripts feature limited count respawn options. Are you using one of those? :)

I've tried about a million different google searches, and I haven't found a ready-to-use script :(

Can you help me out?

Share this post


Link to post
Share on other sites
R3F Revive is a nice lightweight one that includes it.

I'm trying to implement this, but it's unplayable with AI (my friends aren't always online :P)

That and I was hoping for an "INSTANT" respawn type, rather than a base; my mission takes place over a massive area and respawning back at base would be irritating to say the least.

Is there any way I can modify this so I could do that?

Thanks for all your help so far though :)

Share this post


Link to post
Share on other sites
Peeking at it now!

What I sent you there almost works! Ideally, I'd like to forgo the "Revive" stage and just have limited respawns :)

Mostly because what I've sent you there is unplayable with bots.

Share this post


Link to post
Share on other sites

Couldn't get R3F or Norrin's to work right, so here's a version with what you wanted, counted instant respawns. It uses your neat idea of "trailing respawn markers". You can also pick how many respawns you want from the Parameters before starting the game.

I also changed your funky looking red flare thing to normal red smoke. :)

Share this post


Link to post
Share on other sites
Couldn't get R3F or Norrin's to work right, so here's a version with what you wanted, counted instant respawns. It uses your neat idea of "trailing respawn markers". You can also pick how many respawns you want from the Parameters before starting the game.

I also changed your funky looking red flare thing to normal red smoke. :)

Dude, you're amazing. Thanks so much! Yeah I think my respawn points following the players worked :D

Is it easy enough to follow that I could implement it in more missions; i.e. is it a case of using this init.sqm? Also, would this code work in multiplayer? I've heard it's dangerous to use "player" in MP, as it tends to break.

EDIT: It seems to work just fine! :D

HAHAHAHAHAHA yeah my flare was awesome man!

It did have the performance advantage though; this smoke is making me laaaaaaaaaaaaaaag :P

Meh, only when I'm really close to it anyway.

Edited by capncoolio

Share this post


Link to post
Share on other sites

So just to clarify.

If I use the same init.sqm and description.ext (with the relevant changes of course) this would work for any mission?

Share this post


Link to post
Share on other sites

init.sqf requires your units to be named p1, p2, p3 and p4.

description.ext has a mission name that you might want to change.

You'll want to have all the markers (respawn_west, respawn_west_1/2/3/4) on the map as well.

Otherwise yeah it should work fine with other missions.

Share this post


Link to post
Share on other sites

Oh yeah, I understand minor changes will need to be made.

If I want the trailing respawn markers, I'd have to slightly modify my code, otherwise I could remove it and place it on the map, right?

But yeah, all in all, I think this is a system I'll reuse. Thanks so much for your help!

Share this post


Link to post
Share on other sites

That looks way more complicated than kylania's solution!

It also looks as though it'd work for any amount of players, which is neat. But the code kylania wrote for me is easily adapted, so I'll stick with it (as I can read it!) :P

Share this post


Link to post
Share on other sites

My part of the code works for any number of players since it's per player. Even the marker part you had works too just less possible players to spawn.

Share this post


Link to post
Share on other sites

Correct me if I'm wrong, but does my marker system mean that if all but 1 player is alive, he'll respawn back at one of the corpses? I don't think it removes the previous marker, I think it just doesn't update it if the player is dead.

Share this post


Link to post
Share on other sites

The way it was working for me was every 2 seconds four of the five respawn markers would move to the locations of the 4 team members. When I died I respawned to either a random one or the nearest one wasn't sure. So not really realistic, but kinda fun. heh

Share this post


Link to post
Share on other sites

I wasn't aware of a fifth marker :/

Anyway, in all my testing it seems as though you always spawn back with one of the team members, which is what I wanted :D

EDIT: I've found that in some cases, we spawn back at a place near our landing zone. I'm at a loss as to why. I shall investigate.

Edited by capncoolio
Additions

Share this post


Link to post
Share on other sites

So if I changed this:

[] spawn {

while {alive p1 || alive p2 || alive p3 || alive p4} do {

if(alive p1) then {"respawn_west_1" setMarkerPosLocal (getPos p1);};

sleep 2;

if(alive p2) then {"respawn_west_2" setMarkerPosLocal (getPos p2);};

sleep 2;

if(alive p3) then {"respawn_west_3" setMarkerPosLocal (getPos p3);};

sleep 2;

if(alive p4) then {"respawn_west_4" setMarkerPosLocal (getPos p4);};

sleep 2;

};

};

to this:

[] spawn {

while {alive p1 || alive p2 || alive p3 || alive p4} do {

if(alive p1) then {"respawn_west" setMarkerPosLocal (getPos p1);};

sleep 2;

if(alive p2) then {"respawn_west_1" setMarkerPosLocal (getPos p2);};

sleep 2;

if(alive p3) then {"respawn_west_2" setMarkerPosLocal (getPos p3);};

sleep 2;

if(alive p4) then {"respawn_west_3" setMarkerPosLocal (getPos p4);};

sleep 2;

};

};

might that fix it?

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  

×