| 09-01-2006, 05:11 AM | #2 |
damage detection on attack complex problem, here are one way to solve it JASS:function Damage takes nothing returns nothing local trigger t = null local unit attacker = null if GetEventDamage() > 0 then set t = GetTriggeringTrigger() set attacker = I2U(GetStoredInteger(Cache, I2S(H2I(t)), "atkr")) if GetEventDamageSource() == attacker then // Do thing call DisableTrigger(t) endif set attacker = null set t = null endif endfunction function Trig_Test_Actions takes nothing returns nothing local trigger t = CreateTrigger() local string s = I2S(H2I(t)) call StoreInteger(Cache, s, "atkr", GetAttacker()) call TriggerRegisterUnitEvent(t, GetTriggerUnit(), EVENT_UNIT_DAMAGED ) call TriggerAddAction(t, function Damage ) call PolledWait(1) // time need fit to melee/range unit call FlushStoredMission(Cache, s) call DestroyTrigger(t) set t = null endfunction function InitTrig_Test takes nothing returns nothing set gg_trg_Test = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Test, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddAction( gg_trg_Test, function Trig_Test_Actions ) endfunction |
| 09-01-2006, 05:42 AM | #3 |
I found some damage functions that Shadow1500 made, and got those running. So now its working very smooth. Thanks for reply tho! |
| 09-01-2006, 07:05 AM | #4 |
Actually I now have the issue of trying to get the floating text to spawn overhead of the unit. While some units are quite larger than others, I am trying to calculate the Z offset from the units scaling value. Like 5 x (scalling value) = Z offset, or something like that. But I cant seem to find a way to determine what a units scaling value is inside of JASS. Maybe its not possible or there is a better way? |
| 09-01-2006, 08:33 AM | #6 |
yes but i have very large units with 2.5 scale etc. So basically i am just trying to dynamically set the Z offset of text based on what scale the unit is at. Im going to supplement by just keeping track of a particular units Z offset in their Food Cost value, as I dont use this value for anything any its easy to access. |
