• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Gay FPS drop

Status
Not open for further replies.
1) You have the loop trigger turned on forever, and runs every 0.02 seconds, after the first shot. You need a condition to turn it off afterwards.

2) Regions leak. You don't need a region in your case, just pick units in range, instead of creating a whole new region every 0.02 seconds. Regions' leak is cleared with "call RemoveRect (udg_RegionVariable)".

3) When you want 1 random unit from a unit group, you can use a Unit variable, you don't need a Unit Group one.

4) Use one Point variable with Array, instead of creating one variable for every point you are going to use (didn't fix this in your map, it's just a suggestion).

Fixed; here:
  • Shotgun shoot
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack (Shotgun)
    • Actions
      • -------- Set variables --------
      • Set Point1 = (Position of (Triggering unit))
      • Set Point2 = (Point1 offset by 20.00 towards (Facing of (Triggering unit)) degrees)
      • Set Point3 = (Target point of ability being cast)
      • -------- Set ammunition --------
      • Set Ammo_Shotgun_used[(Player number of (Owner of (Triggering unit)))] = (Ammo_Shotgun_used[(Player number of (Owner of (Triggering unit)))] + 1)
      • Set Ammo_Shotgun_cur[(Player number of (Owner of (Triggering unit)))] = (Ammo_Shotgun_cur[(Player number of (Owner of (Triggering unit)))] - 1)
      • Player - Set (Owner of (Triggering unit)) Food used to Ammo_Shotgun_cur[(Player number of (Owner of (Triggering unit)))]
      • -------- Create bullet 1 - Mid --------
      • Unit - Create 1 Bullet Shotgun for (Owner of (Triggering unit)) at Point2 facing (Angle from Point2 to Point3) degrees
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add Crow Form to (Last created unit)
      • Unit Group - Add (Last created unit) to Bullets_Shotgun
      • Animation - Change (Last created unit) flying height to 60.00 at 0.00
      • Set Temp_Real = (Facing of (Last created unit))
      • -------- Create bullet 2 - Top --------
      • Unit - Create 1 Bullet Shotgun for (Owner of (Triggering unit)) at Point2 facing (Temp_Real + 5.00) degrees
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add Crow Form to (Last created unit)
      • Unit Group - Add (Last created unit) to Bullets_Shotgun
      • Animation - Change (Last created unit) flying height to 60.00 at 0.00
      • -------- Create bullet 3 - Bot --------
      • Unit - Create 1 Bullet Shotgun for (Owner of (Triggering unit)) at Point2 facing (Temp_Real - 5.00) degrees
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add Crow Form to (Last created unit)
      • Unit Group - Add (Last created unit) to Bullets_Shotgun
      • Animation - Change (Last created unit) flying height to 60.00 at 0.00
      • Trigger - Turn on Shotgun bullet loop <gen>
      • -------- Remove leaks --------
      • Custom script: call RemoveLocation(udg_Point1)
      • Custom script: call RemoveLocation(udg_Point2)
      • Custom script: call RemoveLocation(udg_Point3)
  • Shotgun bullet loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Bullets_Shotgun is empty) Equal to False
        • Then - Actions
          • -------- Pick all units in Bullets_Shotgun --------
          • Unit Group - Pick every unit in Bullets_Shotgun and do (Actions)
            • Loop - Actions
              • -------- Set variables and move picked bullet --------
              • Set Temp_Unit = (Picked unit)
              • Set Point1 = (Position of Temp_Unit)
              • Set Point2 = (Point1 offset by 30.00 towards (Facing of Temp_Unit) degrees)
              • Unit - Move Temp_Unit instantly to Point2
              • -------- Check for nearby enemies --------
              • Set Temp_UnitGroup = (Units within 150.00 of Temp_Point matching (((Unit-type of (Matching unit)) Not equal to Player) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Temp_UnitGroup) Greater than 0
                • Then - Actions
                  • Set WhichTarget = (Random unit from Temp_UnitGroup)
                  • -------- Pick and damage random enemy --------
                  • Unit - Cause Temp_Unit to damage WhichTarget, dealing (Random real number between 20.00 and 30.00) damage of attack type Chaos and damage type Normal
                  • Special Effect - Create a special effect attached to the chest of WhichTarget using Objects\Spawnmodels\Undead\UndeadBlood\UndeadBloodGhoul.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Kill Temp_Unit
                • Else - Actions
              • -------- Remove leaks --------
              • Custom script: call RemoveLocation(udg_Point1)
              • Custom script: call RemoveLocation(udg_Point2)
              • Custom script: call DestroyGroup(udg_Temp_UnitGroup)
        • Else - Actions
          • Trigger - Turn off (This trigger)
 

Attachments

So the only action you are performing is a couple of shots and it drops fps?
Yup.

Are you sure you opened the map I sent you (you maybe opened yours instead). It doesn't drop for me.
Twice.

On a side note, use a higher tick, e.g. 0.03 - 0.05, with a higher offset value, so that it doesn't look visually different.
But the fps stays on low even if there arent any bullets so that cant be the problem.

I hope someone else will happen to come here and download your map so we could see is it just my PC. But I can run most of games fine with all full. Example Team Fortress 2 all setting on ultra/high whatever and no drops.
 
Hm, the fps drops a bit by the time the two abilities are added, never goes back to the original (75), but restores itself from 30 to 47 and then 50 normally, so this isn't really considered as lag, it's a normal fps amount.
Anyway, I made a mistake in the second trigger, I used Temp_point in the Unit Group pick (within 150.00 range of Temp_point), when it should be "...of Point1".
 
Problem solved!

I checked every trigger again and again, but then I tried without triggers. Strange, it still lagged! So I tried to find out what was wrong with the ability data. Because the spell is based on Shockwave, and projectile speed is 0, every time when I casted the spell it created a invisible effect that never really wasnt removed...

But +rep for Pharaoh_ for helping to optimize the code and something.
 
Status
Not open for further replies.
Back
Top