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

Region hero teleport

Status
Not open for further replies.
Level 1
Joined
Jun 5, 2008
Messages
151
Hey, I have a problem with simple trigger, when I want to teleport my hero using regions, the point is that it will teleport ONLY when I enter region from bottom or from the left to the right If i enter it from top or to the left side <---- It just wont work...I dont understand it at all, btw other one is working fine and another isnt, I dont get it.

  • Teleport1
    • Events
      • Unit - A unit enters Teleport 1-1 <gen>
    • Conditions
      • (Hero level of (Triggering unit)) is higher or equal to 10
    • Actions
      • Unit - Move (Triggering unit) instantly to (Center of Teleport 1-2 <gen>)
 
Level 1
Joined
Jun 5, 2008
Messages
151
It should work no matter where you enter the region from.
Might want to upload the map?

This is really weird, because when I make new map and create regions etc its workig fine...I guess its because of region location or something, I will have to try it other way.
 
Level 1
Joined
Jun 5, 2008
Messages
151
Well, if there's a wall on the top and left side, it won't work :)
(Just kidding, I really have no idea what it would stop working - as I said before: might want to upload the map here so I can test a few things?)

I will send you map on private.

@EDIT:

after I made region bigger it worked, but only for single region, other region is still not working even though I made it bigger too, but I should manage it now, if not then I will send you map. thanks


@@EDIT:

SOLVED thanks to ap0calypse there was a second trigger with wrong condition

  • (Teleport1 <gen> contains (Triggering unit)) is equal to YES
Its because of this condition that it didnt work, unless I add wait before it or something but nevermind that, it helped me so +REP for you


Another thing is about leaks I read about it but I am not sure what should I put after my action, could it be this:

  • Custom script: call RemoveLocation(udg_loc)
 
Last edited:
Level 8
Joined
Oct 26, 2008
Messages
387
Another thing is about leaks I read about it but I am not sure what should I put after my action, could it be this:

  • Custom script: call RemoveLocation(udg_loc)

First you need to set a variable. From the trigger you posted above the leaking location is the "center of teleport 1-1" if i remember right. You will need to define a "Point" Variable, then set that point, in the variable and then,

  • Custom script: call RemoveLocation(udg_YOURVARIABLENAME)
after the (udg_ comes the name of the variable, example

  • Set MyLocation = Position of (Triggering Unit)
  • Custom script: call RemoveLocation(udg_MyLocation)
Hope it helps :)
 
Level 1
Joined
Jun 5, 2008
Messages
151
First you need to set a variable. From the trigger you posted above the leaking location is the "center of teleport 1-1" if i remember right. You will need to define a "Point" Variable, then set that point, in the variable and then,

  • Custom script: call RemoveLocation(udg_YOURVARIABLENAME)
after the (udg_ comes the name of the variable, example

  • Set MyLocation = Position of (Triggering Unit)
  • Custom script: call RemoveLocation(udg_MyLocation)
Hope it helps :)

So tell me if I did good:

I have created a Variable point called "Teleport"

  • Teleport1
    • Events
      • Unit - A unit enters Teleport1 <gen>
    • Conditions
      • (Hero level of (Triggering unit)) is higher or equal to 10
    • Actions
      • Set Teleport = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to (Center of Teleport2 <gen>)
      • Custom script: call RemoveLocation(udg_Teleport)
  • Teleport2
    • Events
      • Unit - A unit enters Teleport3 <gen>
    • Conditions
      • ((Triggering unit) is Hero) is equal to YES
    • Actions
      • Set Teleport = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to (Center of Teleport4 <gen>)
      • Custom script: call RemoveLocation(udg_Teleport)
How is it? Can I use single variable for more than 1 trigger? What if 2 units/heros enter same region or different regions which use same variable, will it work? wont there be any error or anything?
 
Level 8
Joined
Oct 26, 2008
Messages
387
  • Teleport1
    • Events
      • Unit - A unit enters Teleport1 <gen>
    • Conditions
      • (Hero level of (Triggering unit)) is higher or equal to 10
    • Actions
      • Set Teleport = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to (Center of Teleport2 <gen>)
      • Custom script: call RemoveLocation(udg_Teleport)
  • Teleport2
    • Events
      • Unit - A unit enters Teleport3 <gen>
    • Conditions
      • ((Triggering unit) is Hero) is equal to YES
    • Actions
      • Set Teleport = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to (Center of Teleport4 <gen>)
      • Custom script: call RemoveLocation(udg_Teleport)

Array the variable, to the number of teleport regions you have. Set them perpsective in map Initialization.

  • Teleport1
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set Teleport[1] = (Center of Teleport2)
      • Set Teleport[2] = (Center of Teleport4)
      • // etc etc
And then,

  • Teleport1
    • Events
      • Unit - A unit enters Teleport1 <gen>
    • Conditions
      • (Hero level of (Triggering unit)) is higher or equal to 10
    • Actions
      • Unit - Move (Triggering unit) instantly to (Teleport[1])
      • Custom script: call RemoveLocation(udg_Teleport[1])
  • Teleport2
    • Events
      • Unit - A unit enters Teleport3 <gen>
    • Conditions
      • ((Triggering unit) is Hero) is equal to YES
    • Actions
      • Unit - Move (Triggering unit) instantly to (Teleport[2])
      • Custom script: call RemoveLocation(udg_Teleport[2])
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
So tell me if I did good:

I have created a Variable point called "Teleport"

  • Teleport1
    • Events
      • Unit - A unit enters Teleport1 <gen>
    • Conditions
      • (Hero level of (Triggering unit)) is higher or equal to 10
    • Actions
      • Set Teleport = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to (Center of Teleport2 <gen>)
      • Custom script: call RemoveLocation(udg_Teleport)
  • Teleport2
    • Events
      • Unit - A unit enters Teleport3 <gen>
    • Conditions
      • ((Triggering unit) is Hero) is equal to YES
    • Actions
      • Set Teleport = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to (Center of Teleport4 <gen>)
      • Custom script: call RemoveLocation(udg_Teleport)
How is it? Can I use single variable for more than 1 trigger? What if 2 units/heros enter same region or different regions which use same variable, will it work? wont there be any error or anything?
You need to use the variable in the unit-action, otherwise the leak will still exist.

You can use every variable in all your triggers. It won't bug.
Variables that you create and 'destroy' (note that the value is destroyed, not the actual variable) in a single trigger are often used for all triggers in the entire map.
For example: you create 1 variable called "tempLoc" (as it is a temporary location), you can use that variable in all triggers to remove the leaks - as long as you do not use any waits between setting the variable and destroying it.


@StaRMaestroS: That is a good solution if you have a static location that will be used a lot, although I recommend not using an arrays for this, but different variables (such as tempLoc1, tempLoc2, ...).
Arrays always have 8192 values (no matter what you set the array size to), so that's a bit of an overkill for just 2 locations.
 
Level 1
Joined
Jun 5, 2008
Messages
151
thanks for help +REP

@UP

There will be more than just 2 locations, more like 50? still not enough to use arrays? Then instead I should create 50 variables?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
thanks for help +REP

@UP

There will be more than just 2 locations, more like 50? still not enough to use arrays? Then instead I should create 50 variables?
If you use 50 locations, better just use 1 variable and set/remove it in each trigger (the way StaRMaestroS showed in his first post).

Unless a location is going to be used a lot, creating a static variable for it doesn't have that many advantages.
 
Level 8
Joined
Oct 26, 2008
Messages
387
You need to use the variable in the unit-action, otherwise the leak will still exist.

You can use every variable in all your triggers. It won't bug.
Variables that you create and 'destroy' (note that the value is destroyed, not the actual variable) in a single trigger are often used for all triggers in the entire map.
For example: you create 1 variable called "tempLoc" (as it is a temporary location), you can use that variable in all triggers to remove the leaks - as long as you do not use any waits between setting the variable and destroying it.


@StaRMaestroS: That is a good solution if you have a static location that will be used a lot, although I recommend not using an arrays for this, but different variables (such as tempLoc1, tempLoc2, ...).
Arrays always have 8192 values (no matter what you set the array size to), so that's a bit of an overkill for just 2 locations.

You are right, didnt think that the removelocation funtcion destroyes its value so it doesnt really matter if you use it again in other triggers. :D
 
Level 1
Joined
Jun 5, 2008
Messages
151
If you use 50 locations, better just use 1 variable and set/remove it in each trigger (the way StaRMaestroS showed in his first post).

Unless a location is going to be used a lot, creating a static variable for it doesn't have that many advantages.

What do you mean used alot? Like dungeons in rpg maps which use teleport which will be most likely used lots of times or do you mean using teleport to send units like AoS which would teleport them all the time?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
What do you mean used alot? Like dungeons in rpg maps which use teleport which will be most likely used lots of times or do you mean using teleport to send units like AoS which would teleport them all the time?
Like spawn locations, where every X seconds a group of units spawn at the exact same location - things like that can use static locations (if units spawn at random locations, don't bother with those).
Things like TD's, or AoS's as well (the unit spawns of those). In TD Wars (where you buy creeps to attack the enemy maze), it is advised to use that (your team can easily buy thousands of units in a single game, which all spawn at the same location).

Dungeons in RPG maps don't need that. How many times will you enter a dungeon? Even if you grind it and do it like 50 times in a single game, that's still only 50 times (which isn't a lot).
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
How is it? Can I use single variable for more than 1 trigger? What if 2 units/heros enter same region or different regions which use same variable, will it work? wont there be any error or anything?
You can. However, if you use the same variable in more than one trigger at once, then it will fail. In your case, it is impossible that two units can enter both regions, there will be at least 0.01 sec delay. The player can order the two units at the same time, but... the units will be within different range from the regions, thus they don't enter at the same time.
If units are created in the regions trough triggers - then i don't know, it must not cause an error.

Overall, if you move/create units trough triggers, then the thing might fail. But it shouldn't because, you still move the first unit, then the second, you can't move two units at the same time (in one action). It should work fine. :)
For example, in my map, i have a variable, called "Location" and i use it in instant triggers so that i don't have to spam location variables. It works perfectly.
 
Level 1
Joined
Jun 5, 2008
Messages
151
so in my case, I should create 1 Variable with index or without index? like Teleport[1] and Teleport[2] or just Teleport? I plan to make some kind of dungeon system which will be like 1 or more players stand on idk circles of power, and first player choose difficulty then it send units to the dungeon and set monsters for difficulty he choose.
 
Level 1
Joined
Jun 5, 2008
Messages
151
"Teleport" it should be.

ok thanks :> I was confused because one say I should use index and other say I should not use ^^


@EDIT:

Just to make sure -.- I have few triggers with teleports, I use Set Teleport=center of (region name) for every trigger? because now I cant create a trigger with "Teleport[1]" Teleport[2] etc...lol
 
Last edited:
Status
Not open for further replies.
Top