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

Control Point Income?

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,025
Hi, I'm trying to replicate a control point income system for my map, anyone who's played Azeroth Wars or DAOW will know what I mean, for every circle of power a player owns he'll recieve a certain amount of gold every minute. This means the more of the map he owns the more money he gets etc.

Can anyone help with the triggering of this please or show me an example trigger?
 
Level 11
Joined
Jun 20, 2009
Messages
880
  • Income
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Circle of Power
            • Then - Actions
              • Set Income[1] = (Income[1] + 1)
            • Else - Actions
      • Player - Add Income[1] to Player 1 (Red) Current gold
      • Set Income[1] = 0

Do this for every player.

( Income variable is Integer type. Use Income[1] for player 1, Income[2] for player 2 etc. )
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Dis iz better
  • Income
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Control Point) and ((Owner of (Matching unit)) Equal to (Picked player)))) and do (Actions)
            • Loop - Actions
              • Player - Add 20 to (Picked player) Current gold
Maybe use:
  • For each (Integer A) from 1 to (Number of players in (All players)), do (Actions)
    • Loop - Actions
for that?

Wouldn't work. Imagine this - There are 3 players ingame,player 1,player 3 and player 7.
It would loop for players 1,2 and 3 (since there are 3 players ingame) and wouldn't cover player 7 :3
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
Only the new versions of averoth wars use control points, orignally it used income based on food.

Anyway, Kala's trigger will work, but it leaks a enormous group every minute which is very bad.

Rather keep count of how many control points a player owns and add a multiple of that variable every income.

How you keep track of the numbers are adding 1 to the player's total when they capture one. Then removing 1 from the player's total when they lose one.

Far far far more efficent as there is no group enumeration at all.
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
wow thanks for the fast replies!

Anyway, Kala's trigger will work, but it leaks a enormous group every minute which is very bad.

Rather keep count of how many control points a player owns and add a multiple of that variable every income.

How you keep track of the numbers are adding 1 to the player's total when they capture one. Then removing 1 from the player's total when they lose one.

Far far far more efficent as there is no group enumeration at all.

Well I think Garfield's might be better as there'l be some control points that give different amounts of income, EG: 1 might give 25g with another only 10g. Also when triggers start going into variables thats when I start getting confused :S

Gunna test this on my map now thanks.
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
Thanks for the help Garfields trigger works! But I have one other question related to this, you know when you over take a CP it turns to the players control well my triggers not working for some reason:

Event:Unit - Control Point 0549 <gen>'s life becomes Less than 50.00

Action: Unit - Change ownership of Control Point 0549 <gen> to (Triggering player) and Change color
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Use
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Control Point)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Trigger <gen> the event (Unit - (Picked unit) Takes damage)
  • Trigger
    • Events
    • Conditions
      • (Life of (Triggering unit)) Less than 50.00
    • Actions
      • Unit - Change ownership of (Triggering unit) to (Owner of (Damage source)) and Change color
      • Unit - Set life of (Triggering unit) to 100.00%
Your trigger doesn't work because you change owner to Triggering player,which is...undefined in that case. You also can't find the unit who has lowered the CP's health to below 50.0. That's why i use the 'Unit takes damage' event.
 
Status
Not open for further replies.
Top