Trigger Lags

garion992

TH.net Regular
Reaction score
17
Why does this lags, cause of casting too much spells at once?

Code:
Amulet of Fire
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has an item of type |c00000080Fire Amulet|r) Equal to True
    Actions
        Set TempInt = (Random integer number between 1 and 7)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TempInt Equal to 3
            Then - Actions
                Set Distance = (Facing of (Attacking unit))
                For each (Integer A) from 1 to 12, do (Actions)
                    Loop - Actions
                        Set Distance = (Distance + 30.00)
                        Unit - Create 1 Damage Circle Dummy for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing Distance degrees
                        Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm ((Position of (Last created unit)) offset by 256.00 towards Distance degrees)
                        Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
            Else - Actions
 

N2o)

Retired.
Reaction score
51
not because your casting too many spells at once, because you have leaks, search for a leak tutorial.
 

garion992

TH.net Regular
Reaction score
17
LOL, i really need to read a leak tutorial......
thx for the tip!

does this one still has leaks?
Code:
Amulet of Fire
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has an item of type |c00000080Fire Amulet|r) Equal to True
    Actions
        Set TempInt = (Random integer number between 1 and 7)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TempInt Equal to 3
            Then - Actions
                Set Distance = (Facing of (Attacking unit))
                For each (Integer A) from 1 to 12, do (Actions)
                    Loop - Actions
                        Set Distance = (Distance + 30.00)
                        Set PointArray[1] = (Position of (Attacking unit))
                        Unit - Create 1 Damage Circle Dummy for (Owner of (Attacking unit)) at PointArray[1] facing Distance degrees
                        Set PointArray[2] = (Position of (Last created unit))
                        Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (PointArray[2] offset by 256.00 towards Distance degrees)
                        Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                        Custom script:   call RemoveLocation (udg_PointArray[1])
                        Custom script:   call RemoveLocation (udg_PointArray[2])
            Else - Actions
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
Is the dummy unit's spell just supposed to be for a special effect? or is it the spell? If its the spell, I don't think half a second would be enough time to cast it.
 

garion992

TH.net Regular
Reaction score
17
its for casting a spell, and that works. There is no casting time.

wat's a leak test? and where can i find it?
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
It still leaks.

Code:
Unit - Create 1 Damage Circle Dummy for (Owner of (Attacking unit)) at PointArray[1] facing Distance degrees
       Set PointArray[2] = (Position of (Last created unit))
        Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (PointArray[2] offset by 256.00 towards Distance degrees)
        Unit - Add a 0.50 second Generic expiration timer to (Last created Unit)

"offset by 256" is another new point.

So, do this for that part.
Code:
Set PointArray[2] = (Position of (Last created unit))
Set PointArray[3] = PointArray[2] offset by 256.00 towards Distance degrees
Unit Order (last Created unit) to Undead - Carrion swarm (PointArray[3] towards DIstance degrees)
Unit - Add a 0.50 second Generic expiration timer to (Last created Unit)

Just as you know, it would be enough with only using "PointArray[1]" And "PointArray[2]"...You dont have to use PointArray[2] where you are using it, i mean....PointArray[2] is just the same location as pointarray[1]...If you see?
Pos of attacked unit, is pointarray[1]
Then you create 1 unit here at pointarray[1]
then you set pointarray[2] to the poisition where you created "last created unit" which is where? Yes, exactly as pointarray[1].. :p Confusing? :(
 

NapaHero

Back from the dead...
Reaction score
43
LOL, i really need to read a leak tutorial......
thx for the tip!

does this one still has leaks?
Code:
Amulet of Fire
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has an item of type |c00000080Fire Amulet|r) Equal to True
    Actions
        Set TempInt = (Random integer number between 1 and 7)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TempInt Equal to 3
            Then - Actions
                Set Distance = (Facing of (Attacking unit))
                For each (Integer A) from 1 to 12, do (Actions)
                    Loop - Actions
                        Set Distance = (Distance + 30.00)
                        Set PointArray[1] = (Position of (Attacking unit))
                        Unit - Create 1 Damage Circle Dummy for (Owner of (Attacking unit)) at PointArray[1] facing Distance degrees
                        Set PointArray[2] = (Position of (Last created unit))
                        Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (PointArray[2] offset by 256.00 towards Distance degrees)
                        Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                        Custom script:   call RemoveLocation (udg_PointArray[1])
                        Custom script:   call RemoveLocation (udg_PointArray[2])
            Else - Actions

Set PointArray[1] = (Position of (Attacking unit)) - Put this before the loop start. This doesn't need to be an array. Make this one name just Point.

Custom script: call RemoveLocation (udg_PointArray[1]) - Put this after the loop and remove the ''...Array[1]''.

(PointArray[2] offset by 256.00 towards Distance degrees) - This one leaks. Replace this with PointArray [Integer A]

Set PointArray[2] = (Position of (Last created unit)) - This is useless. The Position of Last Created Unit is Point. Make this:

Set PointArray [Integer A] = (Point offset by 256.00 towards Distance degrees). Then remove it with code below.

Custom script: call RemoveLocation (udg_PointArray[2]) - Use this to remove PointArray [Integer A]:

Custom script: call RemoveLocation (udg_PointArray[bj_forLoopAIndex])

MUST KEEP INSIDE THE LOOP.
 

garion992

TH.net Regular
Reaction score
17
Thx for the leak programm and triggers :p

if i got it right it should be like this:
Code:
Amulet of Fire
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has an item of type |c00000080Fire Amulet|r) Equal to True
    Actions
        Set TempInt = (Random integer number between 1 and 7)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TempInt Equal to 3
            Then - Actions
                Set Distance = (Facing of (Attacking unit))
                Set Point = (Position of (Attacking unit))
                For each (Integer A) from 1 to 12, do (Actions)
                    Loop - Actions
                        Set Distance = (Distance + 30.00)
                        Set PointArray[(Integer A)] = (Point offset by 256.00 towards Distance degrees)
                        Unit - Create 1 Damage Circle Dummy for (Owner of (Attacking unit)) at Point facing Distance degrees
                        Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm PointArray[(Integer A)]
                        Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                        Custom script:   call RemoveLocation (udg_PointArray[bj_forLoopAIndex])
                Custom script:   call RemoveLocation (udg_Point)
            Else - Actions

Edit: Ok Thx!!!!!!!!!!!!! (can't rep ManyTimes..... i repped you already earlier XD)
 

garion992

TH.net Regular
Reaction score
17
I experimented a little with the trigger and found some more things:
Now i added a action that picks the unit and deals damage to them and i have set the integer loop to 100.
If the spell is fired it lags like hell. Is this because of leaks or just all those spells fired?

Code:
Amulet of Fire
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has an item of type |c00000080Fire Amulet|r) Equal to True
    Actions
        Set TempInt = (Random integer number between 1 and 7)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TempInt Equal to 3
            Then - Actions
                Set Distance = (Facing of (Attacking unit))
                Set Point = (Position of (Attacking unit))
                For each (Integer A) from 1 to 100, do (Actions)
                    Loop - Actions
                        Set Distance = (Distance + 3.60)
                        Set PointArray[(Integer A)] = (Point offset by 256.00 towards Distance degrees)
                        Unit - Create 1 Damage Circle Dummy for (Owner of (Attacking unit)) at Point facing Distance degrees
                        Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm PointArray[(Integer A)]
                        Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                        Custom script:   call RemoveLocation (udg_PointArray[bj_forLoopAIndex])
                Set TempUnitGroup = (Units within 350.00 of Point matching ((Owner of (Matching unit)) Equal to Neutral Hostile))
                Unit Group - Pick every unit in TempUnitGroup and do (Actions)
                    Loop - Actions
                        Unit - Cause (Attacking unit) to damage (Picked unit), dealing 175.00 damage of attack type Spells and damage type Normal
                Custom script:   call DestroyGroup(udg_TempUnitGroup)
                Custom script:   call RemoveLocation (udg_Point)
            Else - Actions
 

vypur85

Hibernate
Reaction score
803
Dont think it leaks. Its because of the huge loop o_O That's very a lot of units. 100 concentrated on one point and casting spell simultaneously.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top