setPlayerRespawnTime: Difference between revisions

From Bohemia Interactive Community
(created)
 
m (Fix)
 
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2oa |= Game name
|game1= arma2oa
|version1= 1.57


|1.57|= Game version
|game2= tkoh
|version2= 1.00


|eff= local|= Effects in MP
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| Set the time interval to wait on player respawn. It is set to mission default on mission start again. |= Description
|eff= local
____________________________________________________________________________________________


| '''setPlayerRespawnTime''' interval |= Syntax
|gr1= Multiplayer


|p1 = interval: [[Number]] - respawn time in seconds|= Parameter 1
|descr= Sets the time interval (in seconds) that the player must wait before respawn, for the next respawn only.
It resets to mission default on mission start.
In Single Player or when respawn type is GROUP or SIDE in Multiplayer, setting player respawn time has no effect, and [[playerRespawnTime]] will always return -1.


| [[Nothing]] |= RETURNVALUE
|s1= [[setPlayerRespawnTime]] interval


|p1= interval: [[Number]] - respawn time in seconds


|x1= <code>setPlayerRespawnTime 5;</code>|= EXAMPLE1
|r1= [[Nothing]]
____________________________________________________________________________________________


| [[playerRespawnTime]] |= SEEALSO
|x1= <sqf>setPlayerRespawnTime 5; // next respawn (and only this one) will happen 5s after death</sqf>


| |= MPBEHAVIOUR
|x2= Set the respawn duration through variable:
____________________________________________________________________________________________
<sqf>
}}
player addEventHandler ["Killed", {
setPlayerRespawnTime (player getVariable ["TAG_RespawnDelay", 10]);
}];
</sqf>


<h3 style='display:none'>Notes</h3>
Somewhere else, e.g on objective completion:
<dl class='command_description'>
<sqf>
<!-- Note Section BEGIN -->
player setVariable ["TAG_RespawnDelay", 5];
</sqf>
or if that player is on another machine:
<sqf>
waitUntil { not alive _target };
_thatPlayer setVariable ["TAG_RespawnDelay", 5, true];
</sqf>


<!-- Note Section END -->
|x3= Increase respawn duration every death:
</dl>
<sqf>
player addEventHandler ["Killed", {
private _respawnTime = player getVariable ["TAG_RespawnDelay", 8];
setPlayerRespawnTime _respawnTime;
player setVariable ["TAG_RespawnDelay", _respawnTime + 1]; // don't die too many times
}];
</sqf>


<h3 style='display:none'>Bottom Section</h3>
|seealso= [[playerRespawnTime]] [[respawnVehicle]]
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 13:47, 22 January 2026

Hover & click on the images for description

Description

Description:
Sets the time interval (in seconds) that the player must wait before respawn, for the next respawn only. It resets to mission default on mission start. In Single Player or when respawn type is GROUP or SIDE in Multiplayer, setting player respawn time has no effect, and playerRespawnTime will always return -1.
Groups:
Multiplayer

Syntax

Syntax:
setPlayerRespawnTime interval
Parameters:
interval: Number - respawn time in seconds
Return Value:
Nothing

Examples

Example 1:
setPlayerRespawnTime 5; // next respawn (and only this one) will happen 5s after death
Example 2:
Set the respawn duration through variable:
player addEventHandler ["Killed", { setPlayerRespawnTime (player getVariable ["TAG_RespawnDelay", 10]); }];
Somewhere else, e.g on objective completion:
player setVariable ["TAG_RespawnDelay", 5];
or if that player is on another machine:
waitUntil { not alive _target }; _thatPlayer setVariable ["TAG_RespawnDelay", 5, true];
Example 3:
Increase respawn duration every death:
player addEventHandler ["Killed", { private _respawnTime = player getVariable ["TAG_RespawnDelay", 8]; setPlayerRespawnTime _respawnTime; player setVariable ["TAG_RespawnDelay", _respawnTime + 1]; // don't die too many times }];

Additional Information

See also:
playerRespawnTime respawnVehicle

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note