setPlayerRespawnTime: Difference between revisions
(created) |
Lou Montana (talk | contribs) m (Fix) |
||
| (47 intermediate revisions by 7 users not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| arma2oa |= | |game1= arma2oa | ||
|version1= 1.57 | |||
|1. | |game2= tkoh | ||
|version2= 1.00 | |||
| | |game3= arma3 | ||
|version3= 0.50 | |||
| | |eff= local | ||
| | |gr1= Multiplayer | ||
| | |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. | |||
| [[ | |s1= [[setPlayerRespawnTime]] interval | ||
|p1= interval: [[Number]] - respawn time in seconds | |||
| | |r1= [[Nothing]] | ||
| | |x1= <sqf>setPlayerRespawnTime 5; // next respawn (and only this one) will happen 5s after death</sqf> | ||
| | |x2= Set the respawn duration through variable: | ||
<sqf> | |||
} | player addEventHandler ["Killed", { | ||
setPlayerRespawnTime (player getVariable ["TAG_RespawnDelay", 10]); | |||
}]; | |||
</sqf> | |||
< | Somewhere else, e.g on objective completion: | ||
< | <sqf> | ||
< | 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> | |||
< | |x3= Increase respawn duration every death: | ||
</ | <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> | |||
|seealso= [[playerRespawnTime]] [[respawnVehicle]] | |||
[[ | }} | ||
[[ | |||
Latest revision as of 13:47, 22 January 2026
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:
Somewhere else, e.g on objective completion:player addEventHandler ["Killed", { setPlayerRespawnTime (player getVariable ["TAG_RespawnDelay", 10]); }];or if that player is on another machine:
- 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