- Joined
- Jul 15, 2014
- Messages
- 39
So we have a unit and its house. How do we link them together so that next 2 actions are possible.
1. Unit can check if he has house (ability for example) which will select his house for player1 or tell that he has no house (if it was destroyed).
2. If you see a house u can find which unit is its owner (by casting special checking ability for example).
What kind of link that could be? I tried that way: to set same custom value to both unit and his house.
So that if i know the units custom value, i need to check custom value of all existing houses and i can find the one equal. And if i know house's custom value i need to loop through all the units on the map.
The problem with my method is that this looping seems very expensive. And them units gona be able to check on each other pretty often.
1. Unit can check if he has house (ability for example) which will select his house for player1 or tell that he has no house (if it was destroyed).
2. If you see a house u can find which unit is its owner (by casting special checking ability for example).
What kind of link that could be? I tried that way: to set same custom value to both unit and his house.
So that if i know the units custom value, i need to check custom value of all existing houses and i can find the one equal. And if i know house's custom value i need to loop through all the units on the map.
The problem with my method is that this looping seems very expensive. And them units gona be able to check on each other pretty often.