• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Target unit of ability being cast ignores conditions if target is selected on minimap

Status
Not open for further replies.
Level 2
Joined
Nov 15, 2010
Messages
16
Hi

How can prevent an archmage teleporting into a certain areas of the map if a teleport target is selected via the minimap?

I just want the teleport ability stopped as soon as archmage starts casting it if the target unit of teleport is in the specific map area.

This works perfectly fine when I target the unit in that region via the game screen as normal, by actually targeting a unit. Teleport stops, wasting cooldown, and archmage is not teleported.
This is exactly what I want.

However when I target that unit via the minimap, archmage teleports to that unit just fine, unhindered.

How can I prevent archmage to teleport to that unit if the unit is targeted via the minimap?

  • PreventTeleport
    • Events
      • Unit - Archmage 1122 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Mass Teleport
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PreventTeleportHere <gen> contains (Target unit of ability being cast)) Equal to True
        • Then - Actions
          • Unit - Order (Casting unit) to Stop
        • Else - Actions
          • Do nothing
 
Last edited:
Level 9
Joined
Sep 20, 2015
Messages
385
I can suggest to change the variable.

Create another Unit variable for istance "AmTpTarget", if every player has one archmage you have to make it an array type variable AmTpTrarget[].

In the trigger as first action use

- Set AmTpTarget Equal to Target unit of ability being cast

If multiple players have an archmage unit .

- Set AmTpTarget [ PlayerNumber(owner of Casting Unit) ] Equal to Target unit of ability being cast

Then in conditions.

-(PreventTeleportHere <gen> contains AmTpTarget ) Equal to True

See if this works.

Another thing may be maybe to check the actual position X and Y of the position of the unit, and if it is in the no teleport region order to stop. I don't remember if there is a condition like that in GUI but in JASS should be possible.
 
Level 2
Joined
Nov 15, 2010
Messages
16
Nope, it didin't work :(
It works when I select a teleport target as normal via in game screen, by actually targeting on a unit model with teleport.
But if I select that teleport target via minimap, archmage teleports to the unit unimpeded.

  • PreventTeleport
    • Events
      • Unit - Archmage 1122 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Mass Teleport
    • Actions
      • Set AmTpTarget = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PreventTeleportHere <gen> contains AmTpTarget) Equal to True
        • Then - Actions
          • Unit - Order (Casting unit) to Stop
        • Else - Actions
          • Do nothing
I guess that's a bug with the 'Target unit of ability being cast' itself, i.e. editor does not treat targets selected via the minimap as it does if a user targets the unit via in game screen, by clicking on the actual unit model. Is there a JASS workaround for this?
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
I think you have to check the unit position. The teleport ability works on a point, then it pick a building or a unit closest to that point and teleport the caster there.

So you can tryo to check the point target of ability beign cast instead of the unit

it seems that is what blizzard did when you target the minimap, bc otherwise you would have to be really precise to actually select the unit with the minimap. this works:

  • you shall not pass
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Mass Teleport
    • Actions
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Set TempPoint2 = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Region 000 <gen> contains TempPoint) Equal to True
              • (Region 000 <gen> contains TempPoint2) Equal to True
        • Then - Actions
          • Unit - Pause (Triggering unit)
          • Unit - Order (Triggering unit) to Stop
          • Unit - Unpause (Triggering unit)
        • Else - Actions
obviously remove both points at the end. also - this does not use mana and cooldiwn like you wanted, so you will have to add that to the trigger.
 
Level 2
Joined
Nov 15, 2010
Messages
16
Thank you so much, that worked!

  • PreventTeleport
    • Events
      • Unit - Archmage 1122 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Mass Teleport
    • Actions
      • Set AmTpTarget = (Position of (Target unit of ability being cast))
      • Set AmTpTarget2 = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (PreventTeleportHere <gen> contains AmTpTarget) Equal to True
              • (PreventTeleportHere <gen> contains AmTpTarget2) Equal to True
        • Then - Actions
          • Unit - Order (Casting unit) to Stop
          • Custom script: call RemoveLocation (udg_AmTpTarget)
          • Custom script: call RemoveLocation (udg_AmTpTarget2)
        • Else - Actions
          • Do nothing
 
Status
Not open for further replies.
Top