• 🏆 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!

Variable won't attach to spawned building

Status
Not open for further replies.
Level 5
Joined
Feb 27, 2009
Messages
115
-A building is placed in a location
.Set Variable to 'Last Created unit'


This doesn't work. Now, this works perfectly when units are spawned.

-Units are placed in a location.
-Set Variable to 'units in region'

Is there a trigger related for buildings? Aren't they considered units as well?

This is what I'm trying to do. I am having units spawn from a building. Simple stuff we have all seen.

-Blah blah conditions
-Units Spawn

The problem is that when the building next to their spawn location is destroyed, I want it to be:

-Oh noes! Building Blew up!
-Units Stop Spawning

The reason why I do not assign a direct building as the variable is because the building changes depending on what race the player is. So there is no initial building at the start of the map. This is why I used the 'unit enters region' or 'last created unit'.

One of the conditions for the units to spawn is that the building exists.

So...

-If Building is alive
-SPAWN SPAWN SPAWN

-If Building is dead
-No spawn for you!

But I have no idea how to get a variable attached to that building (there are more than one so a 'type' wouldn't work. It is location specific.)

Currently, I have this odd situation where, in all cases, spawning ignores the building destruction and, in some cases, units spawn once and stop as if they have decided to ignore the triggers and create their own.

Anyone know a way how to stick a variable to a newly created building so I can 'tag' it in case it blows up?
 
Level 5
Joined
Feb 27, 2009
Messages
115
Post your trigger...

Don't give us a summary of how your triggers went.

You don't need a specific trigger for this question, that is why.

This is a general question, not a specific trigger issue. I'm not going to post forty triggers since that is what it involves.

The general issue (which is in the main title): variable won't attach to spawned building.

The problem isn't a trigger. The problem is that I can't get a variable to attach to specific spawned buildings.

I've tried 'last created unit' after the building is made... doesn't work.
I've tried 'unit enters location' after the building is made... doesn't work.

So what does work?

If you had a building 'spawn', how would you assign a variable to it?
 
Level 5
Joined
Feb 27, 2009
Messages
115
How would you differentiate multiple buildings being made at the same time?

I couldn't find any condition for 'region'. The buildings (say barracks) are exactly the same in three different locations.

I'm trying to create the results of this:

(Human Barracks) is made in Location A.
Attach Variable to Human Barracks in Location A.

(Human Barracks) is made in Location B.
Attach Variable to Human Barracks in Location B.

And so on.

I'm stumped on this. I haven't been able to figure out how to get a unique variable assigned to such a specific building.

There is an alternative way. If it is possible to register that the specific barracks was destroyed in a location, I could create an action to delete the spawn trigger entirely. I haven't tried a "Unit (Human Barracks) is destroyed in Location A" Actions: "Kill Spawn trigger" so I'll give that a go.
 
Level 8
Joined
Nov 9, 2008
Messages
502
It's sounds more like the variable is being overwritten. You would need to use arrays with a moving index in that case.
 
Status
Not open for further replies.
Top