• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Spell causing lag

Status
Not open for further replies.
Level 3
Joined
Sep 26, 2012
Messages
39
I am aware that it's leaking groups, yet if I cast this spell 20 times, I can already notice a framerate reduction. It cant be group leakage can it?

I'm pretty new at this triggering thing still, please point out my mistakes and possibly what's making this thing lag.


  • Scalper
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Scalper
    • Actions
      • Set ScalperCaster = (Triggering unit)
      • Set ScalperAngle = (Angle from (Position of ScalperCaster) to (Target point of ability being cast))
      • Set ScalperCasterLoc = (Position of ScalperCaster)
      • Unit - Create 1 Dummy Scalper for (Owner of ScalperCaster) at ScalperCasterLoc facing ScalperAngle degrees
      • Set ScalperDummy = (Last created unit)
      • Custom script: call RemoveLocation (udg_ScalperCasterLoc)
      • Trigger - Turn on Scalper Loop <gen>
  • Scalper Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set ScalperCount = (ScalperCount + 1)
      • Set ScalperDummyLoc = (Position of ScalperDummy)
      • Unit - Move ScalperDummy instantly to (ScalperDummyLoc offset by 15.00 towards ScalperAngle degrees), facing ScalperAngle degrees
      • Unit Group - Pick every unit in (Units within 120.00 of ScalperDummyLoc matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of S and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to ScalperDamageGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in ScalperDamageGroup) Greater than or equal to 1
        • Then - Actions
          • Set ScalperCount = 0
          • Set ScalperPickedTarget = (Random unit from ScalperDamageGroup)
          • Special Effect - Create a special effect attached to the chest of ScalperPickedTarget using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Remove all units from ScalperDamageGroup
          • Unit - Cause ScalperDummy to damage ScalperPickedTarget, dealing (30.00 + (30.00 x (Real((Level of Scalper for ScalperCaster))))) damage of attack type Spells and damage type Lightning
          • Unit - Kill ScalperDummy
          • Unit - Create 1 Dummy Blank No Vision for (Owner of ScalperCaster) at ScalperDummyLoc facing ScalperDummyLoc
          • Set ScalperDoTDummy = (Last created unit)
          • Unit - Add a 6.00 second Generic expiration timer to ScalperDoTDummy
          • Trigger - Turn on Scalper DoT <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ScalperCount Greater than or equal to 100
        • Then - Actions
          • Set ScalperCount = 0
          • Unit - Kill ScalperDummy
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_ScalperDummyLoc)
  • Scalper DoT
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set ScalperDoTCount = (ScalperDoTCount + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ScalperPickedTarget is alive) Equal to True
        • Then - Actions
          • Special Effect - Create a special effect attached to the chest of ScalperPickedTarget using Objects\Spawnmodels\Human\HumanBlood\HumanBloodPriest.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause ScalperDoTDummy to damage ScalperPickedTarget, dealing (0.60 x (Real((Level of Scalper for ScalperCaster)))) damage of attack type Spells and damage type Lightning
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ScalperDoTCount Equal to 50
        • Then - Actions
          • Set ScalperDoTCount = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Last edited by a moderator:
Level 3
Joined
Sep 26, 2012
Messages
39
The loc leak on the cast trigger is (target point of ability being cast)? Finally, I am failing to spot the leak on the loop trigger. I went through this leak guide.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Do be aware that units that are removed (from death or otherwise) are not automaticly removed from groups.

You also leak units every cast. This is an engine bug so no fix is directly possible. Try recycling the same dummy units instead of making new ones to avoid these leaks as that is the best one can do.
 
Level 3
Joined
Sep 26, 2012
Messages
39
Thanks for your answers guys! So you mean, create the dummy once on map init or something and then just use that dummy on every casts and never destroy it?
 
Level 3
Joined
Sep 26, 2012
Messages
39
Yeah that's been fixed, sorry I forgot to write that topic was solved. Thank you for your answer though!
 
Status
Not open for further replies.
Top