How to make buildings spawn items in front of them?

yami-joey

TH.net Regular
Reaction score
20
I'm creating a Tpwer Defense game, and I want to make a "Power Plant" system where a building spawns an item in front of it (the item being based on Gold Coins item). You then collect the coins manually to build your towers. It's going to be a great form of gameplay for a TD, but I need help in triggering.

IF the above can't be triggered, an alternative could be if you create the "Power Plant" building, you will gain 1 gold per second. And for how many buildings you have, your gold per second increases (ex: You have 5 power plants, you gain 5 gold per second.)

SO can anyone help me how to code the above trigger?? thanks so much.

Side question: What do you think will be cooler for a TD? The first or the second one???

To those who will comment thank you so much and keep on helping us mappers... :D
 

Yoshii

New Member
Reaction score
74
the 1st one is a bad idea in my book; that would make your map the opposite of fun; noone want to go pick up gold in a TD map as for the trigger its kinda simple my guess would be using an integer array and storing the number of unit type X(gold giver) and then right away give an amount of gold equal or a multiple or whatever of the number of unit type the player own
basically even would be every 1-2sec then pick every unit owned by player 1 matching building of type bla bla and set variable[1]=number

then in another trigger if u dont want to get gold every 1-2sec you could have
every 10sec of game time
player add variable[1]x amount of gold to player 1
 

Bloodydood

New Member
Reaction score
14
Trigger:
  • Income
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Wait 10.00 seconds
      • Set Temp_Group = (Units owned by Player 1 (Red) matching ((Unit-type of (Matching unit)) Equal to Power Plant))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Player - Add (Number of units in Temp_Group) to (Owner of (Picked unit)) Current gold
      • Custom script: call DestroyGroup (udg_Temp_Group)
      • Trigger - Run (This trigger) (ignoring conditions)

You will need to copy the actions, (Set Temp_Group, Unit Group, and custom script), for each additional player.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top