• 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.

Leak or Lag?

Status
Not open for further replies.

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
The map I'm currently working on doesn't work properly. I've made a custom attack system: Player presses Attack-Button and unit attacks into facing direction. If too many projectiles are flying at the same time, the game nearly freezes and it takes a few seconds until everything normalizes. So I upload the map here an I would be glad if anyone could tell me if just my PC is too crappy to manage this or there are leaks somewhere. (About unefficiency: I know there's much of this in there, perhaps I'll take it out later if it disturbs the game.)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
*Don't use an array for temppt.
*Change flying hate at rate of 0. That is instant.
*Set Key(Last Created Unit) into a variable, and use the variable:
  • Custom script: set udg_ID = GetHandleId(bj_lastCreatedUnit)
  • Hashtable - Save 2 as ID of _Hash_AttackType in MainHash
  • ...
^Must have an integer variable called ID created in the variable editor. You can name it anything you like ofcourse.
Don't check all the unit types. For example if the triggering unit is NE Archer, you still check for the other unit types.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Triggering unit)) Equal to Orc - Shaman
    • Then - Actions
      • Set tempPt1 = (Position of (Triggering unit))
      • Set tempPt2 = (tempPt1 offset by 60.00 towards (Facing of (Triggering unit)) degrees)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 80.00 of tempPt2 matching (((Matching unit) Not equal to (Triggering unit)) and (((Matching unit) is alive) Equal to True))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Dummy
                  • (Unit-type of (Picked unit)) Equal to Dummy (Shaman/Secondary)
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Circle of Power
                • Then - Actions
                • Else - Actions
                  • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 120.00 damage of attack type Normal and damage type Normal
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using BloodElementalMisile.mdx
                  • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation ( udg_tempPt1 )
      • Custom script: call RemoveLocation ( udg_tempPt2 )
    • Else - Actions



MainLoop trigger:
Don't create/destroy the group all the time. Never destroy it. When you create a unit, add it to the group. When it dies, remove it from the group. Don't use an array for the group.
Don't use an array for the point variables.
Set Key(Picked Unit) into a variable.
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
Thanks for your reply! Ok, I got most of what you wrote and it seems to help me pretty much (thanks again). But what I really don't understand is the array-thing. Why should it be better to have 56 standard variables than 4-5 arrays?
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
But if I don't use arrays I'll need many standard variables, or am I wrong? (56 was just some random number and a bit too high I admit; btw still don't understand why exactly not to use arrays but ok)
 
Last edited:
Level 8
Joined
Dec 9, 2009
Messages
397
He said don't use array for "TempPoint" You use temp point, then clean the leak, set temp point to something else, use the same variable.

If your not going need that same TempPoint again in your trigger, it doesn't need to be a different variable.
 

nGy

nGy

Level 11
Joined
Apr 15, 2011
Messages
123
Sure but in the case maker mentioned up there, he used two different point variables, one for the unit position and one for the point with offset. So it seems to me that he refuses arrays in general. But anyway I think I discovered the main problem: The manual creation of too many units makes the game freeze. I tested with a summon ability and I'm not sure yet but I think it works much better. Only problem is I cannot order units to cast Phoenix-spell per trigger.

Edit: Managed to do it with "summon waterelemental" but unfortunately doesn't cure the lag. I'll just finish the development of the game and see if it works ok.
 
Last edited:
Status
Not open for further replies.
Top