In your post it looks like you will have more then one item/region I would recommend to have a look in arrays Array Tutorial
I made something up for you that should give you some help...
ShopTeleport Init
Events
Map initialization
Conditions
Actions
-------- Shadowing the Integer will make the variable local but you can acces it like a normal global GUI variable --------
-------- This has to be done as the first action in your trigger --------
Custom script: local integer udg_tempInt
-------- One Segment will be look like this --------
-------- 1. Increase the maximum amount by one --------
-------- 2. Set your Item type that should bring you to the special location --------
-------- 3. set the region of your location and add it to the list --------
-------- You can swap 2 and 3 but I would suggest to keep it constant for every new entry and of course use good descriptive names --------
Set ShopTeleport_MaxCount = (ShopTeleport_MaxCount + 1)
Set ShopTeleport_ItemTypes[ShopTeleport_MaxCount] = ItemA
Set ShopTeleport_Regions[ShopTeleport_MaxCount] = RegionA <gen>
Set ShopTeleport_MaxCount = (ShopTeleport_MaxCount + 1)
Set ShopTeleport_ItemTypes[ShopTeleport_MaxCount] = ItemB
Set ShopTeleport_Regions[ShopTeleport_MaxCount] = RegionB <gen>
Set ShopTeleport_MaxCount = (ShopTeleport_MaxCount + 1)
Set ShopTeleport_ItemTypes[ShopTeleport_MaxCount] = ItemC
Set ShopTeleport_Regions[ShopTeleport_MaxCount] = RegionC <gen>
Set ShopTeleport_MaxCount = (ShopTeleport_MaxCount + 1)
Set ShopTeleport_ItemTypes[ShopTeleport_MaxCount] = ItemD
Set ShopTeleport_Regions[ShopTeleport_MaxCount] = RegionD <gen>
-------- I like to automatically fill in the points for each region due to leaking --------
For each (Integer tempInt) from 1 to ShopTeleport_MaxCount, do (Actions)
Loop - Actions
Set ShopTeleport_Points[tempInt] = (Center of ShopTeleport_Regions[tempInt])
ShopTeleport Action
Events
Unit - A unit Acquires an item
Conditions
Actions
-------- I think shadowing is not really needed by the speed of the trigger actions but I just want to be safe --------
Custom script: local integer udg_tempInt
-------- We looping through the items-array that will teleport the hero --------
For each (Integer tempInt) from 1 to ShopTeleport_MaxCount, do (Actions)
Loop - Actions
-------- because we shadowing the tempInt variable and every if in GUI is a new function we just make our own via custom code --------
Custom script: if ( GetItemTypeId(GetManipulatedItem()) == udg_ShopTeleport_ItemTypes[udg_tempInt] ) then
-------- If we found a match the unit will be teleported --------
Unit - Move (Triggering unit) instantly to ShopTeleport_Points[tempInt]
-------- and the item will be removed from the game --------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.