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

Is that trigger leak-checked???

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi! See the title and then look below!
  • The LP trigg
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Pulse [Electro]
    • Actions
      • Set LevelOfLpulse = (Level of Lightning Pulse [Electro] for (Triggering unit))
      • Set UnitLPulseGroup = (Units within (430.00 + (20.00 x (Real(LevelOfLpulse)))) of (Position of (Triggering unit)) matching (((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
      • Unit Group - Pick every unit in UnitLPulseGroup and do (Actions)
        • Loop - Actions
          • Set Dummy4LPulseArrayLightning = (Dummy4LPulseArrayLightning + 1)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
          • Set Dummy4LPulseLightning[Dummy4LPulseArrayLightning] = (Last created unit)
          • Unit - Add Lightning Pulse 4 dummy to Dummy4LPulseLightning[Dummy4LPulseArrayLightning]
          • Unit - Add a 1.00 second Generic expiration timer to Dummy4LPulseLightning[Dummy4LPulseArrayLightning]
          • Unit - Set level of Lightning Pulse 4 dummy for Dummy4LPulseLightning[Dummy4LPulseArrayLightning] to LevelOfLpulse
          • Unit - Order Dummy4LPulseLightning[Dummy4LPulseArrayLightning] to Orc Far Seer - Chain Lightning (Picked unit)
          • Set Dummy4LPulseArrayLightning = (Dummy4LPulseArrayLightning - 1)
          • Custom script: call RemoveUnit( udg_Dummy4LPulseLightning[udg_Dummy4LPulseArrayLightning] )
      • Unit Group - Pick every unit in UnitLPulseGroup and do (Actions)
        • Loop - Actions
          • Set Dummy4LPulseArraySlow = (Dummy4LPulseArraySlow + 1)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
          • Set Dummy4LPulseSlow[Dummy4LPulseArraySlow] = (Last created unit)
          • Unit - Add slow 4 LP dummy to Dummy4LPulseSlow[Dummy4LPulseArraySlow]
          • Unit - Add a 1.00 second Generic expiration timer to Dummy4LPulseSlow[Dummy4LPulseArraySlow]
          • Unit - Set level of slow 4 LP dummy for Dummy4LPulseSlow[Dummy4LPulseArraySlow] to LevelOfLpulse
          • Unit - Order Dummy4LPulseSlow[Dummy4LPulseArraySlow] to Human Sorceress - Slow (Picked unit)
          • Set Dummy4LPulseArraySlow = (Dummy4LPulseArraySlow - 1)
          • Custom script: call RemoveUnit( udg_Dummy4LPulseSlow[udg_Dummy4LPulseArraySlow] )
      • Custom script: call DestroyGroup( udg_UnitLPulseGroup )
 
Level 11
Joined
Jan 25, 2009
Messages
572
No it is not. Create a point variable and store this into (Position of (Triggering unit)) and change in this action
  • Set UnitLPulseGroup = (Units within (430.00 + (20.00 x (Real(LevelOfLpulse)))) of UnitPulsePoint matching (((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
instead of
  • Set UnitLPulseGroup = (Units within (430.00 + (20.00 x (Real(LevelOfLpulse)))) of (Position of (Triggering unit)) matching (((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
  • The LP trigg
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Pulse [Electro]
    • Actions
      • Set LPPositionOfTriggUnit = (Position of (Triggering unit))
      • Set LevelOfLpulse = (Level of Lightning Pulse [Electro] for (Triggering unit))
      • Set UnitLPulseGroup = (Units within (430.00 + (20.00 x (Real(LevelOfLpulse)))) of LPPositionOfTriggUnit matching (((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
      • Unit Group - Pick every unit in UnitLPulseGroup and do (Actions)
        • Loop - Actions
          • Set Dummy4LPulseArrayLightning = (Dummy4LPulseArrayLightning + 1)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at LPPositionOfTriggUnit facing Default building facing degrees
          • Set Dummy4LPulseLightning[Dummy4LPulseArrayLightning] = (Last created unit)
          • Unit - Add Lightning Pulse 4 dummy to Dummy4LPulseLightning[Dummy4LPulseArrayLightning]
          • Unit - Add a 1.00 second Generic expiration timer to Dummy4LPulseLightning[Dummy4LPulseArrayLightning]
          • Unit - Set level of Lightning Pulse 4 dummy for Dummy4LPulseLightning[Dummy4LPulseArrayLightning] to LevelOfLpulse
          • Unit - Order Dummy4LPulseLightning[Dummy4LPulseArrayLightning] to Orc Far Seer - Chain Lightning (Picked unit)
          • Set Dummy4LPulseArrayLightning = (Dummy4LPulseArrayLightning - 1)
          • Custom script: call RemoveUnit( udg_Dummy4LPulseLightning[udg_Dummy4LPulseArrayLightning] )
      • Unit Group - Pick every unit in UnitLPulseGroup and do (Actions)
        • Loop - Actions
          • Set Dummy4LPulseArraySlow = (Dummy4LPulseArraySlow + 1)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at LPPositionOfTriggUnit facing Default building facing degrees
          • Set Dummy4LPulseSlow[Dummy4LPulseArraySlow] = (Last created unit)
          • Unit - Add slow 4 LP dummy to Dummy4LPulseSlow[Dummy4LPulseArraySlow]
          • Unit - Add a 1.00 second Generic expiration timer to Dummy4LPulseSlow[Dummy4LPulseArraySlow]
          • Unit - Set level of slow 4 LP dummy for Dummy4LPulseSlow[Dummy4LPulseArraySlow] to LevelOfLpulse
          • Unit - Order Dummy4LPulseSlow[Dummy4LPulseArraySlow] to Human Sorceress - Slow (Picked unit)
          • Set Dummy4LPulseArraySlow = (Dummy4LPulseArraySlow - 1)
          • Custom script: call RemoveUnit( udg_Dummy4LPulseSlow[udg_Dummy4LPulseArraySlow] )
      • Custom script: call RemoveLocation( udg_LPPositionOfTriggUnit )
      • Custom script: call DestroyGroup( udg_UnitLPulseGroup )
When i cast my spell 2 times - on the 3-rd time - my game crashes again... i think that i have more leaks, but where?
 
Level 11
Joined
Jan 25, 2009
Messages
572
I dont get why you're executing a unit group twice? If that's needed you should do this:

  • For each (Integer A) from 1 to 2, do (Actions)
    • Loop - Actions
      • Unit Group - Pick every unit in UnitLPulseGroup and do (Actions)
        • Loop - Actions
          • Set Dummy4LPulseArraySlow = (Dummy4LPulseArraySlow + 1)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at LPPositionOfTriggUnit facing Default building facing degrees
          • Set Dummy4LPulseSlow[Dummy4LPulseArraySlow] = (Last created unit)
          • Unit - Add slow 4 LP dummy to Dummy4LPulseSlow[Dummy4LPulseArraySlow]
          • Unit - Add a 1.00 second Generic expiration timer to Dummy4LPulseSlow[Dummy4LPulseArraySlow]
          • Unit - Set level of slow 4 LP dummy for Dummy4LPulseSlow[Dummy4LPulseArraySlow] to LevelOfLpulse
          • Unit - Order Dummy4LPulseSlow[Dummy4LPulseArraySlow] to Human Sorceress - Slow (Picked unit)
          • Set Dummy4LPulseArraySlow = (Dummy4LPulseArraySlow - 1)
          • Custom script: call RemoveUnit( udg_Dummy4LPulseSlow[udg_Dummy4LPulseArraySlow] )
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
There are no more leaks, do you even know what leaks do? They certainly don't crash games that easily.
What do you know about leaks? Because you're also removing the dummy unit, and with a custom script... There's a GUI-action called "remove unit", but you rather use custom scripts? That's stupid.
Also, do not remove the dummy unit. The generic timer should be more than enough.

Why is " Dummy4LPulseLightning" arrayed? Do you know how the unit group action works? Because there's absolutely no need for "Dummy4LPulseArrayLightning", and you can make the unit variable a regular one (instead of arrayed).

It goes like this:

Unit group actions
- set integer = integer + 1
- set unit[integer] = last created unit
- set integer = integer - 1

- set integer = integer + 1
- set unit[integer] = last created unit
- set integer = integer - 1


Repeat this for all units in the group.
As you can see, you only ever use the 1st array (as "integer" will always be 1). The array is rendered useless.


  • The LP trigg
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Pulse [Electro]
    • Actions
      • Set tempLoc = (Position of (Triggering unit))
      • Set tempIntLevel = (Level of Lightning Pulse [Electro] for (Triggering unit))
      • Set tempGroup = (Units within (430.00 + (20.00 x (Real(tempIntLevel)))) of tempLoc matching (((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at tempLoc facing 0.00 degrees
          • Set tempDummy = (Last created unit)
          • Unit - Add Lightning Pulse 4 dummy to tempDummy
          • Unit - Set level of Lightning Pulse 4 dummy for tempDummy to tempIntLevel
          • Unit - Add a 1.00 second Generic expiration timer to tempDummy
          • Unit - Order tempDummy to Orc Far Seer - Chain Lightning (Picked unit)
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at tempLoc facing 0.00 degrees
          • Set tempDummy = (Last created unit)
          • Unit - Add slow 4 LP dummy to tempDummy
          • Unit - Set level of slow 4 LP dummy for tempDummy to tempIntLevel
          • Unit - Add a 1.00 second Generic expiration timer to tempDummy
          • Unit - Order tempDummy to Human Sorceress - Slow (Picked unit)
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Custom script: call DestroyGroup(udg_tempGroup)
Variables:
  • tempLoc (point)
  • tempGroup (unit group)
  • tempIntLevel (integer)
  • tempDummy (unit)

This is an improved trigger, if it still crashes: it's got to do with something else.
 
Level 11
Joined
Jan 25, 2009
Messages
572
I've solved the problem. The changes I've made was to remove the spaces in the Custom Scripts when you removed a leak.
Before:
  • Custom script: call RemoveLocation ( udg_LPPositionOfTriggUnit )
  • Custom script: call DestroyGroup ( udg_UnitLPulseGroup )
After:
  • Custom script: call RemoveLocation (udg_LPPositionOfTriggUnit)
  • Custom script: call DestroyGroup (udg_UnitLPulseGroup)
Do this for the rest of you'r spells. I've attached the spell here.

View attachment The Rising Of The Biggest War!.w3x
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I'll be frank: JASS doesn't care about spacing, tjordell.
That cannot be, and thus is not the solution.

And if it was the solution, then explain why GUI always adds those spaces, and why it never crashes.
Here are a few GUI scripts:
JASS:
set gg_trg_The_trigg_LS = CreateTrigger(  )
// [...]
if ( not ( GetSpellAbilityId() == 'A00C' ) ) then
// [...]
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
Can't you see? Those are all spaces! But they cannot be removed in GUI, that's because removing them doesn't matter. It won't solve anything.

This:
JASS:
call RemoveLocation      (                 udg_tempLoc                        )
Works just as good as:
JASS:
call RemoveLocation(udg_tempLoc)
Believe me, I know :D


There is something else different about your trigger and CoLd_Bon's trigger.

  • Set UnitLPulseGroup = (Units within (430.00 + (20.00 x (Real(LevelOfLpulse)))) of LPPositionOfTriggUnit matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
  • Set UnitLPulseGroup = (Units within (430.00 + (20.00 x (Real(LevelOfLpulse)))) of LPPositionOfTriggUnit matching (((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
See?
The one with "Picked unit" is wrong, and will create a lot more lag (because it picks ALL units in range, not only the enemy units).
THAT was the cause of the crash, not the spacing. You shouldn't be so quick to proclaim your judgement.


Just straightening your story, some people might actually believe it (while it's complete rubbish).

Moral of the story: everyone can just use spacing when using Custom scripts, it doesn't matter. I prefer no spacing because it's faster to type, that's all.
 
Level 11
Joined
Jan 25, 2009
Messages
572
That should not be it. If you have done MUI and the code is fairly well, you should be able to cast the spell as many times as you want without any crash (Unless the spell has lots of SFX but you'rs doesn't). I experienced some lags when using you'r spells. Try to look through all the spells one more time and see that everything is like it should be.
 
Status
Not open for further replies.
Top