Jump to content
ALPHIVE

Set object damage with addaction and timer ?

Recommended Posts

I everybody,

 

I would make an addaction system for my hangar with spinning light from "mounted device" object

I know that with projectors, if i set damage to 0.2 if i remember correclty, it turns off the light

 

 

So, 

 

I wanted make an addaction on computer that activate the spinning light of the mounted device, while 30 seconds, and after it comes back to its initial state

 

How can i do this ?

If there is no command for this, how can i set damage on this object while 30 second, and after comes back to initial no damage state ?

 

 

Thabk you by advance

Share this post


Link to post
Share on other sites

@ALPHIVE,

I'm not 100% sure what we're doing but this function should help you figure it out,

Spoiler

you_fnc_lightThingy=
{    params [["_caller", objNULL], ["_on", false]];
if (_on) then {
        _caller setdamage 0.2; //do damage
        sleep 30;
        _caller setdamage 0;    //fix damage
        [_caller, true]spawn you_fnc_lightThingy; //repeat
        } else {
    _caller setDamage 0;
    };
};

// call with: [object, true] spawn you_fnc_lightThingy;

 

Call this on your object to start a 30 second cycle of damage/repair.

setDamage

oops, we forgot the addAction/hold addAction

Spoiler

lightThing=[ player, "Enable Light Thing", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
"alive player", "alive object", {}, {}, {

	[object, true] spawn you_fnc_lightThingy;
    
}, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd;

// be sure to configure the name for "object"

 

Have fun!

  • Like 1

Share this post


Link to post
Share on other sites
23 hours ago, ALPHIVE said:

if i set damage to 0.2 if i remember correclty, it turns off the light

switchLight will probably work in this case

  • Thanks 1

Share this post


Link to post
Share on other sites

@killzone_kid thank you it works with trigger, but i have an issue that i do not understand when i pass through addaction

 

I placed a "mobile device" (with the spinning light) named alarmgyro and a computer. In the computer init i past following code :

 


this addAction["ALARM ON", alarmgyro1 switchLight "ON"];
this addAction["ALARM OFF", alarmgyro1 switchLight "OFF"];

 

And when i test, the light is already off, and i can not activate it, why ?

Is there a way to use addaction to active/deactivate light simply ?

 

 

Share this post


Link to post
Share on other sites

addAction takes either code or string as second param on right hand side, you pass neither. Read the documentation for 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

×