• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Immediate Stop Casting Order

Status
Not open for further replies.
Level 9
Joined
Jun 13, 2008
Messages
350
Hi guys...I made a spell which works only if there are any enemies in front of the hero, but if there are not, it gives error message, I've done that but making the hero to not to cast that spell is kinda tough for me...because I tried every way and it always consume mana and cast it...with giving the error message again...here's the triggers.

  • Frost Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frost Strike
    • Actions
      • Set FSCaster = (Triggering unit)
      • Set FSDummy_Point = (Position of FSCaster)
      • Set FStrike_Point = ((Position of FSCaster) offset by 100.00 towards (Facing of FSCaster) degrees)
      • Set FS_Group = (Units within 100.00 of FStrike_Point)
      • Set ErrorMessage = There are no enemy to strike!
      • Set ErrorPlayer = (Owner of FSCaster)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FS_Group) Greater than 0
        • Then - Actions
          • Unit - Create 1 Dummy for (Owner of FSCaster) at FSDummy_Point facing (Facing of FSCaster) degrees
          • Set FS_Dummy = (Last created unit)
          • Unit - Add Obliterate Dummy to FS_Dummy
          • Unit - Set level of Obliterate Dummy for FS_Dummy to (Level of Frost Strike for FSCaster)
          • Unit - Add a 1.00 second Generic expiration timer to FS_Dummy
          • Unit - Order FS_Dummy to Neutral - Breath Of Frost FStrike_Point
          • Unit Group - Pick every unit in FS_Group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an enemy of (Owner of FSCaster)) Equal to True
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Set FS_Target = (Picked unit)
                  • Unit - Cause FSCaster to damage FS_Target, dealing ((20.00 + (10.00 x (Real((Level of Frost Strike for FSCaster))))) + ((Real((Level of Frost Strike for FSCaster))) x (Real((Strength of FSCaster (Include bonuses)))))) damage of attack type Spells and damage type Cold
                • Else - Actions
        • Else - Actions
          • Custom script: call ErrorMessage(udg_ErrorMessage,udg_ErrorPlayer)
          • Unit - Pause FSCaster
          • Unit - Order FSCaster to Stop
          • Unit - Unpause FSCaster
      • Custom script: call RemoveLocation(udg_FStrike_Point)
      • Custom script: call DestroyGroup(udg_FS_Group)
how am I gonna get through this?...helps are appreciated.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
better may be by checking order imo.

If frost strike's is based off e.g. Fire Bolt, then its order will be firebolt. Let's say you cannot cast this on living units - but only on undead ones (similarly to Holy Light's damage).
Then you check
Code:
Events
    unit is issued an order targeting an object
Conditions
    unit-type of triggering unit == your custom unit
    issued order == firebolt
    target unit of issued order is an undead == false
Actions
    Unit - order triggering unit to stop
    Game - write error message saying only undead can be targeted

The difference between checking when order is issued and "begins casting an ability" event is that begins casting an ability starts once unit gets close enough to cast the ability, while issued order is when unit is ordered to do something (so it fires even before the unit gets in range).
tl;dr: for begins casting an ability event the unit will have to get close to the target and only after that the check is carried out and the ability is possibly interrupted while order check does that immediately.
 
Level 9
Joined
Jun 13, 2008
Messages
350
no its based on channel with no target but thanks i did it...now am thinking if its possible to make it hit just one unit instead of units in 100 aoe ahead of the hero...i guess i should use random N units in unit group but there is no guarantee for it to hit the unit i want to i guess
 
Status
Not open for further replies.
Top