Voir le sujet précédent :: Voir le sujet suivant |
Auteur |
Message |
NoBreak2004 Ptit Nouveau

Inscrit le: 21 Aoû 2007 Messages: 29 Sujets: 3
|
Posté le: 28/08/07 23:01 Sujet du message: Problème de fuite de mémoire. |
|
|
Bonjour, (ou plutôt bonsoir mais bon )
J'ai un déclencheur tels que celui-ci :
Jass: |
function Trig_Plains_Func008C takes nothing returns boolean
if ( ( GetUnitTypeId(GetDyingUnit()) == 'u002' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetDyingUnit()) == 'u001' ) ) then
return true
endif
if ( ( GetUnitTypeId(GetDyingUnit()) == 'u003' ) ) then
return true
endif
return false
endfunction
function Trig_Plains_Conditions takes nothing returns boolean
if ( not Trig_Plains_Func008C() ) then
return false
endif
return true
endfunction
function Trig_Plains_Func004A takes nothing returns nothing
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl" )
endfunction
function Trig_Plains_Actions takes nothing returns nothing
local effect tempeffect
call AddSpecialEffectTargetUnitBJ( "origin", GetDyingUnit(), "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl" )
set tempeffect=(GetLastCreatedEffectBJ())
call ForGroupBJ( GetUnitsOfPlayerAll(GetOwningPlayer(GetKillingUnitBJ())), function Trig_Plains_Func004A )
call TriggerSleepAction( 2 )
call RemoveUnit( GetDyingUnit() )
call DestroyEffectBJ( tempeffect )
endfunction
//===========================================================================
function InitTrig_Plains takes nothing returns nothing
set gg_trg_Plains = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Plains, Player(11), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Plains, Condition( function Trig_Plains_Conditions ) )
call TriggerAddAction( gg_trg_Plains, function Trig_Plains_Actions )
endfunction
|
Et j'aimerais diminuer au maximum les fuites de mémoires.
Comme vous le voyer j'ai déjà réussi à supprimer le premier effet, quand au deuxième, je ne sais point comment m'y prendre.
Pourriez-vous m'aider ?
Merci d'avance. _________________
Dernière édition par NoBreak2004 le 09/09/07 13:49; édité 3 fois |
|
Revenir en haut |
|
 |
profet Instanton Gravitationnel Singulier

Inscrit le: 21 Aoû 2007 Messages: 1633 Sujets: 53 Spécialité en worldedit: Pain d'épice multitâche (terrain, scripts, textures, modèles...) Médailles: 2 (En savoir plus...)
|
Posté le: 29/08/07 00:33 Sujet du message: |
|
|
Salut
Pour tes 2 fonctions de conditions, rien à faire
Sinon pour ta dernière fonction tu peux faire :
Jass: |
function Trig_Plains_Actions takes nothing returns nothing
local effect tempeffect = AddSpecialEffectTargetUnitBJ( "origin", GetDyingUnit(), "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl" )
local group G = GetUnitsOfPlayerAll(GetOwningPlayer(GetKillingUnitBJ()))
call ForGroup( G, function Trig_Plains_Func004A )
call DestroyGroup( G )
call TriggerSleepAction( 2 )
call RemoveUnit( GetDyingUnit() )
call DestroyEffect( tempeffect )
set G = null
set tempeffect = null
endfunction |
Pour l'autre effet, c'est assez compliqué étant donné qu'il est dans un ForGroup, si tu utilises le newgenpack de wc3c tu peux utiliser la propriété .execute() ce qui donnerait :
Jass: |
function DelayedDestroyEffect takes effect E returns nothing
call PolledWait(2.)
call DestroyEffect( E )
set E = null
endfunction
function Trig_Plains_Func004A takes nothing returns nothing
call DelayedDestroyEffect.execute( AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl" ) )
endfunction
|
_________________
Bêta Systems: 70%
Bêta Spells: 13%
Bêta Arts & graphics: 70% |
|
Revenir en haut |
|
 |
NoBreak2004 Ptit Nouveau

Inscrit le: 21 Aoû 2007 Messages: 29 Sujets: 3
|
Posté le: 29/08/07 10:15 Sujet du message: |
|
|
Merci cela marche très bien.
Par contre j'ai une autre question.
Est-ce que dans ma fonction d'origine :
Jass: |
function Trig_Plains_Actions takes nothing returns nothing
local effect tempeffect
call AddSpecialEffectTargetUnitBJ( "origin", GetDyingUnit(), "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl" )
set tempeffect=(GetLastCreatedEffectBJ())
call ForGroupBJ( GetUnitsOfPlayerAll(GetOwningPlayer(GetKillingUnitBJ())), function Trig_Plains_Func004A )
call TriggerSleepAction( 2 )
call RemoveUnit( GetDyingUnit() )
call DestroyEffectBJ( tempeffect )
endfunction
|
Le premier effet (ci-dessous) est-il supprimé et donc ne créé pas une fuite de mémoire?
Jass: |
call AddSpecialEffectTargetUnitBJ( "origin", GetDyingUnit(), "Objects\\Spawnmodels\\NightElf\\NEDeathMedium\\NEDeath.mdl" )
|
_________________
|
|
Revenir en haut |
|
 |
Bantas Anomalie floodiforme

Inscrit le: 21 Aoû 2007 Messages: 1524 Sujets: 37
Médailles: 1 (En savoir plus...)
|
Posté le: 29/08/07 10:57 Sujet du message: |
|
|
Et bien oui, il est détruit avec DestroyEffectBJ. D'ailleurs tu peux retirer le BJ. _________________
|
|
Revenir en haut |
|
 |
NoBreak2004 Ptit Nouveau

Inscrit le: 21 Aoû 2007 Messages: 29 Sujets: 3
|
Posté le: 29/08/07 11:05 Sujet du message: |
|
|
D'accord,
Et un grand merci à tous ! _________________
|
|
Revenir en haut |
|
 |
|