• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Deny Spell Casting

Status
Not open for further replies.
Level 12
Joined
Nov 20, 2007
Messages
660
Hello guys, I'm making a arena like map and I need some help.
The problem is that I want heroes to be able to cast spells only across the arena. So when they cast a spell out of arena (let's say blink) I want to intrerupt them and show a message to the player ("Invalid Zone" or something :ogre_haosis:)

117257d1345989366-deny-spell-casting-arena.jpg


That's what I tried and it works good enough
  • Cast DeadZones
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Level of Dummy (Misc) for (Triggering unit)) Equal to 0
    • Actions
      • Set Game_LeakPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy (0) for Neutral Hostile at Game_LeakPoint facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Arena Region <gen> contains (Last created unit)) Not equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
But it bugs when you cast non-target spells (casting non-target spells creates my dummy in middle of arena :vw_sad:)

Can anyone help ?
 

Attachments

  • Arena.jpg
    Arena.jpg
    13.6 KB · Views: 218
Level 12
Joined
Nov 20, 2007
Messages
660
  • Set Game_LeakPoint = (Position of triggering unit)
Then check again.

ALTERNATIVELY:
Catch the spell when the unit is ordered to cast it - you'll have to separate this into 3 phases - one for no target, one for unit target, and one for point target.

1.Tested -> Not working at all.
2.I have too many spells and checking if casting spell is non-target / non-point it's not a good option because it will dramatically increase fps.

Any other suggestions ?
 
Instead of creating a dummy, there's a condition like this:
  • (ArenaRegion contains Game_LeakPoint) Equal to False
Also, ruleofiron99 is correct. (No target shouldn't be checked though, as it should always work).
Edit: So just creating an Or - Condition with all point-target spells won't do? I think it wouldn't increase FPS at all.
 
Hmh, I just thought of something else.

  • Stop Casting
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
    • Actions
      • Set tempLoc1 = (Target point of ability being cast)
      • Set tempLoc2 = (Center of (Entire Map))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 000 <gen> contains tempLoc1) Equal to False
          • (X of tempLoc1) Not equal to (X of tempLoc2)
          • (Y of tempLoc1) Not equal to (Y of tempLoc2)
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
      • Custom script: call RemoveLocation( udg_tempLoc1 )
      • Custom script: call RemoveLocation( udg_tempLoc2 )
If the order is an order with no target, then "Target point of ability being cast" would be the same as "Center of (Playable Map Area)".
Thus, if tempLoc1 == tempLoc2, then the spell should always work (as it doesn't have a target and therefore cannot be cast outside the area).
But if they are not the same, that means the spell has a target (whether that is a unit or point doesn't matter). If that point is outside the area, stop the caster.

Tested it for all 3 types, it should work.
 
Last edited:
What if you cast an unwanted spell (point) in Center of Playable area ?
System won't stop it
That never happens. No matter how hard you may try.
The coordinates should be exactly 0.000. Even if you have 0.001 as 1 of the coordinates it will cancel the order (and trust me, to aim that well with even 1 coordinate is something I have yet to see - to do it with both is outright impossible).
If you want to prove me wrong, then go ahead. I would actually love that :p

Edit: I actually tested it. Since I couldn't get it right, I tried to do it with cheats.
As said before, unless you're more accurate than "0.001", the spell will get canceled (0.0009 and less will allow the spell to be cast).

I also noticed it should be "Center of (Entire Map)". Changed that in the original post as well.
 
Status
Not open for further replies.
Top