• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Building Income

Status
Not open for further replies.
Level 9
Joined
Jul 20, 2009
Messages
427
I need triggers that does the following:
1. Certain buildings that are built gives a certain amount of gold for every x seconds.
2. Same as no. 1 but this time the income is dependent upon the total number of living and already built building.(Grain Warehouse income=total number of living and already built farms times X gold for evey x seconds.
3. Whenever the building's hp is below 30% of its maximum hp, it won't generate income unless it is repaired, only then will it give gold periodically..
Trigger tags please, thanks in advance..I WILL CREDIT ANYONE WHO COULD HELP ME WITH THIS ONE ON MY MAP..
 
Level 3
Joined
Sep 11, 2004
Messages
63
Sorry too lazy to open worldedit and trigger tag it, but the basic idea is:

Event:
Every [your desired interval of income]
Condition:
None
Action
set udg_temp_group = pick all units matching condition(unit type equals to building and unit hp >= 30%)
set player gold to player gold + (countunitsingroup(udg_temp_group) * incomeperbuilding)
call DestroyGroup(udg_temp_group)
 
Level 4
Joined
Jul 19, 2009
Messages
100
Well Heres what I do for #1:

EVENT:
every (x seconds)
ACTION
-set var_#of_supply_buidlings to (count_living_units_owned_by_player_red_of_type(supply warehouse))

-add (var_#of_supply_buidlings*x) to player1 property (x in this like would be amount
you want to give to the player)


This just sets a variable for the number of living supply buildings and then every x seconds adds a certain amount of gold to the players supply multiplied by amount of warehouses. (1 warehouse = 10 gold at a time, 2 = 20 gold at a time)
Then make one of this trigger for every player and repleace player1 with player2. :mwahaha:
 
Status
Not open for further replies.
Top