HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simple Trigger Problem

06-23-2008, 06:59 PM#1
Kyrbi0
So I've got a trigger that's supposed to work after an ability has finished (or has been prematurely stopped). It worked, at first, to have 2 events in the same trigger; but now, it doesn't.

Or rather, it still "kinda" works, but it does not kill the target unit, no matter what. So can I actually use 2 events for one trigger, and still have it work properly, as in "whichever happens first"?


Here's the trigger, for reference.

Trigger:
Final Finale xx Remove Effects
Collapse Events
Unit - A unit Finishes casting an ability
Unit - A unit Stops casting an ability
Collapse Conditions
(Ability being cast) Equal to Voodoo Maledict
Collapse Actions
Custom script: local location udg_TempPoint
Unit - Remove Voodoo Shield from (Casting unit)
Collapse Unit Group - Pick every unit in (Units of type 1: Sun-Trap) and do (Actions)
Collapse Loop - Actions
Unit - Kill (Picked unit)
Collapse Unit Group - Pick every unit in (Units of type 2: Mega-Wave) and do (Actions)
Collapse Loop - Actions
Unit - Kill (Picked unit)
Unit - Kill (Target unit of ability being cast)
Set TempPoint = (Position of (Target unit of ability being cast))
Collapse For each (Integer A) from 1 to 5, do (Actions)
Collapse Loop - Actions
Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
Wait 0.05 game-time seconds
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint = null
06-23-2008, 07:25 PM#2
Anitarf
The event response "target unit of ability being cast" does not work with those events as far as I know. Also, the "stops casting" event occurs no matter if the unit finished casting the spell normally or stopped prematurely. There's no need for the "finishes casting" event to be there.
06-23-2008, 07:59 PM#3
Themerion
If you don't need the spell to be MUI, just create a global unit variable and assign (Target Unit) to it on (Event - Starts Effect of Spell) in a separate trigger. If only for 1 unit per player can cast the spell, you can create a global unit array instead.
________________________________________________

Never, NEVER, use waits inside For Loops.

A For Loop uses a global variable for the looping, so things are pretty big this AND something else in your map will screw up badly.
06-23-2008, 08:41 PM#4
Kyrbi0
So is there an event response that works with them?

And if they serve the same purpose, why are there 2? Besides, if he is stopped (with an order) the trigger plays out; but if he finishes (the full ability duration), it doesn't. So it seems that they are different somehow.

EDIT: Oops, didn't see your post, Themerion.
Well, sorry about the Waits; it's actually the same trigger as in the other topic you were helping out in :P.
But it does need to be MUI/MPI; it's my entry for the spell contest.
06-23-2008, 08:47 PM#5
Themerion
Quote:
Originally Posted by Kyrbi0
And if they serve the same purpose, why are there 2?
They do not serve the same purpose.

Quote:
Originally Posted by Anitarf
Also, the "stops casting" event occurs no matter if the unit finished casting the spell normally or stopped prematurely. There's no need for the "finishes casting" event to be there.
  • Stops Casting - Occurs if the unit was interrupted (stunned / ordered to stop / etc) OR it was finished.
  • Finishes Casting - Occurs only if it was finished.
06-23-2008, 08:54 PM#6
Kyrbi0
Well, yes, I know. That's what I'm saying. Hence the rhetorical "why would there be 2 if they are the same" question.

My problem is, neither [Stops] or [Finishes] seem to work when the unit completes the set duration of the spell in question.


EDIT: Well great. I implemented all your coding, Themerion. Now it doesn't work right at all. When the target unit died, the spell ended; my code removed all the sfx and dummy units and everything at that point. Now, however, they aren't removed!... It's like adding new lines of code makes it ignore what happened before (which I know shouldn't happen, since a trigger goes through things linearly). Thoughts?
06-23-2008, 09:03 PM#7
Themerion
Quote:
Originally Posted by Anitarf
The event response "target unit of ability being cast" does not work with those events [Stops casting / Finishes Casting] as far as I know.

Quote:
Originally Posted by me :)
(Event - Starts Effect of Spell)

You need to work with Begins Effect of Spell, otherwise you cannot get the targeted unit.

If your ability leave a buff, you can wait for the buff to disappear, then do your stuff.

This is the sort of stuff which you normally use JASS for. But, hey, did the contest really specify that the spells had to be 100% MUI?


EDIT

Debug your code. Use (Game - Game Message) in order to see if your trigger has somehow cancelled at some point.
06-24-2008, 03:50 AM#8
Kyrbi0
Ok, it seems to be working, ad modicum. Here:

Trigger:
Final Finale xx Remove Effects
Collapse Events
Unit - A unit Stops casting an ability
Unit - A unit Finishes casting an ability
Collapse Conditions
(Ability being cast) Equal to Voodoo Maledict
Collapse Actions
Custom script: local location udg_TempPoint
Unit - Remove Voodoo Shield from (Casting unit)
Game - Display to (All players) for 5.00 seconds the text: 1
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units of type 1: Sun-Trap) and do (Actions)
Collapse Loop - Actions
Unit - Kill (Picked unit)
Game - Display to (All players) for 5.00 seconds the text: 2
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units of type 2: Mega-Wave) and do (Actions)
Collapse Loop - Actions
Unit - Kill (Picked unit)
Game - Display to (All players) for 5.00 seconds the text: 3
Unit - Kill (Target unit of ability being cast)
Game - Display to (All players) for 5.00 seconds the text: 4
Set TempPoint = (Position of (Target unit of ability being cast))
Collapse For each (Integer A) from 1 to 5, do (Actions)
Collapse Loop - Actions
Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
Set SpecialFX = (Last created special effect)
Set TempReal = 0.05
Trigger - Run SFX Destruction <gen> (checking conditions)
Game - Display to (All players) for 5.00 seconds the text: 5
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint = null

Now, when I Stop the caster, it kills the unit, plays the Pillar of Light SFX, and reads [1-2-3-4-5].
However, when it Finishes (as in, the summoned units kill it, thus ending the modified Aerial Shackles), it kills the unit (no sfx) and reads [1-2-3-4-5-1-2-3-4-5]; goes through it twice.
And when it Finishes (the summoned units deal 0 damage, so the duration simply completes), the units is not killed, no sfx play, and it reads [1-2-3-4-5-1-2-3-4-5] (same as above).

Heke?
06-24-2008, 07:20 AM#9
Themerion
Don't use both events. Only use stops casting.
06-24-2008, 01:13 PM#10
Kyrbi0
Ok.

Well, thanks for all the help, you two; I'm going to submit now, so my fingers are crossed.