HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Showing text for invalid spell casts

11-27-2006, 02:34 AM#1
Pyrogasm
For a spell that can only be cast on ethereal units, I use this trigger to display text if the player tries to cast it on a non-ethereal unit:
Trigger:
Friendly Cast
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Defabricate
((Target unit of ability being cast) belongs to an ally of (Owner of (Triggering unit))) Equal to True
Collapse Actions
Set TempPoint[1] = (Position of (Triggering unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Target unit of ability being cast) is Ethereal) Equal to True
Collapse Then - Actions
Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempPoint[1] facing Default building facing degrees
Unit - Add Defabricate (Ally) to (Last created unit)
Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Target unit of ability being cast)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Collapse Else - Actions
Unit - Order (Triggering unit) to Stop
Game - Display to (Player group((Owner of (Triggering unit)))) for 3.00 seconds the text: |cffffcc00Must be cast on ethereal units.|r
Custom script: call RemoveLocation( udg_TempPoint[1] )
The problem is that it displays the "Must be cast on ethereal units" message twice. I've remade the trigger from scratch over and over again, but it always shows the message two times! There's another trigger that is for enemy casts, so I copied over the "Else" conditions from that trigger (which correctly displays the message only once)...and it still did it twice! I can upload the map if that would help...

On a side note, is there a way to play a sound for only a specific player/player group? I would like to add the "error.wav" sound to this trigger if that's possible.
11-27-2006, 10:52 AM#2
shadowange1
I think it has something to do with the stop order. So maybe try to pause the unit, then stop it, then unpause it again(in the else part)
ex
Pause unit
stop unit
unpause unit

if this doesnt work maybe add debugs
11-27-2006, 03:52 PM#3
The_AwaKening
I'm thinking that maybe ordering the unit to stop is too late. Try changing your event to Begins Casting instead of Starts the effect. It should stop it in time.
11-28-2006, 01:11 AM#4
Pyrogasm
It would seem that, yes, the unit is not getting stopped soon enough, but the thing that baffled me is that I have another trigger with the line "Ally of (Owner of (Triggering Unit))" changed to "Enemy of (Owner of (Triggering Unit))" and different "Then" actions, but the text only displays once!

I tried what both of you have suggested, and neither of them worked. I switched the "Then" and "Else" categories and changed my "If" condition, and the message only displayed once. I added a text message for all players that would show every time the trigger was run, and it only showed that the enemy trigger was running when it defied its conditions. Anyway, I fixed the ability by totally redoing it into an AoE spell, so I don't even need the error message any more.