Jump to content
austin_medic

Scripted event handler for entering and exiting incap state?

Recommended Posts

Just curious as to what the name of the handler is, or if its even implemented as it isn't on the wiki.

Was going to take a look at what it passes to see if it would be possible to manipulate it .

Share this post


Link to post
Share on other sites

You mean something like:

_rekt addEventHandler ["AnimStateChanged", { if (_this select 1 == "incapacitated") then {hint "you got rekt";playsound "Pfrrrrt"}];

If you mean the command incapacitatedState that's not been working for me last time I messed with it.

Cheers

Share this post


Link to post
Share on other sites
You mean something like:

_rekt addEventHandler ["AnimStateChanged", { if (_this select 1 == "incapacitated") then {hint "you got rekt";playsound "Pfrrrrt"}];

If you mean the command incapacitatedState that's not been working for me last time I messed with it.

Cheers

not really what I mean.

from 1.46 update changelog:

Added: Scripted event handlers for entering and exiting the incapacitated state

I would've assumed they would be tied directly to the revive system (as that is what they are listed under)

Share this post


Link to post
Share on other sites

//Scripted event called on incapacitated
[missionNamespace, "reviveIncapacitated", [_unit]] call BIS_fnc_callScriptedEventHandler

Usage

//Add code to be called on event
[ missionNamespace, "reviveIncapacitated", {
_unit = _this select 0;
//Do Stuff
} ] call BIS_fnc_addScriptedEventHandler;

//Scripted event called on revived
[missionNamespace, "reviveRevived", [_unit, _unit getVariable ["BIS_revive_helper", objNull]]] call BIS_fnc_callScriptedEventHandler

Usage

//Add code to be called on event
[ missionNamespace, "reviveRevived", {
_unit = _this select 0;
_revivor = _this select 1;
//Do Stuff
} ] call BIS_fnc_addScriptedEventHandler;

Other handy variables

player getVariable ["BIS_revive_incapacitated", false ];	// Track whether the player is incapacitated
player getVariable ["BIS_revive_helper", objNull ];		// Unit that is reviving the player
player getVariable ["BIS_revive_forceRespawn", false ];		// Track whether player is forcing their respawn
player getVariable ["BIS_revive_dying", false ];		// Track whether player is close to death

Edited by Larrow
  • Like 6

Share this post


Link to post
Share on other sites
//Scripted event called on incapacitated
[missionNamespace, "reviveIncapacitated", [_unit]] call BIS_fnc_callScriptedEventHandler

Usage

//Add code to be called on event
[ missionNamespace, "reviveIncapacitated", {
_unit = _this select 0;
//Do Stuff
} ] call BIS_fnc_addScriptedEventHandler;

//Scripted event called on revived
[missionNamespace, "reviveRevived", [_unit, _unit getVariable ["BIS_revive_helper", objNull]]] call BIS_fnc_callScriptedEventHandler

Usage

//Add code to be called on event
[ missionNamespace, "reviveRevived", {
_unit = _this select 0;
_revivor = _this select 1;
//Do Stuff
} ] call BIS_fnc_addScriptedEventHandler;

Other handy variables

player getVariable ["BIS_revive_incapacitated", false ];	// Track whether the player is incapacitated
player getVariable ["BIS_revive_helper", objNull ];		// Unit that is reviving the player
player getVariable ["BIS_revive_forceRespawn", false ];		// Track whether player is forcing their respawn
player getVariable ["BIS_revive_dying", false ];		// Track whether player is close to death

Thanks, just what I was looking for.

Share this post


Link to post
Share on other sites

I am sorry I have to ask, but i already searched and tried for hours:

 

I would like to implement that if a player dies, that his side gets one respawn ticket. (Because with the BIS revive system getting incapacitated costs one respawn ticket)

I figured the best/only option (I only learned by myself, maybe i am completly wrong) is to create an "OnPlayerKilled.sqf" which contains something like this, but i don't know how to put it:

 

//Add code to be called on event
[ missionNamespace, "reviveIncapacitated", {
    _unit = _this select 0;
    //Do Stuff
} ] call BIS_fnc_addScriptedEventHandler;

and merge it with

 

[east, 1] call BIS_fnc_respawnTickets

I fail with connecting these two, part of the problem that i not fully understand how the reviveincapacited work.

 

If someone could help me it would be great.

Tia jfrog

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

×