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

[Solved] World Edit/Trigger Editor - Lagging Problem - Skills based on Periodic Event

Status
Not open for further replies.
Level 14
Joined
Jun 15, 2016
Messages
749
Basically, those skills are leakless and simple. But if I use similar skills based on Period Event at the same time, the map will gonna be lag seriously. I really appreciate if someone can find a new method which works similarly to those skills but without lagging problem, of course. For example, I want to make a custom aura skill which increases max hit points of nearby friendly units (only work when staying close):

Code:
Blood Aura Copy
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) has buff Blood Aura ) Equal to True
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Blood Aura  for WarlordU) Equal to 1
                            Then - Actions
                                Unit - Add Blood Life (100) to (Picked unit)
                                Unit - Remove Blood Life (145) from (Picked unit)
                                Unit - Remove Blood Life (200) from (Picked unit)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Blood Aura  for WarlordU) Equal to 2
                            Then - Actions
                                Unit - Add Blood Life (145) to (Picked unit)
                                Unit - Remove Blood Life (100) from (Picked unit)
                                Unit - Remove Blood Life (200) from (Picked unit)
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Blood Aura  for WarlordU) Equal to 3
                            Then - Actions
                                Unit - Add Blood Life (200) to (Picked unit)
                                Unit - Remove Blood Life (100) from (Picked unit)
                                Unit - Remove Blood Life (145) from (Picked unit)
                            Else - Actions
                    Else - Actions

Is there any alternative way to make this work without using Periodic Event? Please help me.
 
Level 14
Joined
Jun 15, 2016
Messages
749
So there is no possible way to make this skill without lagging? I really want to know because right now I'm trying to merge all War66's race altogether with his approval and holy lord, there are a lot of skills which technically based on this.
 
There is a better Way.
  1. Create an Group - Containing the affected Units. Map init - as Empty Group
  2. Check periodic: for new affected UNits near the Aura - sources, add them to the group and grant the proper Hp bonus.
  3. check periodic: if an affected Unit lost its buff -> Remove Aura effect and from the group.
If this skill is only owned by one Unit you could try using the Unit -comes in Range event
  • Unit - A unit comes within 890.00 of Aura-Source
 
Last edited:
Level 14
Joined
Jun 15, 2016
Messages
749
There is a better Way.
  1. Create an Group - Containing the affected Units. Map init - as Empty Group
  2. Check periodic: for new affected UNits near the Aura - sources, add them to the group and grant the proper Hp bonus.
  3. check periodic: if an affected Unit lost its buff -> Remove Aura effect and from the group.

Could you explain it more details using GUI coding text please, cause I am not a fast learner. Well, this skill, please.
 
Something like this. This way you loops are alot shorter in terms of performance. If there is only one Unit having the Aura you could change the add UNit stuff to the type i wrote before.
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • -------- Create an empty Group - Will Contain all Units affected by this aura. --------
      • Set Blood_Aura_Units = (Units in (Playable map area) matching (True Gleich False))
  • Add new
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Set Punkt = (Position of Blood_Aura_User)
      • Custom script: set bj_wantDestroyGroup=true
      • Einheitengruppe - Pick every unit in (Units within 700.00 of Punkt) and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ((Picked unit) has buff Befehls-Aura) Gleich True
        • 'THEN'-Aktionen
          • -------- Add HP --------
          • -------- and add to group --------
          • Einheitengruppe - Add (Picked unit) to Blood_Aura_Units
        • 'ELSE'-Aktionen
    • Custom script: call RemoveLocation(udg_Punkt)
  • Remove
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in Blood_Aura_Units and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ((Picked unit) has buff Befehls-Aura) Gleich False
          • 'THEN'-Aktionen
            • -------- Remove HP --------
            • -------- Remove from Group --------
            • Einheitengruppe - Remove (Picked unit) from Blood_Aura_Units
          • 'ELSE'-Aktionen
 
Last edited:
Level 14
Joined
Jun 15, 2016
Messages
749
Something like this. This way you loops are alot shorter . If there is only one Unit having the Aura you could change the add UNit stuff to the type i wrote before.
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • -------- Create an empty Group - Will Contain all Units affected by this aura. --------
      • Set Blood_Aura_Units = (Units in (Playable map area) matching (True Gleich False))
  • Add new
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Set Punkt = (Position of Blood_Aura_User)
      • Custom script: set bj_wantDestroyGroup=true
      • Einheitengruppe - Pick every unit in (Units within 700.00 of Punkt) and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ((Picked unit) has buff Befehls-Aura) Gleich True
        • 'THEN'-Aktionen
          • -------- Add HP --------
          • -------- and add to group --------
          • Einheitengruppe - Add (Picked unit) to Blood_Aura_Units
        • 'ELSE'-Aktionen
    • Custom script: call RemoveLocation(udg_Punkt)
  • Remove
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in Blood_Aura_Units and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ((Picked unit) has buff Befehls-Aura) Gleich False
          • 'THEN'-Aktionen
            • -------- Remove HP --------
            • -------- Remove from Group --------
            • Einheitengruppe - Remove (Picked unit) from Blood_Aura_Units
          • 'ELSE'-Aktionen
  • [/Trigger
  • [QUOTE="Tasyen, post: 3080288, member: 194042"]Something like this. This way you loops are alot shorter . If there is only one Unit having the Aura you could change the add UNit stuff to the type i wrote before.
  • [Trigger]
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • -------- Create an empty Group - Will Contain all Units affected by this aura. --------
      • Set Blood_Aura_Units = (Units in (Playable map area) matching (True Gleich False))
  • Add new
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Set Punkt = (Position of Blood_Aura_User)
      • Custom script: set bj_wantDestroyGroup=true
      • Einheitengruppe - Pick every unit in (Units within 700.00 of Punkt) and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ((Picked unit) has buff Befehls-Aura) Gleich True
        • 'THEN'-Aktionen
          • -------- Add HP --------
          • -------- and add to group --------
          • Einheitengruppe - Add (Picked unit) to Blood_Aura_Units
        • 'ELSE'-Aktionen
    • Custom script: call RemoveLocation(udg_Punkt)
  • Remove
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in Blood_Aura_Units and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ((Picked unit) has buff Befehls-Aura) Gleich False
          • 'THEN'-Aktionen
            • -------- Remove HP --------
            • -------- Remove from Group --------
            • Einheitengruppe - Remove (Picked unit) from Blood_Aura_Units
          • 'ELSE'-Aktionen

Its really work. So your meaning here is that lagging problem was mainly caused by looping too many units, not by "every 1.oo seconds of game time", correct? What if I use many of them, will the problem vanish or its just cool down a little bit?
 
Its really work. So your meaning here is that lagging problem was mainly caused by looping too many units, not by "every 1.oo seconds of game time", correct? What if I use many of them, will the problem vanish or its just cool down a little bit?
If you do the Auras fine and clean away leaks it should be fine.

Perodic is not the problem. The problem is what you do perodic.
 
Level 11
Joined
Oct 9, 2015
Messages
721
I use this trigger for the purpose of altering an unit's max hp, you have to create an hp bonus ability with 7 levels, then set the value on the levels in object editor like in the image then in the first trigger set the value and the unit to be affected, then run the trigger that alters max hp:
  • Test Set Max Hp
    • Events
    • Conditions
    • Actions
      • Set Max_Hp = 100
      • Set Some_Unit = YourUnit
      • Trigger - Run Set Max Hp <gen> (ignoring conditions)
  • Set Max Hp
    • Events
    • Conditions
    • Actions
      • Set Max_Hp = (Max_Hp - (Integer((Max life of Some_Unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Hp Greater than 0
        • Then - Actions
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 4
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 3
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 2
              • Unit - Remove Max Life Modifier from Some_Unit
        • Else - Actions
          • Set Max_Hp = (0 - Max_Hp)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 7
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 6
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 5
              • Unit - Remove Max Life Modifier from Some_Unit
PS: It's very versatile as you can easly set it to any value you want without having to add/remove the hp bonus ability a ton of times without having to check for every bit of the unit's life
 

Attachments

  • 2016-07-25.png
    2016-07-25.png
    150.5 KB · Views: 60
Level 14
Joined
Jun 15, 2016
Messages
749
I use this trigger for the purpose of altering an unit's max hp, you have to create an hp bonus ability with 7 levels, then set the value on the levels in object editor like in the image then in the first trigger set the value and the unit to be affected, then run the trigger that alters max hp:
  • Test Set Max Hp
    • Events
    • Conditions
    • Actions
      • Set Max_Hp = 100
      • Set Some_Unit = YourUnit
      • Trigger - Run Set Max Hp <gen> (ignoring conditions)
  • Set Max Hp
    • Events
    • Conditions
    • Actions
      • Set Max_Hp = (Max_Hp - (Integer((Max life of Some_Unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Hp Greater than 0
        • Then - Actions
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 4
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 3
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 2
              • Unit - Remove Max Life Modifier from Some_Unit
        • Else - Actions
          • Set Max_Hp = (0 - Max_Hp)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 7
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 6
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 5
              • Unit - Remove Max Life Modifier from Some_Unit
PS: It's very versatile as you can easly set it to any value you want without having to add/remove the hp bonus ability a ton of times without having to check for every bit of the unit's life

Interesting! I am sure will put this into good use if things are getting more complicated.
 
Status
Not open for further replies.
Top