Yess hi guys, so i'm having a serious problem with this one. This is what i'm trying to figure out:
Building A is created (built) and spawns a unit A. Building B spawns unit B, building C spawn unit C etc ect...
Then, if building A is removed (or dies) then unit A is also removed. Same with building B and C etc.
So every building and its spawned units are connected.
I have tried Global data tables, Unit arrays, everything, but i can't seem to link to the corresponding unit when the building i removed... Any ideas? :)
The number 200 is the number of units u will be able to build. THis can be over 8000 x 4 = over 16000 different units of this type (guess you don't really need that many hehe)
Trigger Building created
This gives both the building and the unit the same "number id" by setting the building custom value to different values for each building (and unit). Ignore the first and last action.
Trigger Building death
This was a pain. When you want to remove the building unit you pick "remove unit", link to the unit-array Building unit[] and inside the [] you pick "convert real to integer", because custom values must be real for some reason, so you can't find it if it's set to integer. Then pick "Custom value of unit".
Hope someone understood, could be very useful to know. If anyone figures out a better way to do this, please post :)
Yess hi guys, so i'm having a serious problem with this one. This is what i'm trying to figure out:
Building A is created (built) and spawns a unit A. Building B spawns unit B, building C spawn unit C etc ect... Then, if building A is removed (or dies) then unit A is also removed. Same with building B and C etc. So every building and its spawned units are connected.
I have tried Global data tables, Unit arrays, everything, but i can't seem to link to the corresponding unit when the building i removed... Any ideas? :)
Ok sweet i found a way! These are the steps:
Global variables
Building Number = 0 <Integer>
Building = No unit <Unit[200]>
Building unit = No unit <Unit[200]>
The number 200 is the number of units u will be able to build. THis can be over 8000 x 4 = over 16000 different units of this type (guess you don't really need that many hehe)
Trigger Building created
This gives both the building and the unit the same "number id" by setting the building custom value to different values for each building (and unit). Ignore the first and last action.
Trigger Building death
This was a pain. When you want to remove the building unit you pick "remove unit", link to the unit-array Building unit[] and inside the [] you pick "convert real to integer", because custom values must be real for some reason, so you can't find it if it's set to integer. Then pick "Custom value of unit".
Hope someone understood, could be very useful to know. If anyone figures out a better way to do this, please post :)