• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

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:
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
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?
 
Level 2
Joined
Apr 27, 2008
Messages
29
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.
 
Level 9
Joined
Dec 12, 2007
Messages
489
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:
Level 3
Joined
Apr 3, 2009
Messages
24
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:
Level 4
Joined
Nov 7, 2009
Messages
83
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.
Top