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!
Hi guys, i want to know can i prevent teleporting units on unfinished buildings with item called Staff of Teleportation??? It is some warcraft leak....
I don't know if it can be done more efficiently than what I am about to post...
... if not, you could use a hashtable and save a boolean value in it. For example like this:
1) Creates and saves hashtable which you are going to use for this purpose
Map Ini
Events
Map initialization
Conditions
Actions
Hashtable - Create a hashtable
Set Check_Hash = (Last created hashtable)
2) Two triggers, which change the boolean value of each structure.
Construction Start
Events
Unit - A unit Begins construction
Conditions
Actions
Hashtable - Save True as (Key Constructing) of (Key (Constructing structure)) in Check_Hash
In this trigger, whenever a unit starts constructing a building, it saves value "True" for this building.
Construction End
Events
Unit - A unit Finishes construction
Conditions
Actions
Hashtable - Save False as (Key Constructing) of (Key (Constructed structure)) in Check_Hash
This changes the bool value to "False" when the structure has been finished.
3) Now when you want to use a spell like the one you wrote about, you check the boolean value:
Random spell
Events
Conditions
(Load (Key Constructing) of (Key (Target unit of ability being cast)) from Check_Hash) Equal to True
Actions
-------- since the value of targeted unit is "True" (= is being constructed), stop trigger unit --------
Unit - Order (Triggering unit) to Stop
Boolean value is set to "False" by default, so even though this trigger does not check whether the target is a structure or not, the bool value of the target will be "false" if it's a normal (non-structure) unit or finished structure.
**I'm unsure if it is needed, but if it is, here is a trigger which clears child hashtables of destroyed structures:
Structure desroyed
Events
Unit - A unit Dies
Conditions
((Triggering unit) is A structure) Equal to True
Actions
Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Check_Hash
I'm pretty sure the only way you might be able to catch if the unit i tries to TP to a unfinished structure is if you lookup the Order ID of Staff of Teleport and check when the unit tries to use it, but in order to know if the building is finished you'd probably need to index all buildings and add them to a group when they are completed.
I'm not entirely sure, but I think you should look up the Town Portal Scroll ability because I feel like it probably doesn't work on unfinished town halls. You would have to add the tag of Town Hall to the unit for it to work though.
Edit: Solution! Item Town Portal ability cannot target unfinished structures, and it looks like it has the same fields as Staff of Tele
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.