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

[Solved] Tax system help

Status
Not open for further replies.
Level 2
Joined
Feb 27, 2014
Messages
18
Hello. I want to create a tax system where x amount of units gives x amount of gold every x seconds.

I would also be very happy if the trigger was explained :)



  • Taxes
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Citizen
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 10.00 seconds
          • Player - Add 20 to (Owner of (Triggering unit)) Current gold
I created this my self, but the problem with it, is that the tax continues when the unit dies.
 
Well loops and waits don't work that great together in warcraft 3, your Trigger might work for 1 unit but if you gain 2 or more this Tax-units with such a construct (waits/loops) it will likely produce an not wanted result.

I assumed all units pay the same amount of taxes in the same time.
Here are my Triggers, I splitted them into small easy Triggers each one doing only one part:

  • Tax Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Create a Group-Object and add all preplaced Tax_units to it --------
      • Set Tax_Payer = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) = Citizens))
      • -------- If there are preplaced Tax_Units turn on income --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Tax_Payer is empty) equal False
        • Then - Actions
          • Trigger - Turn on Tax income <gen>
        • Else - Actions
  • Tax income
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- Every Second Increases for each unit in Tax_Player its owners Gold by 1. -------
      • Einheitengruppe - Pick every unit in Tax_Payer and do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Owner of (Picked unit)) Current Gold
  • Tax enter
    • Events
      • Einheit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) equal Citizens
    • Actions
      • -------- Insere a Tax_Unit into the Group and activade the Loop-------
      • Einheitengruppe - Add (Triggering unit) to Tax_Payer
      • Trigger - Turn on Tax income <gen>
  • Tax leave
    • Events
      • Einheit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Tax_Payer) equal True
    • Actions
      • -------- Remove a killed Tax_Unit from the Group and deactivade the loop if no tax_unit is left--------
      • Einheitengruppe - Remove (Triggering unit) from Tax_Payer
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Tax_Payer is empty) equal True
        • Then - Actions
          • Trigger - Turn off Tax income <gen>
        • Else -Actions
 
Last edited:
Status
Not open for further replies.
Top