Control Points

Level 3
Joined
Oct 27, 2009
Messages
36
How to make it so that if you capture a control point it automatically respawns at full health and gives you 10 gold every minute or so?
 
Level 9
Joined
Oct 22, 2006
Messages
599
- That's not one thing you're asking, but two things (you should clearify this on post).

1. Trigger that activates when unit in range, change owner, set life = 100%, control point counter reduce by 1

2. Trigger that gives an income based on the number of control points a player owns. You can get an idea for this trigger from My post. It won't do the job you want, but can avoid making mistakes before creating a trigger.

- Sorry for not making the triggers myself, but I have no time and got to sleep.:sad:
 
Level 3
Joined
Oct 27, 2009
Messages
36
I am confused by "control point counter reduce by 1" and how would i make a trigger where if a control point dies it instantly respawns for another player to control?
 
Level 3
Joined
Jul 27, 2008
Messages
35
Here is the base for the capture trigger. I'm not to sure how to have the income in there, so I'll let someone else who doesn't suck at triggering add that in (or replace everything lol) :D
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Control Point
  • Actions
    • -------- This variable is a point. --------
    • Set TempPoint = (Position of (Triggering unit))
    • Unit - Create 1 Control Point for (Owner of (Killing unit)) at TempPoint facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 18
Joined
Feb 25, 2009
Messages
2,006
Here is the base for the capture trigger. I'm not to sure how to have the income in there, so I'll let someone else who doesn't suck at triggering add that in (or replace everything lol) :D
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Control Point
  • Actions
    • -------- This variable is a point. --------
    • Set TempPoint = (Position of (Triggering unit))
    • Unit - Create 1 Control Point for (Owner of (Killing unit)) at TempPoint facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_TempPoint)

That will probably the most horrible way to make capturing points...
Imagine 3 enemy players, each of them doing the same thing... just killing the CP and not killing anything around them...

Best way is with countdown timers, and a bunch of other triggers that checks for enemys around and more things...

Then a separated trigger or the income - I think someone uploaded a "Income System" 1-2 days ago, just check the spell-section.
 
Level 18
Joined
Feb 25, 2009
Messages
2,006
I could show you my trigger if someone could tell me how to paste GUI into hive.....lol?

Click "Go Advanced" then click this
folder.gif

, then go to your WE, select the trigger, and in the panel where the Events/Condition/Actions are, right-mouse-click on the name at the begining then click "Copy as text", go back into the site and PASTE the trigger between the
  • tags.
 
Last edited:
Level 10
Joined
Aug 15, 2008
Messages
720
  • Income CP CD init
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start Income as a Repeating timer that will expire in 10.00 seconds
      • Countdown Timer - Create a timer window for Income with title Income
      • Hashtable - Create a hashtable
      • Set CooldownTable = (Last created hashtable)
  • Capture CP
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Control Point
    • Actions
      • Set TrigUnit = (Triggering unit)
      • Set KillingUnit = (Killing unit)
      • Set TempLoc1 = (Position of TrigUnit)
      • Unit - Create 1 Control Point for (Owner of KillingUnit) at TempLoc1 facing Default building facing degrees
      • Unit - Make (Last created unit) Invulnerable
      • -------- ----------------- --------
      • Set CooldownTime = 10.00
      • Hashtable - Save CooldownTime as (Key cp_cdtime) of (Key (Last created unit)) in CooldownTable
      • -------- ----------------- --------
      • Unit Group - Add (Last created unit) to CooldownGroup
      • -------- ----------------- --------
      • Custom script: call RemoveLocation(udg_TempLoc1)
  • Control Point Cooldown
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CooldownGroup and do (Actions)
        • Loop - Actions
          • Set CooldownTime = (Load (Key cp_cdtime) of (Key (Picked unit)) from CooldownTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CooldownTime Greater than 0.00
            • Then - Actions
              • Hashtable - Save (CooldownTime - 1.00) as (Key cp_cdtime) of (Key (Picked unit)) in CooldownTable
            • Else - Actions
              • Unit - Make (Picked unit) Vulnerable
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in CooldownTable
              • Unit Group - Remove (Picked unit) from CooldownGroup
  • Income
    • Events
      • Time - Income expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set IncomeGroup = (Units owned by (Player((Integer A))) matching ((Unit-type of (Matching unit)) Equal to Control Point))
          • Player - Add (100 x (Number of units in IncomeGroup)) to (Player((Integer A))) Current gold
          • Custom script: call DestroyGroup(udg_IncomeGroup)
Control points will be invulnerable for 10 seconds after captured and also income triggers are made, in my opinion this trigger should be fully bugless and leakless.
 
Last edited:
  • Like
Reactions: Bel
Level 3
Joined
Oct 27, 2009
Messages
36
Alright, thank you lots. Could you explain the hash table bit and why it's there? I don't quite get it, and I don't want to make threads over the same thing.
 
Level 10
Joined
Aug 15, 2008
Messages
720
With small words - Hashtables enables 100 times better MUI than Indexing. Hashtables allows you to attach variables to 2 keys making perfect MUI, hashtables I think is better than locals, but as I have heard JASS has also better MUI thing - structs or something.

All that hashtable thingy is that CP stays invulnerable for 10 seconds after being captured.
 
Top