HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Quick trigger question

04-23-2004, 07:48 AM#1
PhaT
Heyas, just curious about something..
I have a trigger that when my hero cast a spell, he will achieve critical strike and after 30 seconds critical strike will be removed.. my question is if it was multiplayer and 2 people cast that spell, will it remove both? like what i mean is if i cast it and 5 seconds later someone else casts it, will it only remove the other person's critical strike since it cast his last? or will it remove both.

And if it will only remove one, how will i make it so that it will remove both? thanks in advance!!
04-23-2004, 09:16 AM#2
Anitarf
This is a very interesting question; what you probably have is a trigger that does the following actions:

add ability (critical strike) to casting unit
wait 30 seconds
remove ability (critical strike) from casting unit

Now, wait commands are very problematic, because they put the trigger on hold and now, other triggers may run while this trigger is still in progress. This will most likely reset the "casting unit", so, after 30 seconds, you won't be removing the ability from the right unit.

There is a way around this; after 30 seconds, you can remove the ability from all units that have it, however, this is not exactly what you want, because some heroes, that casted the spell later than the first hero, are supposed to still have their abilities untill their 30 seconds run out.

The solution is a buff: you have your trigger give a buff to your hero that lasts 30 seconds (or a little less), and then, after 30 seconds, you only remove the ability from those heroes that don't have the buff; that way, those heroes that cast the spell later, still have the buff and the trigger won't remove their ability... it will be removed when their 30 seconds run out.

Now this is how such a trigger would look like:
Code:
Critical strike addon
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to The_Ability_That_Gives_You_CriticalStrike
    Actions
        Unit - Create 1 Flying_Dummy_Unit_With_No_Model for Neutral Passive at (Position of (Casting unit)) facing Default building facing degrees
        Unit - Add A_Spell_that_Does_Nothing_And_Lasts_29_Seconds_Based_on_Cripple to (Last created unit)
        Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Undead Necromancer - Cripple (Casting unit)
        Unit - Add Critical Strike (Neutral Hostile) to (Casting unit)
        Wait 30.00 game-time seconds
        Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Name_of_your_Hero) and (((Matching unit) has buff The_Buff_That_Your_29_Second_Spell_Uses) Equal to False))) and do (Actions)
            Loop - Actions
                Unit - Remove Critical Strike (Neutral Hostile) from (Picked unit)
04-23-2004, 10:09 AM#3
PhaT
man sweet thanks so much! your a life saver :)
04-25-2004, 11:01 PM#4
PhaT
Hmmm, i been testing both abilities and they worked the same..having no problems with it.. im just wondering.. will the problems with the wait commands happen randomly and sometimes screw up and sometimes work.. or will it not happen at all?
04-25-2004, 11:07 PM#5
ThyFlame
Now that I read the trigger... that wont work.

Every occurence of that spell will be removed at the same time; only one will last the 30 seconds, the rest will be removed with the first occurence.
04-26-2004, 02:18 AM#6
PhaT
hm, problem is, i tested both, with buffs and without buffs... and they both work fine..

is it only supposed to screw up sometimes or something?