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

Gold per unit alive trigger

Status
Not open for further replies.
Level 3
Joined
Oct 9, 2011
Messages
45
Hey hivers,

I'm currently working on a RPG map that I started about 7 years ago and its coming close to being finished, but I'm having problems with getting variables/arrays to work.

I dont know if posting the respective trigger is gonna work, because mine are part german, so I am going to try and translate them. Heres the situation:




Theres a town with 50 citizens in it. I want the ruler to get 10 gold per living citizen every X seconds. If a citizen dies, I want his periodic taxes to become unavailable to the ruler.

I tried doing it with an array (size 49) named "CitizensAlive". Everytime a citizens dies, this trigger fires:

Unit dies... Set CitizensAlive[1] = (CitizensAlive[1] - 1)


The tax trigger looks like this:

For each (Integer CitizensAlive[1]) from 0 to 49, do (Player - Add 10 to (Owner of (Random unit from (Units of type Isenheim Guardian))) gold)





The problem: For some reason, it always gives me 500 gold every X seconds, no matter how many citizens are left. And I dont understand why, I read up on a lot of tutorials and at least in my world this trigger should work fine :p
 
Last edited:
Level 3
Joined
Oct 9, 2011
Messages
45
That makes perfect sense, now I cant tell you why I wanted to array that or use such a complicated trigger. Thats pretty much the first time I ever used variables/arrays :D

I tried it out and it worked great, thanks alot!
 
Status
Not open for further replies.
Top