• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Condition: Unit casts a spell in a certain Region

Status
Not open for further replies.
Level 6
Joined
Jun 4, 2017
Messages
172
This isn't hard. I'll make an example for you:

Event: A unit starts casting a spell;

Conditions: And(multiple conditions):
(Ability being cast) equal to Flamestrike;
((Your region) contains (Casting Unit)) equal to TRUE;

Actions: Kill (Casting unit);


Hope that helps ;)
 
You can get the targeted Location of the cast, and then you might use the boolean check if a Region contains a Location/Point.
You should not use it with too small regions, though. : )

Wow! thank you. That worked.
This is the trigger that i used. Is it leak-free? Will it cause any problems?

  • [/
  • Crap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Crap
    • Actions
      • Set Crap_Point = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 347 <gen> contains Crap_Point) Equal to True
        • Then - Actions
          • Item - Create Tome of Experience at (Center of Region 347 <gen>)
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call RemoveLocation( udg_Crap_Point )
  • TRIGGER]
 
Wow! thank you. That worked.
This is the trigger that i used. Is it leak-free? Will it cause any problems?

  • [/
  • Crap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Crap
    • Actions
      • Set Crap_Point = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 347 <gen> contains Crap_Point) Equal to True
        • Then - Actions
          • Item - Create Tome of Experience at (Center of Region 347 <gen>)
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call RemoveLocation( udg_Crap_Point )
  • TRIGGER]

Oh, and don't forget to remove the line

Trigger - Turn off (This trigger)

Final Result:
  • Crap_Ex
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Crap
    • Actions
      • Set Crap_Point = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 347 <gen> contains Crap_Point) Equal to True
        • Then - Actions
          • Custom script: call RemoveLocation( udg_Crap_Point )
          • Set Crap_Point = (Center of Region 347 <gen)
          • Item - Create Tome of Experience at (Crap_Point)
        • Else - Actions
      • Custom script: call RemoveLocation( udg_Crap_Point )
 
Status
Not open for further replies.
Top