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

[Trigger] Lag?

Status
Not open for further replies.
Level 4
Joined
May 23, 2010
Messages
83
i made this spell, there are ranks, each rank is a single ability, this is all set at map init. when activated causes massive lag. what is the cause? maybe a conflict?

  • Spells Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set spell_hb_table = (Last created hashtable)
      • Set spell_hb_ranks[1] = Holy Burn (Rank 1)
      • Set spell_hb_ranks[2] = Holy Burn (Rank 2)
      • Set spell_hb_ranks[3] = Holy Burn (Rank 3)
      • Set spell_hb_ranks[4] = Holy Burn (Rank 4)
      • Set spell_hb_ranks[5] = Holy Burn (Rank 5)
      • Set spell_hb_ranks[6] = Holy Burn (Rank 6)
      • Set spell_hb_ranks[7] = Holy Burn (Rank 7)
      • Set spell_hb_rankcount = 7
  • Spells Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • For each (Integer generalintegers[1]) from 1 to spell_hb_rankcount, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to spell_hb_ranks[generalintegers[1]]
            • Then - Actions
              • Set spell_hb_caster = (Triggering unit)
              • Set spell_hb_target = (Target unit of ability being cast)
              • Set spell_hb_casterint = (Intelligence of spell_hb_caster (Include bonuses))
              • Set spell_hb_damage = (20.00 + ((2.00 + (0.75 x (Real(generalintegers[1])))) x (Real(spell_hb_casterint))))
              • Set spell_hb_duration = 5.00
              • Set spell_hb_critchance = (0.08 + (0.02 x (Real(generalintegers[1]))))
              • Hashtable - Save spell_hb_critchance as (Key critchance) of (Key (Target unit of ability being cast)) in spell_hb_table
              • Hashtable - Save spell_hb_duration as (Key duration) of (Key (Target unit of ability being cast)) in spell_hb_table
              • Hashtable - Save spell_hb_damage as (Key damage) of (Key (Target unit of ability being cast)) in spell_hb_table
              • Hashtable - Save Handle Ofspell_hb_caster as (Key caster) of (Key (Target unit of ability being cast)) in spell_hb_table
              • Unit Group - Add spell_hb_target to spell_hb_group
              • Trigger - Turn on Holy Burn Periodic <gen>
              • Floating Text - Create floating text that reads (commands_playercolors[(Player number of (Owner of (Triggering unit)))] + (Holy Burn! + |r)) above spell_hb_caster with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 0.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
              • Skip remaining actions
            • Else - Actions
  • Holy Burn Periodic
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in spell_hb_group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Holy Burn ) Equal to True
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set spell_hb_duration = (Load (Key duration) of (Key (Picked unit)) from spell_hb_table)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • spell_hb_duration Equal to 1.00
                      • spell_hb_duration Equal to 2.00
                      • spell_hb_duration Equal to 3.00
                      • spell_hb_duration Equal to 4.00
                      • spell_hb_duration Equal to 5.00
                • Then - Actions
                  • Set spell_hb_caster = (Load (Key caster) of (Key (Picked unit)) in spell_hb_table)
                  • Set spell_hb_target = (Picked unit)
                  • Set spell_hb_damage = (Load (Key damage) of (Key (Picked unit)) from spell_hb_table)
                  • Set spell_hb_tempdamage = (spell_hb_damage / 5.00)
                  • Unit - Cause spell_hb_caster to damage spell_hb_target, dealing spell_hb_tempdamage damage of attack type Spells and damage type Normal
                  • Floating Text - Create floating text that reads (|cffffff00 + ((String((Integer(spell_hb_tempdamage)))) + |r)) above spell_hb_target with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • spell_hb_duration Equal to 0.00
                    • Then - Actions
                      • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Set spell_hb_critchance = (Load (Key critchance) of (Key (Picked unit)) from spell_hb_table)
                      • Set spell_hb_duration = (spell_hb_duration - 0.05)
                      • Set spell_hb_caster = (Load (Key caster) of (Key (Picked unit)) in spell_hb_table)
                      • Set spell_hb_target = (Picked unit)
                      • Set spell_hb_damage = (Load (Key damage) of (Key (Picked unit)) from spell_hb_table)
                      • Set spell_hb_tempdamage = (spell_hb_damage / 2.50)
                      • Set spell_hb_critmultiplier = 2.50
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Random real number between 0.00 and 1.00) Less than or equal to spell_hb_critchance
                        • Then - Actions
                          • Set spell_hb_tempdamage = (spell_hb_tempdamage x spell_hb_critmultiplier)
                          • Unit - Cause spell_hb_caster to damage spell_hb_target, dealing spell_hb_tempdamage damage of attack type Spells and damage type Normal
                          • Floating Text - Create floating text that reads (|cffffff00 + ((String((Integer(spell_hb_tempdamage)))) + ! |r)) above spell_hb_target with Z offset 0.00, using font size 13.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                          • Floating Text - Change (Last created floating text): Disable permanence
                          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                          • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                        • Else - Actions
                          • Unit - Cause spell_hb_caster to damage spell_hb_target, dealing spell_hb_tempdamage damage of attack type Spells and damage type Normal
                          • Floating Text - Create floating text that reads (|cffffff00 + ((String((Integer(spell_hb_tempdamage)))) + |r)) above spell_hb_target with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                          • Floating Text - Change (Last created floating text): Disable permanence
                          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                          • Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
                      • Unit Group - Remove (Picked unit) from spell_hb_group
                      • Unit - Remove Holy Burn buff from (Picked unit)
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in spell_hb_table
                    • Else - Actions
              • Set spell_hb_duration = (spell_hb_duration - 0.05)
              • Hashtable - Save spell_hb_duration as (Key duration) of (Key (Picked unit)) in spell_hb_table
            • Else - Actions
              • Unit Group - Remove (Picked unit) from spell_hb_group
              • Unit - Remove Holy Burn buff from (Picked unit)
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in spell_hb_table
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in spell_hb_group) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: hb periodic off
          • Trigger - Turn off (This trigger)
        • Else - Actions
i just added to display the text to know when the trigger is off, and the trigger is turned off, and when that occurs, the lag stops. can someone help me?
 
Some things to note:

1) Instead of using these conditions:
  • spell_hb_duration Equal to 1.00
    • spell_hb_duration Equal to 2.00
    • spell_hb_duration Equal to 3.00
    • spell_hb_duration Equal to 4.00
    • spell_hb_duration Equal to 5.00
you can make the following one:
  • (Integer(spell_hb_duration)) Greater than 0
It's an Integer comparison, through Conversion - Convert Real to Integer.

2)
  • Set spell_hb_duration = (spell_hb_duration - 0.05)
  • Hashtable - Save spell_hb_duration as (Key duration) of (Key (Picked unit)) in spell_hb_table
Remove the Set spell_hb_duration action, it may interfere with other values, of other units, casting it at the same time.

3)
  • Skip remaining actions
No reason for that line to be there. Remove it.

4)
  • Set spell_hb_ranks[1] = Holy Burn (Rank 1)
  • Set spell_hb_ranks[2] = Holy Burn (Rank 2)
  • Set spell_hb_ranks[3] = Holy Burn (Rank 3)
  • Set spell_hb_ranks[4] = Holy Burn (Rank 4)
  • Set spell_hb_ranks[5] = Holy Burn (Rank 5)
  • Set spell_hb_ranks[6] = Holy Burn (Rank 6)
  • Set spell_hb_ranks[7] = Holy Burn (Rank 7)
  • Set spell_hb_rankcount = 7
An easier way would be making an ability (not a Hero one, a normal one, e.g. Chain Lightning with Targets set to 1 or Channel-based), with 7 levels.
So, instead of doing this:
  • Actions
    • For each (Integer generalintegers[1]) from 1 to spell_hb_rankcount, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Ability being cast) Equal to spell_hb_ranks[generalintegers[1]]
          • Then - Actions
            • Set spell_hb_damage = (20.00 + ((2.00 + (0.75 x (Real(generalintegers[1])))) x (Real(spell_hb_casterint))))
            • Set spell_hb_critchance = (0.08 + (0.02 x (Real(generalintegers[1]))))
you can do this:
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Ability being cast) Equal to Holy Burn
      • Then - Actions
        • Set spell_hb_damage = (20.00 + ((2.00 + (0.75 x (Real(Level of (Ability being cast) for (Triggering unit))) x (Real(spell_hb_casterint))))
        • Set spell_hb_critchance = (0.08 + (0.02 x (Real(Level of (Ability being cast) for (Triggering unit))
 
Level 4
Joined
May 23, 2010
Messages
83
the reason im making the spells with "ranks" is because im working in spellbooks and i dont know how to set the level of an ability inside a spellbook, thats the reason to do this stuff. but as soon as i learn about spellbooks ill do your way, of course but it will be very forward, because my hero-level system depends on this too.

edit: +rep for help :)

edit: the reason for the action skipping is because as i use "for each integer" action it would skip the remaining integers, having a faster effect. i will remove for a while to see if its better (i think theres not much difference)

edit: i did the integer thing you told me to do. didn't work. as i thought you convert a real to integer, you take away the decimal part of the number, so every 0.05 seconds the unit is damaged and there is still lag

edit: (i hope there is no punishment for too many edits) what if i do some stuff like pause/start timers?? because i want to make the holy burn look like shadow strike (every 1 sec do the damage but the highest damage is in the end) then if i create a timer for every time the spell is cast and add to another trigger the event "timer expires"? and then just arrays to control who is the caster, how many times the timer expired and the final damage time. can also use hashtables so i just need to know how will i do to check the spell instance (if i have 3 spells and spell 1 is over how can i set the arrays to be 1 and 2 and whatever more..) ill search for that and i appreciate help :)
 
Last edited:
The simple action
  • Unit - Set level of ability for unit
can increase the level of your abilities within the spellbooks too. ;)

There is no punishment for editing by the way, it's preferred, than double-/triple-/.../n-posting.

Not sure I realised the effect you are going for. Timers can't be MUI though, they can only become MPI (array-enhanced).

The integer conversion won't decrease the lag, it will short things out. I really wonder why it didn't work by the way.
 
Status
Not open for further replies.
Top