• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Few problems with Triggers

Status
Not open for further replies.
Level 3
Joined
Apr 3, 2009
Messages
24
I need to know a few stuff.

How do i make it so a Unit selector dies when a unit from shop is bought?

As well as when an Archer goes on a certan place on the ground how can i make it so they will warp on to a wall to defend an area like a tower does.

Lastly I need to know how to make an income for each player. Any help will be wonderful.:infl_thumbs_up::infl_thumbs_up::infl_thumbs_up:
 
1)
  • Untitled Trigger 007
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Unit - Kill (Buying unit)
2)
  • Untitled Trigger 007
    • Events
      • Unit - A unit enters Region 001 <gen> // from where you want to move the unit
    • Conditions
    • Actions
      • Set Temp_Loc_1 = (Center of Region 015 <gen>) to where you want to move the unit
      • Unit - Move (Triggering unit) instantly to Temp_Loc_1
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
3) What kind of income system?
 
The first one is simple. Here is a rough layout.
  • Killing Selector unit
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Buying unit)) Equal to UnitSelector
    • Actions
      • Unit - Remove (Buying unit) from the game
I havn't really looked into the second one but you could use a selection of regions or points set into an array and just create an archer at the point or region then remove the point/region from being chosen in the array. (Unit -Create Archer at Location facing Default Building Degrees)

For the third one you will probably need an event that occurs every 60 seconds or what ever time you like that sets each players gold to their current gold plus income (Set Player Property - Gold). The income given is entirely up to you to decide and would involve setting an integer to a value of the income given.
 
1. something like:

  • Kill Buyer
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Unit - Kill (Buying unit)

2. do you mean when the archer enter a specified region, the archer is moved instantly to another location or what?

3. this is an example: every 3 seconds, all players receive 2% of his/her current gold as income

  • Income
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set PGroups = (All players matching (((Matching player) slot status) Equal to Is playing))
      • Player Group - Pick every player in PGroups and do (Actions)
        • Loop - Actions
          • Set Income = (Integer((0.02 x (Real(((Picked player) Current gold))))))
          • Player - Set (Picked player) Current gold to (((Picked player) Current gold) + Income)
      • Custom script: call DestroyForce(udg_PGroups)


oh and btw, next time please try for yourself first, then post your current code if you find trouble :smile:
 
Last edited:
For the ones that were questioned

1. (Thanks I got it and its done)
2. I have a wall ok? If a unit goes to this place it is warped up there, imovable and is treated like a tower
3. Give gold 500 to each player every 5 mins (apart from red and green who get 1000)

{EDIT 1}
All given ones for Number one DONT WORK!

{EDIT 2}
Never mind i found the problem
 
Last edited by a moderator:
Number 3 is easy, just make a trigger that executes every 5 minutes and add the amount of gold you want to the players you wish.

You just need to use event "time-periodic event" and set it to 300 seconds and the use "player-add property" to add 500 gold or whatever to players. You can also use "player group - pick every player in player group and do actions"

So, it would be something like
  • AddingGold
  • Events
    • Time - Every 300 seconds of game time
  • Conditions
  • Actions
    • Player Group - Pick every player in (All players matching (((Picked player) slot status) Equal to Is Playing)) and do (Actions)
      • Loop : Actions
        • Player - Add 500 gold to (Picked player) current gold
    • Player - Add 500 gold to (Player 1) current gold
    • Player - Add 500 gold to (Player 2) current gold
you should still check if slots for player 1 and 2 are occupied before adding gold to them (but i don't know if it matters adding gold to a non occupied player slot)
 
Status
Not open for further replies.
Back
Top