HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How would you detect this?

01-14-2004, 07:00 AM#1
Aznwolf1582
I created a trigger-enhanced spell that involved thunder clap being cast on a target as soon as Storm Bolt hits the target.
So this is my trigger :

function Trig_Storm_Bolt_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'AHtb' ) ) then
return false
endif
return true
endfunction

function Trig_Storm_Bolt_Actions takes nothing returns nothing
call TriggerSleepAction( ( DistanceBetweenPoints(GetUnitLoc(GetSpellAbilityUnit()), GetUnitLoc(GetSpellTargetUnit())) / 1000.00 ) )
call CreateNUnitsAtLoc( 1, 'e000', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetSpellTargetUnit()), bj_UNIT_FACING )
call IssueImmediateOrderBJ( GetLastCreatedUnit(), "thunderclap" )
call RemoveUnit( GetLastCreatedUnit() )
endfunction

//===========================================================================
function InitTrig_Storm_Bolt takes nothing returns nothing
set gg_trg_Storm_Bolt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Storm_Bolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Storm_Bolt, Condition( function Trig_Storm_Bolt_Conditions ) )
call TriggerAddAction( gg_trg_Storm_Bolt, function Trig_Storm_Bolt_Actions )
endfunction

As you can see, I thought that I could best detect when the hammer from Storm Bolt hits the target by waiting an amount of time equal to dividing the distance between the caster and the target by the Missile Speed in Storm Bolt which is 1000. The missile arc is 0.00 if that matters. Upon testing, the results were near perfect, just a millisecond or two off no matter what distance I had cast Storm Bolt from, the Thunder Clap was cast as the hammer landed. Is this the best method of detecting the moment of impact from a missile?

Here is the trigger when not converted into custom text:

Event
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Storm Bolt (test)
Actions
Wait ((Distance between (Position of (Casting unit)) and (Position of (Target unit of ability being cast))) / 1000.00) seconds
Unit - Create 1 Scorching Brightness Carrier for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Order (Last created unit) to thunderclap
Unit - Remove (Last created unit) from the game
01-14-2004, 10:03 AM#2
Hivemind
You might try to detect when the target starts the effect of the buff. Dont remember if there is a new function for that or not.
01-14-2004, 08:33 PM#3
Aznwolf1582
Hmm, that would be a much better solution. I just thought of a flaw to my method: it only works well on stationary targets. I'll keep you updated if I get it working with your suggest Buff detection method...
01-14-2004, 08:41 PM#4
DaKaN
what you can do, is when the storm bolt is casted, do a wait for condition checking every 0 seconds ( blizzard adds thier on constant of the min_wait_value just incase you put 0). And the condition is a boolean, Unit has buff (buffID), then do your actions
01-15-2004, 11:21 AM#5
Hivemind
Yea, thats what we where talking about. Thnx DaKaN. :foot: