• 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.

Limiting the "Teleport" spell

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.
This time, I'm looking for a way to limit the "Teleport" spell (the same of the Guardian hero of the Night Elves).
Is there a way to do that the spell can NOT be used to go to a different terrain level, or through a wall?:vw_wtf:

Regards
 
  • Set Points[1] = (Target point of ability being cast)
  • Set Points[2] = (Position of (Triggering unit))
  • If (All conditions are true) then do (Actions) else do (Actions)
    • If - Conditions
      • (Terrain level at Points[1]) Equal to (Terrain level at Points[2])
    • Then - Actions
      • Unit - Move (Triggering unit) instantly to Points[1]
    • Else - Actions
  • Custom script: call RemoveLocation (udg_Points[1])
  • Custom script: call RemoveLocation (udg_Points[2])
 
Level 9
Joined
Apr 19, 2011
Messages
447
Thanks for answering.
Yeah, I understand how that works... And I would work for me. But I have one question: how do I add this condition to the spell?
And should I suppose that there's no way to avoid going through walls?

P.D.: I always see that "RemoveLocation". Why should we remove it? I don't understand the reason.

Regards
 
It's a script to remove the leak from the creation of the point: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

As for the spell, that trigger contains all the actions for your skill:
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Teleport
  • Actions
    • Set Points[1] = (Target point of ability being cast)
    • Set Points[2] = (Position of (Triggering unit))
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Terrain level at Points[1]) Equal to (Terrain level at Points[2])
      • Then - Actions
        • Unit - Move (Triggering unit) instantly to Points[1]
      • Else - Actions
    • Custom script: call RemoveLocation (udg_Points[1])
    • Custom script: call RemoveLocation (udg_Points[2])
The condition of "terrain level" is an integer comparison, under environment.

And no, it won't work for walls, you will need to check if there are any between your caster and the target point, by checking the angle. Pick every destructible around your caster in a range equal to the distance between the position of the caster and the target point and check if the angle between the (Picked destructible) and the caster is equal to the angle between the position of the caster and the target point. If it is, don't move the unit. I am on a hurry right now, so I can't create the sample trigger.
 
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.

I have been thinking about all of this, and I realize that I only need this restriction for some concrete areas, so...
Will it work if I check if the points are in especific regions? For example, with the problem of limiting the spell trough walls: I put a region in one side of the wall on another in the other side. If the target point is in the other side, the unit won't move... Will that work?
I don't mean that your way is worse, or anything like that... It's just that the way I say is easier for me...
So?

Regards
 
Status
Not open for further replies.
Top