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

[Trigger] Bonus armor (triggered)

Status
Not open for further replies.
Level 7
Joined
May 23, 2008
Messages
307
Hey guys.
I'm looking for an efficient way to make a bonus armor system.
My map is about attacking controllpoints.
When 1 team has less CP's than the other, the team gets + armor.
The problem is that my system is very slow. It checks the controllpoints and then adds a abilty to the HQ which will add the +armor.

  • Bonus Level 1
    • Ereignisse
      • Zeit - Every 0.50 seconds of game time
    • Bedingungen
    • Aktionen
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • Bonus_Level Gleich 1.00
        • 'THEN'-Aktionen
          • Spiel - Display to (All players) the text: bonus=1
          • Einheitengruppe - Pick every unit in HQT2 and do (Actions)
            • Schleifen - Aktionen
              • Einheit - Remove Fhigkeit from (Picked unit)
              • Spiel - Display to (All players) the text: REMOVED (T2)
          • Set Fhigkeit = Bonus [Level 1]
          • Spiel - Display to (All players) the text: SET BONUS1
          • Einheitengruppe - Pick every unit in (Units owned by (Random player from (All players matching (((Matching player) is in Team2_PlayerGr) Gleich True))) matching ((Owner of (Picked unit)) Gleich (Random player from (All players matching (((Matching player) is in Team2_PlayerGr) Gleich True))))) and do (Actions)
            • Schleifen - Aktionen
              • Spiel - Display to (All players) the text: Players picked
              • Einheit - Remove Alle buffs from (Picked unit)
              • Spiel - Display to (All players) the text: buffs removed
          • Einheitengruppe - Pick every unit in HQT2 and do (Actions)
            • Schleifen - Aktionen
              • Einheit - Add Fhigkeit to (Picked unit)
              • Spiel - Display to (All players) the text: ADDED (T2)
        • 'ELSE'-Aktionen
The vars are:
Fhgiket = ability (Bonus armor)
HQT2 = all headquarters in team 2 that will get the ability

The biggest problem I'm having at the moment is to detect all units in team2 (Team2_PlayerGr is the var where i stored the players) i tried this trigger:
  • Einheitengruppe - Pick every unit in (Units owned by (Random player from (All players matching (((Matching player) is in Team2_PlayerGr) Gleich True))) matching ((Owner of (Picked unit)) Gleich (Random player from (All players matching (((Matching player) is in Team2_PlayerGr) Gleich True))))) and do (Actions)
    • Schleifen - Aktionen
      • Spiel - Display to (All players) the text: Players picked
      • Einheit - Remove Alle buffs from (Picked unit)
      • Spiel - Display to (All players) the text: buffs removed
but it won't work :/
You know what's wrong with it?
 
Level 7
Joined
May 23, 2008
Messages
307
Hm okay. I will tell you my problem:

I want to detect all units in a team and then I want to give them +armor.
If the Controllpoints change, the armor should be updated (there are 10 Controllpoints, if Team1 owns a new one/Team2 owns a new one, the + armor should be updated so I have to remove the armor and add it again)

I need a system that detects all units in a team and that adds this armor and that can also remove it.
 
Level 6
Joined
Jul 25, 2005
Messages
221
This problem can be very easily dealt with... Why complicate things when you might as well use a dummy unit with an aura spell that gives armor to all on the map?

This way you dont have to pick all units of a team and then add an ability one by one. Just make a trigger that checks how many control points they own and then adjust the spell's level accordingly. If the other team has more after a while, just change the owner of the dummy to the other team.
 
Level 7
Joined
May 23, 2008
Messages
307
I already did that. But the problem is that if 1 team has 5 CPs and the other one has 4 then it will go: 5-4=1 and will add 1 bonus armor aura to he HQ of team 2.

If team 1 has 3 CPs and Team 2 has 7 it will go: 3-7=-4 and it will add a +4 bonus aura to the HQ of Team1.

But the problem is to detect all the units in a team to REMOVE the buffs again to add them after this. Because the buffs will still be there if I only add a new aura.
 
Level 6
Joined
Jul 25, 2005
Messages
221
.... You're complicating things. Just make spell max level = control points, create TWO dummy targets, if that is what you wish, and then keep track of both of them and change their ability levels accordingly.

The AURA buffs, are removed automatically after a delay specified in the spells attributes. Default is 2 seconds.

And why would you add another aura on top of that? you just need one aura, or two auras if you count 2 dummies.

Here's how it could look like:

  • Epics
  • Events
    • Unit - A unit enters region [control point]
  • Conditions
    • (Entering Unit) is an ally of HQ1
  • Actions
    • Set Team1ControlPoints = Team1ControlPoints + 1
    • If( Team2ControlPoints>0)
      • Then
        • Set Team2ControlPoints = Team2ControlPoints -1
    • If( Team1ControlPoints>Team2ControlPoints)
      • Then
        • Unit - Change DummyUnitHQ1 level to (Team1ControlPoints-Team2ControlPoints)
      • else
Or something, I don't have a WE nearby... But that's the equation.

A game should be kept to an event based level, meaning you should avoid doing triggers that has to do with checking every 0.5 seconds or something. There are events that can do this for you.
Avoid too much work for the editor, avoiding lagg and unnecessary triggers.
 
Level 7
Joined
May 23, 2008
Messages
307
:) Great. Thanks.
People always tell me that I think too complicated :D

That's a nice way of doing what I want. Thank you :)

+rep to both of you
 
Status
Not open for further replies.
Top