HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to detect when holy light has successfully been cast

11-19-2002, 04:40 PM#1
sorren
I've figured out how to detect when a hero is given the order to cast holy light, aka holybolt, but this is not satisfactory, because it only checks when the order was given, not if the hero actually cast the spell successfully. For example, lets say for my purposes that you can see the entire map, now someone on your team is hurt on the other side of the map, you cast holy light and target him on the other side of the map, now the trigger will fire because you already targeted an object, but you haven't actually completed the spell, and if you abort it by moving away, dying, doing something else, that trigger still fired. So, my question is, how can I tell if holy light has successfully been cast upon a target? For my map, I have thought of other ways, but if anyone knows the way to tell if holy light has been successfully cast, it would answer my question! Thanks!
11-19-2002, 05:09 PM#2
Kerry
Maybe put a wait action for the time that is needed to complete the spell.
11-19-2002, 05:31 PM#3
Guest
hmm... well.. you could keep track of the HP of all the units on the map every .5 seconds, then if, .5 seconds later it's HP goes up assume it had holy light casted on it.. course.. this isn't the best way to do it.. and might not even work since events and variables don't mix. But.. the only other way I could think of revovles around the idea that holylight is a buff.. but.. I dunno...
11-19-2002, 08:11 PM#4
Zedric
When the order is cast, store the target of the order in a variable.

Then run a periodic trigger that detects the spell's effects on the target (in the case of Holy Light - the unit is healed).

Maybe?
11-20-2002, 04:09 AM#5
Phil_123
msg remov'd to save bandwidth
11-20-2002, 04:18 AM#6
Insaniteus
Damn you Zedric. I was about to suggest that!

Oh well, forget the modified priest ability, Zedric's Idea is perfect.

-Insaniteus-
11-20-2002, 04:32 AM#7
Guest
Here's a thought. The range of holy light defaults to 800.

We'll need a boolean:

IsInterrupted

Set it initially to FALSE.

**************************

Event: unit is given an order targeting an object
Condition: order is "holy light" (or whatever it is)

Now for Actions we'll have some custom text:

function HolyLightIsCastActions takes nothing returns nothing

set udg_IsInterrupted = FALSE

loop
exitwhen udg_IsInterrupted == TRUE
exitwhen IsUnitInRange(GetOrderedUnit(),GetOrderTargetUnit(),800.0) == TRUE
call TriggerSleepAction(1.0)
endloop

if (udg_IsInterrupted == TRUE) then
return
endif

// insert what to do when cast code here

endfunction

We'll need this trigger too:

Event: unit is given an order targeting an object
Event: unit is given an order targeting a point
Event: unit is given an order with no target
Action: IsInterrupted = TRUE

**************************

What's it do? When you cast it it loops until you're in range or until you issue ANY other order. When you're finally in range and you haven't issued any other orders it stops and executes your code.

Note that at that point it'll probably have already cast the spell.

Hope this helps.