Worldedit
  Worldedit
Le site sur l'éditeur de warcraft 3 !
 
  FAQFAQ   RechercherRechercher   Liste des MembresListe des Membres    Groupes d'utilisateursGroupes d'utilisateurs   medals.php?sid=18bfb717587f7a006458b68c0ca1c517Médailles   S'enregistrerS'enregistrer 
 ProfilProfil   Se connecter pour vérifier ses messages privésSe connecter pour vérifier ses messages privés   ConnexionConnexion 
  FAQFAQ World Editor   UploadUploader une map ou une image    UploadAjouter sa map à l'annuaire   UploadConsulter l'annuaire

Flèche de lave bug

 
Poster un nouveau sujet   Répondre au sujet    Worldedit Index du Forum -> Les sorts
Voir le sujet précédent :: Voir le sujet suivant  
Auteur Message
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 07/08/14 21:00    Sujet du message: Flèche de lave bug Citer

Salut,
J'ai de façon aléatoire des bugs lors du cast, les cibles sortent du périmètre du groupe et donc n'ai pas prise en compte et ne subit aucun dégât et donc la structure alloué pour cette pseudo cible n'est pas recyclé.
Library :
- TimerUtils
- GroupsUtils
- TimedHandles

Secret:

Jass:
scope LavaArrows initializer Init
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                              GLOBALS CONFIG                                                       *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
globals
        private                         hashtable           ht_lava                     =   InitHashtable()
        private         constant        integer             TARGET_AMOUNT_BASE          =   3
        private         constant        integer             TARGET_AMOUNT_LEVEL         =   1
        private         constant        integer             TARGET_MAX                  =   10
       
        private         constant        real                DAMAGE_AMOUNT_BASE          =   40.00
        private         constant        real                DAMAGE_AMOUNT_LEVEL         =   10.00
       
        private         constant        real                RANGE_AMOUNT_BASE           =   128.00
        private         constant        real                RANGE_AMOUNT_LEVEL          =   0.00
       
        private         constant        integer             SPELL_ABILITY               =   'A00H'
        private         constant        integer             DUMMY_LAVA                  =   '000D'
       
       
        private         constant        attacktype          AT                          =   ATTACK_TYPE_MAGIC
        private         constant        damagetype          DT                          =   DAMAGE_TYPE_FIRE
        private         constant        weapontype          WT                          =   WEAPON_TYPE_WHOKNOWS
endglobals

    private function t_Condition takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ABILITY
    endfunction
   
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             STRUCTURE                                                             *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
private struct LavaArrows
    trigger trg
    event evnt
    boolexpr bool
    unit source
    unit target
    real level
   
    method destroy takes nothing returns nothing
        set this.evnt = null
        set this.bool = null
        call TriggerClearConditions(this.trg)
        call TriggerClearActions(this.trg)
        set this.source = null
        set this.target = null
        set this.level = 0
        call DestroyTrigger(this.trg)
        call this.deallocate()
    endmethod
   

/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             FUNCTION                                                              *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
    static method TypeDamageSource takes nothing returns boolean
        local thistype this = LoadInteger(ht_lava, GetHandleId(GetTriggerUnit()), 0)
        return GetEventDamageSource() == this.source
    endmethod
   
    static method Checkconditions takes nothing returns boolean
        local boolean b1 = IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) )
        local boolean b2 = IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND)
        local boolean b3 = IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
        local boolean b4 = IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
        local boolean b5 = IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
        if  b1 == TRUE and  b4 == FALSE and GetUnitAbilityLevel( GetFilterUnit(), 'Avul') < 1 and ( b2 == TRUE or b3 == TRUE ) and b5 == FALSE  then
            return TRUE
        endif
        return FALSE
    endmethod
   
    static method Damage takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId(GetTriggerUnit()), 0)
        call DisableTrigger(GetTriggeringTrigger())
        call UnitDamageTarget(this.source, this.target, DAMAGE_AMOUNT_BASE + ( DAMAGE_AMOUNT_LEVEL * this.level), FALSE, FALSE, AT, DT, WT)
        call FlushChildHashtable( ht_lava, GetHandleId(GetTriggerUnit()))
       
            call DebugMsg(" Fin : " + I2S(this))
        call this.destroy()
    endmethod
   
    static method Start takes nothing returns nothing
        local thistype array this
        local group g = NewGroup()
        local integer i = 0
        local integer level = GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ABILITY)
        local unit u = GetSpellTargetUnit()
        local unit rd
        call GroupEnumUnitsInArea( g, GetUnitX(u), GetUnitY(u), RANGE_AMOUNT_BASE + ( RANGE_AMOUNT_LEVEL * level), Condition( function thistype.Checkconditions ) )
        loop
            exitwhen  i >= TARGET_MAX or i == ( TARGET_AMOUNT_BASE + ( TARGET_AMOUNT_LEVEL * level) )
            set this[i] = thistype.create()
            call DebugMsg(" Début : " + I2S(this[i]))
            set this[i].trg = CreateTrigger()
            if  i == 0  then
                set rd = u
            else
                set rd = FirstOfGroup(g)
            endif
            set this[i].bool = Condition(function thistype.TypeDamageSource)
            call TriggerAddCondition( this[i].trg, this[i].bool)
            call TriggerAddAction( this[i].trg, function thistype.Damage)
            set this[i].evnt = TriggerRegisterUnitEvent( this[i].trg, rd, EVENT_UNIT_DAMAGED)
            set this[i].source = CreateUnit(GetOwningPlayer(GetTriggerUnit()), DUMMY_LAVA, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.00)
            call RemoveUnitTimed( this[i].source, 2.0)
            set this[i].target = rd
            set this[i].level = level
            call IssueTargetOrder( this[i].source, "attack", rd)
            call SaveInteger( ht_lava, GetHandleId(this[i].target), 0, this[i])
            call GroupRemoveUnit(g, rd)
            //set rd = null
            set i = i + 1
        endloop
        call ReleaseGroup(g)
        set u = null
        set g = null
    endmethod


endstruct
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             TRIGGER                                                               *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
   
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition( t, function t_Condition)
        call TriggerAddAction( t, function LavaArrows.Start)
    endfunction

endscope



PS : J'ai remarqué que sur hiveworkshop après l'appel d'un destructeur ( location/group/...), ils assignent null à la variable. Pourquoi?
_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 09/08/14 11:50    Sujet du message: Citer

Résolu, car le pop continuer même si il n'y avait plus d'unité dans le groupe

Edit : finalement, ce n'est pas résolu :/, ça l'est à moitié et j'ai toujours le même bug.
_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 Ectelion
Membre reconnu


Inscrit le: 12 Nov 2011
Messages: 1062
Sujets: 107
Spécialité en worldedit: Inactif(Enfin presque)
Médailles: 1 (En savoir plus...)
Créateur d'unité (Quantité : 1)

MessagePosté le: 09/08/14 14:11    Sujet du message: Citer

T'as essayé de mettre un léger temps d'attente (genre 0.02s) entre l'assignation dans le groupe et les autres actions ? (comme ça elles seraient à coup sûr dans le groupe avant qu'il ne se passe quelque chose susceptible de les faire partir.

Content de voir que t'es passé aux methods Laughing
_________________
Inactif(Enfn presque)
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 09/08/14 15:07    Sujet du message: Citer

Toujours pas :/

Secret:

Jass:
scope LavaArrows initializer Init
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                              GLOBALS CONFIG                                                       *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
globals
        private                         hashtable           ht_lava                     =   InitHashtable()
        private         constant        integer             TARGET_AMOUNT_BASE          =   3
        private         constant        integer             TARGET_AMOUNT_LEVEL         =   1
        private         constant        integer             TARGET_MAX                  =   10
       
        private         constant        real                DAMAGE_AMOUNT_BASE          =   40.00
        private         constant        real                DAMAGE_AMOUNT_LEVEL         =   10.00
       
        private         constant        real                RANGE_AMOUNT_BASE           =   128.00
        private         constant        real                RANGE_AMOUNT_LEVEL          =   0.00
       
        private         constant        integer             SPELL_ABILITY               =   'A00H'
        private         constant        integer             DUMMY_LAVA                  =   '000D'
       
       
        private         constant        attacktype          AT                          =   ATTACK_TYPE_MAGIC
        private         constant        damagetype          DT                          =   DAMAGE_TYPE_FIRE
        private         constant        weapontype          WT                          =   WEAPON_TYPE_WHOKNOWS
endglobals

    private function t_Condition takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ABILITY
    endfunction
   
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             STRUCTURE                                                             *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
private struct LavaArrows
    trigger trg
    event evnt
    boolexpr bool
    unit source
    unit target
    real level
   
    method destroy takes nothing returns nothing
        set this.evnt = null
        set this.bool = null
        call TriggerClearConditions(this.trg)
        call TriggerClearActions(this.trg)
        set this.source = null
        set this.target = null
        set this.level = 0
        call DestroyTrigger(this.trg)
        call this.deallocate()
    endmethod
   

/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             FUNCTION                                                              *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
    static method TypeDamageSource takes nothing returns boolean
        local thistype this = LoadInteger(ht_lava, GetHandleId(GetTriggerUnit()), 0)
        return GetEventDamageSource() == this.source
    endmethod
   
    static method Checkconditions takes nothing returns boolean
        local boolean b1 = IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) )
        local boolean b2 = IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND)
        local boolean b3 = IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
        local boolean b4 = IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
        local boolean b5 = IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
        if  b1 == TRUE and  b4 == FALSE and GetUnitAbilityLevel( GetFilterUnit(), 'Avul') < 1 and ( b2 == TRUE or b3 == TRUE ) and b5 == FALSE  then
            return TRUE
        endif
        return FALSE
    endmethod
   
    static method Damage takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId(GetTriggerUnit()), 0)
        call DisableTrigger(GetTriggeringTrigger())
        call UnitDamageTarget(this.source, this.target, DAMAGE_AMOUNT_BASE + ( DAMAGE_AMOUNT_LEVEL * this.level), FALSE, FALSE, AT, DT, WT)
        call FlushChildHashtable( ht_lava, GetHandleId(GetTriggerUnit()))
       
            call DebugMsg(" Fin : " + I2S(this))
        call this.destroy()
    endmethod
   
    static method Start takes nothing returns nothing
        local thistype array this
        local group g = NewGroup()
        local integer i = 0
        local integer level = GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ABILITY)
        local unit u = GetSpellTargetUnit()
        local unit rd
        call TriggerSleepAction( 0.15)
        call GroupEnumUnitsInArea( g, GetUnitX(u), GetUnitY(u), RANGE_AMOUNT_BASE + ( RANGE_AMOUNT_LEVEL * level), Condition( function thistype.Checkconditions ) )
        call TriggerSleepAction( 0.15)
        loop
            exitwhen  i >= TARGET_MAX or i == ( TARGET_AMOUNT_BASE + ( TARGET_AMOUNT_LEVEL * level) ) or FirstOfGroup(g) == null
           
            if  i == 0  then
                set rd = u
            else
                set rd = FirstOfGroup(g)
            endif
            set this[i] = thistype.create()
            set this[i].trg = CreateTrigger()
            call DebugMsg(" Début : " + I2S(this[i]) + "     Target : " + I2S(GetHandleId(rd)))
            set this[i].bool = Condition(function thistype.TypeDamageSource)
            call TriggerAddCondition( this[i].trg, this[i].bool)
            call TriggerAddAction( this[i].trg, function thistype.Damage)
            set this[i].evnt = TriggerRegisterUnitEvent( this[i].trg, rd, EVENT_UNIT_DAMAGED)
            set this[i].source = CreateUnit(GetOwningPlayer(GetTriggerUnit()), DUMMY_LAVA, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.00)
            call RemoveUnitTimed( this[i].source, 2.0)
            set this[i].target = rd
            set this[i].level = level
            call IssueTargetOrder( this[i].source, "attack", rd)
            call SaveInteger( ht_lava, GetHandleId(this[i].target), 0, this[i])
            call GroupRemoveUnit(g, rd)
            //set rd = null
            set i = i + 1
        endloop
        call ReleaseGroup(g)
        set u = null
        set g = null
    endmethod


endstruct
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             TRIGGER                                                               *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
   
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition( t, function t_Condition)
        call TriggerAddAction( t, function LavaArrows.Start)
    endfunction

endscope



Note : J'utilise FirstOfGroup car GroupPickRandomUnit n'est pas MUI et on se retrouve avec les même cibles si le sort est lancé plusieurs fois en même temps.
_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 Sapeur-Goblin
Floodeur prématuré


Inscrit le: 14 Oct 2009
Messages: 719
Sujets: 40
Spécialité en worldedit: Les bugs
Médailles: 1 (En savoir plus...)
Créateur d'unité (Quantité : 1)

MessagePosté le: 09/08/14 18:16    Sujet du message: Citer

Si tu lances le sort deux fois d'affilé sur la même unité, la ligne 'call SaveInteger( ht_lava, GetHandleId(this[i].target), 0, this[i])' supprimera l'ancienne instance de la table. Donc elle sera perdue et jamais détruite.

Il serait plus judicieux d'utiliser l'identifiant du déclencheur créé dans la méthode create qui sera différent à chaque appel.
_________________
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 23/08/14 10:28    Sujet du message: Citer

Plop,
Le problème est finalement toujours d'actualité, aléatoirement des cibles ne sont pas prises en compte cette fois.
Secret:


Jass:
scope LavaArrows initializer Init
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                              GLOBALS CONFIG                                                       *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
globals
        private                         hashtable           ht_lava                     =   InitHashtable()
        private         constant        integer             TARGET_AMOUNT_BASE          =   3
        private         constant        integer             TARGET_AMOUNT_LEVEL         =   1
        private         constant        integer             TARGET_MAX                  =   10
       
        private         constant        real                DAMAGE_AMOUNT_BASE          =   40.00
        private         constant        real                DAMAGE_AMOUNT_LEVEL         =   10.00
       
        private         constant        real                RANGE_AMOUNT_BASE           =   128.00
        private         constant        real                RANGE_AMOUNT_LEVEL          =   0.00
       
        private         constant        integer             SPELL_ABILITY               =   'A00H'
        private         constant        integer             DUMMY_LAVA                  =   '000D'
       
       
        private         constant        attacktype          AT                          =   ATTACK_TYPE_MAGIC
        private         constant        damagetype          DT                          =   DAMAGE_TYPE_FIRE
        private         constant        weapontype          WT                          =   WEAPON_TYPE_WHOKNOWS
endglobals

    private function t_Condition takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ABILITY
    endfunction
   
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             STRUCTURE                                                             *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
private struct LavaArrows
    trigger trg
    event evnt
    boolexpr bool
    unit source
    unit target
    real level
   
    method destroy takes nothing returns nothing
        set this.evnt = null
        set this.bool = null
        call TriggerClearConditions(this.trg)
        call TriggerClearActions(this.trg)
        set this.source = null
        set this.target = null
        set this.level = 0
        call DestroyTrigger(this.trg)
        call this.deallocate()
    endmethod
   

/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             FUNCTION                                                              *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
    static method TypeDamageSource takes nothing returns boolean
        local thistype this = LoadInteger(ht_lava, GetHandleId(GetTriggeringTrigger()), 0)
        return GetEventDamageSource() == this.source
    endmethod
   
    static method Checkconditions takes nothing returns boolean
        local boolean b1 = IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) )
        local boolean b2 = IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND)
        local boolean b3 = IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
        local boolean b4 = IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
        local boolean b5 = IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
        if  b1 == TRUE and  b4 == FALSE and GetUnitAbilityLevel( GetFilterUnit(), 'Avul') < 1 and ( b2 == TRUE or b3 == TRUE ) and b5 == FALSE  then
            return TRUE
        endif
        return FALSE
    endmethod
   
    static method Damage takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId(GetTriggeringTrigger()), 0)
        call DisableTrigger(GetTriggeringTrigger())
        call UnitDamageTarget(this.source, this.target, DAMAGE_AMOUNT_BASE + ( DAMAGE_AMOUNT_LEVEL * this.level), FALSE, FALSE, AT, DT, WT)
        call FlushChildHashtable( ht_lava, GetHandleId(GetTriggeringTrigger()))
       
            call DebugMsg(" Fin : " + I2S(this))
        call this.destroy()
    endmethod
   
    static method Start takes nothing returns nothing
        local thistype array this
        local group g = NewGroup()
        local integer i = 0
        local integer level = GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ABILITY)
        local unit u = GetSpellTargetUnit()
        local unit rd
        call TriggerSleepAction( 0.02)
        call GroupEnumUnitsInArea( g, GetUnitX(u), GetUnitY(u), RANGE_AMOUNT_BASE + ( RANGE_AMOUNT_LEVEL * level), Condition( function thistype.Checkconditions ) )
        call TriggerSleepAction( 0.02)
        loop
            exitwhen  i >= TARGET_MAX or i == ( TARGET_AMOUNT_BASE + ( TARGET_AMOUNT_LEVEL * level) ) or FirstOfGroup(g) == null
           
            if  i == 0  then
                set rd = u
            else
                set rd = FirstOfGroup(g)
            endif
            set this[i] = thistype.create()
            set this[i].trg = CreateTrigger()
            call DebugMsg(" Début : " + I2S(this[i]) + "     Target : " + I2S(GetHandleId(rd)))
            set this[i].bool = Condition(function thistype.TypeDamageSource)
            call TriggerAddCondition( this[i].trg, this[i].bool)
            call TriggerAddAction( this[i].trg, function thistype.Damage)
            set this[i].evnt = TriggerRegisterUnitEvent( this[i].trg, rd, EVENT_UNIT_DAMAGED)
            set this[i].source = CreateUnit(GetOwningPlayer(GetTriggerUnit()), DUMMY_LAVA, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 0.00)
            call RemoveUnitTimed( this[i].source, 2.0)
            set this[i].target = rd
            set this[i].level = level
            call IssueTargetOrder( this[i].source, "attack", rd)
            call SaveInteger( ht_lava, GetHandleId(this[i].trg), 0, this[i])
            call GroupRemoveUnit(g, rd)
            set rd = null
            set i = i + 1
        endloop
        call ReleaseGroup(g)
        set u = null
        set g = null
    endmethod


endstruct
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             TRIGGER                                                               *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
   
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition( t, function t_Condition)
        call TriggerAddAction( t, function LavaArrows.Start)
    endfunction

endscope



PS : Existe t'il une librairie renvoyant une unité aléatoire d'un groupe et qui soit MUI ? Car celle de blizzou ne l'est pas puisqu'elle utilise des variables globales.
_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 01/09/14 10:50    Sujet du message: Citer

Je pense que c'est résolu, j'avais oublié de vérifier que l'unité était bien vivante du coup ma dummy avait une cible sans pouvoir l'attaquer.
_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 09/09/14 20:13    Sujet du message: Citer

Me voila de retour,
Pour vous jouer un mauvais tour ! Erf, mais non, c'est à mon sort de dire ça !
Bon, voyais vous je suis super heureux car pour résoudre un petit problème, un énorme problème est apparu : "il en fait exprès ?".
Je me demande si il en fait exprès néanmoins il pose problème :
Pour éviter le leak de structure non recyclés pour des obscures raisons, j'ai créé un ramasse miette détruisant cette structure non effacé après 10s.
Conséquence : Ca fonctionne, plus de structure alloués perdu, néanmoins -> Le sort fonctionne 1 fois sur 2.
Secret:

Jass:
scope LavaArrows initializer Init
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                              GLOBALS CONFIG                                                       *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
globals
        private                         hashtable           ht_lava                     =   InitHashtable()
        private         constant        integer             TARGET_AMOUNT_BASE          =   3
        private         constant        integer             TARGET_AMOUNT_LEVEL         =   1
        private         constant        integer             TARGET_MAX                  =   10
       
        private         constant        real                DAMAGE_AMOUNT_BASE          =   40.00
        private         constant        real                DAMAGE_AMOUNT_LEVEL         =   10.00
       
        private         constant        real                RANGE_AMOUNT_BASE           =   128.00
        private         constant        real                RANGE_AMOUNT_LEVEL          =   0.00
       
        private         constant        integer             SPELL_ABILITY               =   'A00H'
        private         constant        integer             DUMMY_LAVA                  =   '000D'
       
       
        private         constant        attacktype          AT                          =   ATTACK_TYPE_MAGIC
        private         constant        damagetype          DT                          =   DAMAGE_TYPE_MAGIC
        private         constant        weapontype          WT                          =   WEAPON_TYPE_WHOKNOWS
endglobals

    private function t_Condition takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ABILITY
    endfunction
   
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             STRUCTURE                                                             *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
private struct LavaArrows
    trigger trg
    event evnt
    boolexpr bool
   
   
    unit source
    unit target
    real level
   
    method destroy takes nothing returns nothing
        set this.evnt = null
        call DestroyBoolExpr(this.bool)
        set this.bool = null
        call RemoveUnit(this.source)
        call TriggerClearConditions(this.trg)
        call TriggerClearActions(this.trg)
       
        set this.source = null
        set this.target = null
        set this.level = 0
        call DestroyTrigger(this.trg)
        set this.trg = null
        call this.deallocate()
    endmethod
   

/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             FUNCTION                                                              *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/   

    static method TypeDamageSource takes nothing returns boolean
        local thistype this = LoadInteger(ht_lava, GetHandleId(GetTriggeringTrigger()), 0)
        return GetEventDamageSource() == this.source
    endmethod
   
    static method Checkconditions takes nothing returns boolean
        local boolean b1 = IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) )
        //local boolean b2 = IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND)
        //local boolean b3 = IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING)
        local boolean b4 = IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
        local boolean b5 = IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
        local boolean b6 = GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0
        if  b1 == TRUE and  b4 == FALSE and GetUnitAbilityLevel( GetFilterUnit(), 'Avul') < 1 and b5 == FALSE and b6 == FALSE  then
            return TRUE
        endif
        return FALSE
    endmethod
   
    static method Damage takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId(GetTriggeringTrigger()), 0)
        call DisableTrigger(GetTriggeringTrigger())
        call UnitDamageTarget(this.source, this.target, DAMAGE_AMOUNT_BASE + ( DAMAGE_AMOUNT_LEVEL * this.level), FALSE, FALSE, AT, DT, WT)
        call FlushChildHashtable( ht_lava, GetHandleId(GetTriggeringTrigger()))
       
            call DebugMsg(" Fin : " + I2S(this))
        call this.destroy()
    endmethod
   
    static method SafeAntiLeak takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId( GetExpiredTimer() ), 0)
        if  HaveSavedInteger( ht_lava, GetHandleId( this.trg ), 0)  then
                call DisableTrigger( this.trg )
                call FlushChildHashtable( ht_lava, GetHandleId( this.trg ) )
                call FlushChildHashtable( ht_lava, GetHandleId( GetExpiredTimer() ) )
                call this.destroy()
            endif
        call DestroyTimer( GetExpiredTimer() )
    endmethod
   
    static method Start takes nothing returns nothing
        local unit t = GetSpellTargetUnit()
        local unit u = GetTriggerUnit()
        local thistype array this
        local timer array safe
        local group g = CreateGroup()
        local integer i = 0
        local integer level = GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ABILITY)
        local unit rd
        call GroupEnumUnitsInRange( g, GetUnitX(t), GetUnitY(t), GetRadiusEx( RANGE_AMOUNT_BASE + ( RANGE_AMOUNT_LEVEL * level) ), Condition( function thistype.Checkconditions ) )
        call TriggerSleepAction( 0.05 )
        loop
           
            if  i == 0  then
                set rd = t
            else
                set rd = FirstOfGroup(g)
            endif
           
            exitwhen  i >= TARGET_MAX or i == ( TARGET_AMOUNT_BASE + ( TARGET_AMOUNT_LEVEL * level) ) or rd == null
           
            set this[i] = thistype.create()
            set this[i].trg = CreateTrigger()
            //call DebugMsg(" Début : " + I2S(this[i]) + "     Target : " + I2S(GetHandleId(rd)))
            set this[i].bool = Condition(function thistype.TypeDamageSource)
           
            call TriggerAddCondition( this[i].trg, this[i].bool)
            call TriggerAddAction( this[i].trg, function thistype.Damage)
            set this[i].evnt = TriggerRegisterUnitEvent( this[i].trg, rd, EVENT_UNIT_DAMAGED)
           
            set this[i].source = CreateUnit(GetOwningPlayer(u), DUMMY_LAVA, GetUnitX(u), GetUnitY(u), 0.00)
            call UnitApplyTimedLife( this[i].source, 'BTLF', 10.00)
            set this[i].target = rd
            set this[i].level = level
           
            call DebugMsg(" Début : " + I2S(this[i]) + "     Source : " + I2S(GetHandleId(this[i].source)))

            set safe[i] = CreateTimer()
            call SaveInteger( ht_lava, GetHandleId( safe[i] ), 0, this[i] )
            call TimerStart( safe[i], 10.00, FALSE, function thistype.SafeAntiLeak)
           
            call IssueTargetOrder( this[i].source, "attack", rd)
            call SaveInteger( ht_lava, GetHandleId(this[i].trg), 0, this[i])
            call GroupRemoveUnit(g, rd)
           
           
            set rd = null
            set i = i + 1
        endloop
        call DestroyGroup(g)
        set u = null
        set t = null
        set rd = null
        set g = null

    endmethod


endstruct
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             TRIGGER                                                               *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
   
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger&#40;)
        call TriggerRegisterAnyUnitEventBJ&#40; t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition&#40; t, function t_Condition)
        call TriggerAddAction&#40; t, function LavaArrows.Start)
    endfunction

endscope


Et pour ceux n'arrivant pas à résoudre le problème rien qu'en voyant le script ou voulant le faire en temps réel, voila la map.
http://www.mediafire.com/download/cofk65mxf8qum8m/Lava_Arrows.w3x
Merci pour ceux voulant essayer de résoudre un sort qui ne veut pas fonctionner depuis 1 mois malgré toutes les tentatives et vos conseils suivies.
_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 Tirlititi



Inscrit le: 21 Fév 2010
Messages: 1785
Sujets: 22
Spécialité en worldedit: La modestie
Médailles: 1 (En savoir plus...)
Grand mage créateur de sort (Quantité : 1)

MessagePosté le: 10/09/14 13:30    Sujet du message: Citer

Je ne vois pas....
Essaie en enlevant le "TriggerSleepAction", on sait jamais.
Et sinon, quand tu dis qu'il fonctionne 1 fois sur 2, c'est régulier ("ça marche, ça marche pas, ça marche, ça marche pas....") ou aléatoire?
Peut-être que c'est simplement une histoire de range. Tu as lu ce post? Ça veut dire que c'est pas parce que l'unité est dans la zone d'effet que "GroupEnumUnitsInRange" va la prendre en compte.
_________________
Warcraft III, c'était mieux avant. Y'avait des purs chefs-d'oeuvres du mapping !
Road Of Glory (par moi)
Casse-briques (par moi)
Temple de Glace (par moi)
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
 florianlenecro
Floodeur prématuré


Inscrit le: 12 Nov 2009
Messages: 711
Sujets: 50
Spécialité en worldedit: Vétéran


MessagePosté le: 10/09/14 14:38    Sujet du message: Citer

Eh bien en faite, grâce au DebugMsg, je sais que ce n'est pas lié à cela étant donné que la boucle continue jusqu'à rencontrer nul ou atteindre le nombre de cible max.
J'ai néanmoins essayer et ça ne change rien. Le wait ne change rien du tout.
Cela fonctionne aléatoirement, les struct come je le disais sont bien créés mais rien ne se passe.

Quand j'ai le bug, je re-cast sur la même unité et cette fois tout fonctionne correctement.
Ca vient vraiment des dummies qui en attaquant créent les jets de lave mais pourquoi ça marche aléatoirement ducoup, ?

Edit :
J'ai aussi remarqué que l'event Subit des dégats ne fonctionnait apperemment pas à tous les coups puisque je vois tout de même le jet qui fait 0 dégat.

Secret:

Jass:
scope LavaArrows initializer Init
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                              GLOBALS CONFIG                                                       *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
globals
        private                         hashtable           ht_lava                     =   InitHashtable()
        private         constant        integer             TARGET_AMOUNT_BASE          =   3
        private         constant        integer             TARGET_AMOUNT_LEVEL         =   1
        private         constant        integer             TARGET_MAX                  =   10
       
        private         constant        real                DAMAGE_AMOUNT_BASE          =   40.00
        private         constant        real                DAMAGE_AMOUNT_LEVEL         =   10.00
       
        private         constant        real                RANGE_AMOUNT_BASE           =   128.00
        private         constant        real                RANGE_AMOUNT_LEVEL          =   32.00
       
        private         constant        integer             SPELL_ABILITY               =   'A00H'
        private         constant        integer             DUMMY_LAVA                  =   '000D'
       
       
        private         constant        attacktype          AT                          =   ATTACK_TYPE_MAGIC
        private         constant        damagetype          DT                          =   DAMAGE_TYPE_MAGIC
        private         constant        weapontype          WT                          =   WEAPON_TYPE_WHOKNOWS
endglobals

    private function t_Condition takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ABILITY
    endfunction
   
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             STRUCTURE                                                             *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
private struct FilterData
    real x
    real y
    real range

endstruct

private struct LavaArrows
    trigger trg
    event evnt
    boolexpr bool
   
   
    unit source
    unit target
    real level
   
    method destroy takes nothing returns nothing
        set this.evnt = null
        //call DestroyBoolExpr(this.bool)
        //set this.bool = null
        call RemoveUnit(this.source)
        //call TriggerClearConditions(this.trg)
        call TriggerClearActions(this.trg)
       
        set this.source = null
        set this.target = null
        set this.level = 0
        call DestroyTrigger(this.trg)
        set this.trg = null
        call this.deallocate()
    endmethod
   

/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             FUNCTION                                                              *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/   

    /*static method TypeDamageSource takes nothing returns boolean
        local thistype this = LoadInteger(ht_lava, GetHandleId(GetTriggeringTrigger()), 0)
        if  GetEventDamageSource() == this.source  then
            call DisableTrigger(GetTriggeringTrigger())
            call UnitDamageTarget(this.source, this.target, DAMAGE_AMOUNT_BASE + ( DAMAGE_AMOUNT_LEVEL * this.level), FALSE, FALSE, AT, DT, WT)
            call FlushChildHashtable( ht_lava, GetHandleId(GetTriggeringTrigger()))
       
            call DebugMsg(" Fin : " + I2S(this))
            call this.destroy()
        endif
        return FALSE
    endmethod*/
   
    static method Checkconditions takes nothing returns boolean
        local FilterData this = LoadInteger( ht_lava, GetHandleId(GetTriggerUnit()), 0)
        local boolean b1 = IsUnitEnemy( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) )
        local boolean b2 = IsUnitInRangeXY( GetFilterUnit(), this.x, this.y, this.range)
        local boolean b4 = IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE)
        local boolean b5 = IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
        local boolean b6 = GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0
        if  b1 == TRUE and b2 == TRUE and b4 == FALSE and GetUnitAbilityLevel( GetFilterUnit(), 'Avul') < 1 and b5 == FALSE and b6 == FALSE  then
            return TRUE
        endif
        return FALSE
    endmethod
   
    static method Damage takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId(GetTriggeringTrigger()), 0)
        if  GetEventDamageSource() == this.source  then
            call DisableTrigger(GetTriggeringTrigger())
            call UnitDamageTarget(this.source, this.target, DAMAGE_AMOUNT_BASE + ( DAMAGE_AMOUNT_LEVEL * this.level), FALSE, FALSE, AT, DT, WT)
            call FlushChildHashtable( ht_lava, GetHandleId(GetTriggeringTrigger()))
       
            call DebugMsg(" Fin : " + I2S(this))
            call this.destroy()
        endif
    endmethod
   
    static method SafeAntiLeak takes nothing returns nothing
        local thistype this = LoadInteger( ht_lava, GetHandleId( GetExpiredTimer() ), 0)
        if  HaveSavedInteger( ht_lava, GetHandleId( this.trg ), 0)  then
                //call DisableTrigger( this.trg )
                call FlushChildHashtable( ht_lava, GetHandleId( this.trg ) )
                call FlushChildHashtable( ht_lava, GetHandleId( GetExpiredTimer() ) )
                call this.destroy()
            endif
        call DestroyTimer( GetExpiredTimer() )
    endmethod
   
    static method Start takes nothing returns nothing
        local unit t = GetSpellTargetUnit()
        local unit u = GetTriggerUnit()
        local thistype array this
        local FilterData strct = FilterData.create()
        local timer array safe
        local group g = CreateGroup()
        local integer i = 0
        local integer level = GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ABILITY)
        local unit rd
        set strct.x = GetUnitX(t)
        set strct.y = GetUnitY(t)
        set strct.range = RANGE_AMOUNT_BASE + ( RANGE_AMOUNT_LEVEL * level)
        call SaveInteger( ht_lava, GetHandleId(u), 0, strct)
        //call TriggerSleepAction( 0.02 )
        call GroupEnumUnitsInRange( g, GetUnitX(t), GetUnitY(t), RANGE_AMOUNT_BASE + ( RANGE_AMOUNT_LEVEL * level), Condition( function thistype.Checkconditions ) )
        //call TriggerSleepAction( 0.02 )
        call FlushChildHashtable( ht_lava, GetHandleId(u))
        loop
           
            if  i == 0  then
                set rd = t
            else
                set rd = FirstOfGroup(g)
            endif
           
            exitwhen  i >= TARGET_MAX or i >= ( TARGET_AMOUNT_BASE + ( TARGET_AMOUNT_LEVEL * level) ) or rd == null
           
            set this[i] = thistype.create()
            set this[i].trg = CreateTrigger()
            call DebugMsg(" Début : " + I2S(this[i]) + "     Target : " + I2S(GetHandleId(rd)))
            //call DebugMsg(" Début : " + I2S(this[i]) + "      Trigger : " + I2S(GetHandleId(this[i].trg)))
            //set this[i].bool = Condition(function thistype.TypeDamageSource)
           
            //call TriggerAddCondition( this[i].trg, this[i].bool)
            call TriggerAddAction( this[i].trg, function thistype.Damage)
            set this[i].evnt = TriggerRegisterUnitEvent( this[i].trg, rd, EVENT_UNIT_DAMAGED)
           
            set this[i].source = CreateUnit(GetOwningPlayer(u), DUMMY_LAVA, GetUnitX(u), GetUnitY(u), 0.00)
            call UnitApplyTimedLife( this[i].source, 'BTLF', 10.00)
            set this[i].target = rd
            set this[i].level = level
           
            //call DebugMsg(" Début : " + I2S(this[i]) + "     Source : " + I2S(GetHandleId(this[i].source)))
           
            call IssueTargetOrder( this[i].source, "attack", rd)
            call SaveInteger( ht_lava, GetHandleId(this[i].trg), 0, this[i])
            call GroupRemoveUnit(g, rd)
           
            set safe[i] = CreateTimer()
            call SaveInteger( ht_lava, GetHandleId( safe[i] ), 0, this[i] )
            call TimerStart( safe[i], 40.00, FALSE, function thistype.SafeAntiLeak)
           
           
           
            set rd = null
            set i = i + 1
        endloop
        call DestroyGroup(g)
        set u = null
        set t = null
        set rd = null
        set g = null

    endmethod


endstruct
/****************************************************************************************************************************
*****************************************************************************************************************************
*****                                                                                                                   *****
*****                                             TRIGGER                                                               *****
*****                                                                                                                   *****
*****************************************************************************************************************************
*****************************************************************************************************************************/
   
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger&#40;)
        call TriggerRegisterAnyUnitEventBJ&#40; t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition&#40; t, function t_Condition)
        call TriggerAddAction&#40; t, function LavaArrows.Start)
    endfunction

endscope


_________________
C'est en forgeant que l'on devient forgeron
"Le feu ne peut tuer le dragon"
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé
Montrer les messages depuis:   
Poster un nouveau sujet   Répondre au sujet    Worldedit Index du Forum -> Les sorts Toutes les heures sont au format GMT + 1 Heure
Page 1 sur 1
La question posée dans ce topic a été résolue !

 
Sauter vers:  
Vous ne pouvez pas poster de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas voter dans les sondages de ce forum


Powered by phpBB © 2001, 2005 phpBB Group
Traduction par : phpBB-fr.com