- Joined
- May 8, 2010
- Messages
- 150
why are you getting involved lol :S?
call DestroyGroup(udg_Group)
Why doesnt this not work..
"call RemoveLocation(udg_KniveTrapLoc[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]"
call RemoveLocation(udg_KniveTrapLoc[GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1])
Moin moin =)
Btw "GetConvertedPlayerId" is a BJ and have to be fixed like this:
JASS:call RemoveLocation(udg_KniveTrapLoc[GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1])
Greetings
~ The Bomb King > Dr. Boom
so...
do "set Caster = Casting unit"
Create - 1 Unit at (Position of 'Caster') facing random angle
will it leak?...
I still don't get what the big problem with leaking is. How long must a game be for leaks to cause any kind of lag? 3 hours?
This of course depends on the amount of triggers that leak, but I really don't see the problem.
yeah ok that works... but not on point variables with arrays... what about them.. when i create a point (array) variable and i try to destroy it with that custom script it doesnt work.. what about that
Custom script: call RemoveLocation (udg_Temp_Point)
?
library ClearItems initializer init requires TypeConverter
globals
private hashtable ItemHash
// Time for the item's death animation, optimized for tomes and runes.
private constant real DEATH_TIME = 1.5
endglobals
private function DeleteItem takes nothing returns nothing
local timer tim = GetExpiredTimer()
call SetWidgetLife(LoadItemHandle(ItemHash,GetHandleId(tim),0),1)
call RemoveItem(LoadItemHandle(ItemHash,GetHandleId(tim),0))
call DestroyTimer(tim)
set tim = null
endfunction
private function Clean takes nothing returns boolean
local timer tim = CreateTimer()
call SaveItemHandle(ItemHash,GetHandleId(tim),0,WidgetToItem(GetTriggerWidget()))
call TimerStart(tim,DEATH_TIME,false,function DeleteItem)
call DestroyTrigger(GetTriggeringTrigger())
set tim=null
return false
endfunction
function CreateItem2 takes integer itemId,real x,real y returns item
local trigger trig
local item it=CreateItem(itemId,x,y)
if it != null then // If the item isn't created, it's not necessary to create a trigger
set trig=CreateTrigger()
// Triggers when a powerup is picked and when any item is attacked to death. Does not trigger when an item is pawned.
call TriggerRegisterDeathEvent(trig,it)
call TriggerAddCondition(trig,Condition(function Clean))
call SaveTriggerHandle(ItemHash,GetHandleId(it),0,trig)
set trig = null
endif
return it
endfunction
private function RegisterItemOnBuy takes nothing returns boolean
local trigger trig = CreateTrigger()
call TriggerRegisterDeathEvent(trig,GetSoldItem())
call TriggerAddCondition(trig,Condition(function Clean))
call SaveTriggerHandle(ItemHash,GetHandleId(GetSoldItem()),0,trig)
set trig = null
return false
endfunction
private function CleanCleaningTrigger takes nothing returns boolean
local trigger trig = LoadTriggerHandle(ItemHash,GetHandleId(GetManipulatedItem()),0)
if trig != null then
call DestroyTrigger(trig)
set trig=null
endif
return false
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SELL_ITEM)
call TriggerAddCondition(trig,Condition(function RegisterItemOnBuy))
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_PAWN_ITEM)
call TriggerAddCondition(trig,Condition(function CleanCleaningTrigger))
set ItemHash = InitHashtable()
endfunction
endlibrary
native EnumItemsInRect takes rect r, boolexpr filter, code actionFunc returns nothing
private function Clean takes nothing returns boolean
local timer tim = CreateTimer()
call SaveItemHandle(ItemHash,GetHandleId(tim),0,WidgetToItem(GetTriggerWidget()))
call TimerStart(tim,DEATH_TIME,false,function DeleteItem)
call DestroyTrigger(GetTriggeringTrigger())
// set tim = null --> You're not allowing any of these timer handle IDs to be recycled.
return false
endfunction
function CreateItem2 takes integer itemId,real x,real y returns item
local trigger trig
local item it=CreateItem(itemId,x,y)
if it != null then // If the item isn't created, it's not necessary to create a trigger
set trig=CreateTrigger()
// Triggers when a powerup is picked and when any item is attacked to death. Does not trigger when an item is pawned.
call TriggerRegisterDeathEvent(trig,it)
call TriggerAddCondition(trig,Condition(function Clean))
call SaveTriggerHandle(ItemHash,GetHandleId(it),0,trig)
set trig = null
// set it = null -->You're not allowing these created items to recycle properly either.
endif
return it
endfunction
Sounds
Also sounds leak, they should be destroyed like this:
Sound
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Some Spell
Actions
Sound - Play (Some Sound)
Sound - Destroy (Last played sound)
If I do this:Is the Location destroyed forever, or can it be used over and over?
Custom script: call RemoveLocation(udg_Point)
I have units that gets created somewhere, and then is ordered to attack-move to Point. This action repeats itself over and over.
When you open wc3, it consumes 128-256GB of RAM straight away.
When you create a unit, wc3 consumes a bit more RAM because there are more things happening in the game. When you create a thousand units, you notice lag, and your RAM is close to 300-400GB at that point most likely.