• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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