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

About "evil" dumy :)

Status
Not open for further replies.
Level 5
Joined
Jan 12, 2010
Messages
132
So probably is stupid question but i have doubt.
I have a dummy with locust ability no moddel bla bla.
So I had made a loop for test
A -> 200 create a dummy add 0.5 s expiration time.
After one seconds its seem that dummy dont dissapear from game cousing lagg.
Can this be the problem?
BTW: temp point its carefully cleared.
 
Level 5
Joined
Jan 12, 2010
Messages
132
And one more question man
If a unit have colision turned off or have ghost ability, and I create 10 units at a specific point in the same point the unit colision wont interference causing problems?

EDIT: SRY FOR DOUBLE POST :((
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
A system similar to what people use for timers and groups. Instead of destroying the dummy when not needed you add them to a stack and move them somewhere out of map bounds (turn collision off). Next time you want a dummy instead of creating a new one you remove one from the stack and turn collision on. This help reduce the number of units created and so reduces the amount leaked.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
What do you mean reclycling ?

acctuakky hide unit until u need a dummy unit again, when need dummy unit just show dommy unit and set his position and do what u want with him

for keep tracking the dummy units have 2 way:

(in both way u need declare a max amount if u dont want store a billion unit :D so lets say MaxDummyUnit integer variable = 200 then we dont store more than 200 unit)

1. unit group:
-need 1 unit group variable

when u dont need anymore dummy unit, hide dummy unit and add to a unit group
-when u need dummy unit check if this unit group is empty (then create a dummy unit) else if isnt empty then pick 1 unit from group, show unit, remove from group and do action with him

so wen dont need the unit anymore then
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in DummyUnitGroup) Less than MaxDummyUnit
    • Then - Actions
      • Unit - Hide (Triggering unit)
      • Unit Group - Add (Triggering unit) to DummyUnitGroup
    • Else - Actions
      • Unit - Remove (Triggering unit) from the game
when need then

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in DummyUnitGroup) Greater than 0
    • Then - Actions
      • Unit Group - Pick every unit in DummyUnitGroup and do (Actions)
        • Loop - Actions
          • Set unit = (Picked unit)
          • Unit - Unhide ( unit)
          • Unit Group - Remove unit from DummyUnitGroup
          • Skip remaining actions
    • Else - Actions
      • -------- create unit --------
2. linked list
-need 1 integer variable (non array), 1 unit variable array

when u dont need a unit then u can do this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Dummy_Index Greater than 0
    • Then - Actions
      • Set unit = Dummy_Unit[1]
      • Set Dummy_Unit[1] = Dummy_Unit[Dummy_Index]
      • Set Dummy_Index = (Dummy_Index - 1)
      • Unit - Hide (Triggering unit)
    • Else - Actions
      • -------- create your dummy unit --------
    • Else - Actions
      • Unit - Remove (Triggering unit) from the game
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Dummy_Index Greater than 0
    • Then - Actions
      • Set unit = Dummy_Unit[1]
      • Set Dummy_Unit[1] = Dummy_Unit[Dummy_Index]
      • Set Dummy_Index = (Dummy_Index - 1)
      • Unit - Unhide ( unit)
    • Else - Actions
      • -------- create your dummy unit --------
2nd example is faster so use something like that, the reason is somewhere i readed the createunit action/function is the most slowist action, so faster just hide a unit then when needed then call him
 
Status
Not open for further replies.
Top