Operation Flashpoint Dragon Rising OFDR Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

HIT EVENT

Go down

HIT EVENT Empty HIT EVENT

Post by Razer01 Fri 01 Apr 2022, 04:58

I bring to your attention the following code:
Code:
-------------- Check vehicle mfct status ----

function onHit_ca1(victim, attacker)
hitpoint = hitpoint +1;
 if hitpoint >= 10 then
 OFP:disableEvent("onHit_ca1");
 OFP:addTimer("HitCaP",300);
 OFP:addTimer("HitCaF",200);
 hitpoint = 0;
 end
end

function onTimerHitCaP()
 if (OFP:isMobilityKill("ca1") == true) and (caDestroyCA1 == 0)
 and (destroyCA1 == 0) and (damage2 == 0) then
 mobilityCA1 = 1;
 end
 if (OFP:isFirepowerKill ("ca1") == true) and (caDestroyCA1 == 0)
 and (destroyCA1 == 0) and (damage1 == 0) then
 firepowerCA1 = 1;
 end
 if damage0 == 0 then
 OFP:addTimer("CollisionCheck",100);
 end
OFP:removeTimer("HitCaP");
end

function onTimerHitCaF()
 if (OFP:isCatastrophicallyDestroyed("ca1") == true) then
 OFP:displaySystemMessage("Catastrophical");
 caDestroyCA1 = 1;
 end
 if (OFP:isDestroyed("ca1") == true) and (caDestroyCA1 == 0) then
 OFP:displaySystemMessage("Destroyed");
 destroyCA1 = 1;
 end
OFP:removeTimer("HitCaF");
end

function onTimerCollisionCheck()
OFP:displaySystemMessage("Collision check..");
if mobilityCA1 == 1 and firepowerCA1 == 1 then
OFP:displaySystemMessage("Firepower and Mobility");
damage0 = 1;
end
 if mobilityCA1 == 0 and firepowerCA1 == 1 and damage1 == 0 then
 OFP:displaySystemMessage("Firepower only");
 damage1 = 1;
 end
 if mobilityCA1 == 1 and firepowerCA1 == 0 and damage2 == 0 then
 OFP:displaySystemMessage("Mobility only");
 damage2 = 1;
 end
 
OFP:enableEvent("onHit_ca1");
OFP:displaySystemMessage("..check out");
OFP:removeTimer("CollisionCheck");
end

this code allows to separate the events of the vehicle damage.


Last edited by Razer01 on Tue 02 May 2023, 23:42; edited 1 time in total (Reason for editing : -)

Razer01

Points : 12
Reputation : 1
Join date : 2014-12-15

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum