Jump to content

Recommended Posts

How can I make the respawn time for players in a mission configurable via a parameter?

Share this post


Link to post
Share on other sites

u dont say anything about your respawn method.

I'm using A3's native respawn system set to BASE mode with the respawn time set as 40 seconds. Sorry for not mentioning that in the OP.

 

These functions allows you to delay it:

https://community.bistudio.com/wiki/BIS_fnc_setRespawnDelay

or

https://community.bistudio.com/wiki/BIS_fnc_respawnTimePenalty

I didn't see any "setRespawnTime" functions though, could have over looked one easily though.

What's the difference between those two functions? They both appear to change the respawn time in progress.

Furthermore, as there are no examples provided, how might I implement one? Such as activating when a certain amount of time has elapsed after mission start.

Share this post


Link to post
Share on other sites

[{your condition to set new delay},#,"New Delay Time Set"] call BIS_fnc_setRespawnDelay; 

[{time > 300}, 15, "5 minutes after mission started, respawn delay is now 15 seconds"] call BIS_fnc_setRespawnDelay;

I'm unsure of the locality of the function, but my educated guess would be on the server, but easy enough to find out after implementation.

  • Like 1

Share this post


Link to post
Share on other sites

My scripting knowledge is minimal, but I assume I place the code in the mission's init.sqf (as opposed to the init field of an editor-placed object.)

Is this correct?

Share this post


Link to post
Share on other sites

I would recommend putting it in the initServer.sqf, then if that doesn't work in an MP setting, try it in the initPlayerLocal.sqf.

  • Like 1

Share this post


Link to post
Share on other sites

I had a quick look at the BIS wiki page on event scripts, and I noticed some of them, such as initServer.sqf, have associated arguments. Where and for what reason are these used?

 

Also I think I heard that you can run a function server side only by putting:

if (isServer) then

in init.sqf before the function, is this true?

Share this post


Link to post
Share on other sites

The arguments passed in are useful in certain circumstances, in this case, you shouldn't need them, and yes you can use a isServer check in the init, however the initServer does this inherently, the init (after the introduction of the event scripts) is basically depreciated.

  • Like 1

Share this post


Link to post
Share on other sites

Any update about this? I tried running this on Init.sqf, initServer and also initPlayerLocal. This is what I have, am I doing something wrong? Can anyone help?

(description.ext)

respawndelay = 60;

 class respawncounter
    {// 22
        title = "Respawn Delay";
        values[] = {5, 30, 60};
        texts[] = {"5","30", "Default(60)"};
        default = 60;
    }

(init)

//respawnDelay
_respawnCounter = "respawncounter" call BIS_fnc_getParamValue;
[{_respawnCounter < 60}, _respawnCounter, "New Respawn Delay Set!"] call BIS_fnc_setRespawnDelay;
 

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

×