• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Fire Disc v1.2(d)

Requires:
* xDModules (are needed for struct stacking issues)
* JNGP (JassHelper v0.9.G.1)

This is my first spell created with my struct stacking module. I wanted to test this new
feature and for that I created this spell.

Fire Disc is a spell which damages all enemies it hits. Also it can cut through trees.

How to implement this spell?
* Copy this trigger and the xDModules library to your map
* Copy the spell to your map (object editor) but don't forget to adjust the Raw-Code
* Adjust the rawcodes to your map specific ones
* Now you are done

Credits:
*PitzerMike for TreeFilter function
*Vexorian for vJass
Changelog
v1.0
- Release

v1.1
- New xDModules version
- Reworked the art the disc damages enemies

v1.2
- Added GroupRecycler
- Fixed leak with boolexpr for TriggerRegisterPlayerUnitEvent

v1.2b
- Added more documentation

v1.2c
- Forgot to destroy boolexpr in the init function :(

v1.2d(Only Balance Issues)
- Decreased damage delt by the part missiles
- Increased range of part missile damage
JASS:
//**********************************************************************************************
//* Fire Disc v1.2d By xD.Schurke  -  17.04.2009
//* --------------------------------------------
//* 
//* Requires:
//*     * xDModules (are needed for struct stacking issues)
//*     * JNGP (JassHelper v0.9.G.1)
//*     
//* This is my first spell created with my struct stacking module. I wanted to test this new
//* feature and for that I created this spell.
//*
//* Fire Disc is a spell which damages all enemies it hits. Also it can cut through trees.
//*
//*
//* How to implement this spell?
//*     * Copy this trigger and the xDModules library to your map
//*     * Copy the spell to your map (object editor) but don't forget to adjust the Raw-Code
//*     * Adjust the rawcodes to your map specific ones
//*     * Now you are done
//* 
//* Credits:
//*     *PitzerMike for TreeFilter function
//*     *Vexorian for vJass
//* 
//*
//*
//* Changelog:
//*     v1.2
//*      * Fixed leak for TriggerRegisterPlayerUnitEvent
//*      * Added GroupRecycler
//*
//*     v1.2b
//*      * Added more documentation
//*
//*     v1.2c
//*      * Forgot to destroy DummyFilter boolexpr in the init function :( 
//*
//*     v1.2d
//*      * Decreased damage delt by the part missiles
//*      * Increased range of part missile damage
//*
//**********************************************************************************************

library FireDisc initializer init requires xDModules,GroupRecycler
//Setup change the Variables you want to change, but better don't change the spell script
globals
    private constant integer    dummyID         = 'n000'
    private constant integer    spellID         = 'A000'
    private constant integer    flyID           = 'Amrf'

    private constant integer    partMissiles    = 8                                                                  //Number of disc parts (I choosed 8, because it looks realy good that way)
    private constant integer    alphaDec        = 51                                                                 //255/5 = 51 the number for slowly hiding the missiles, should not look to instant (the end of spell)
    
    private constant real       interval        = 0.03125
    private constant real       alphaDecStart   = 900.                                                               //The distance when the hiding process should start
    private constant real       speed           = 20.                                                                //The speed of the main missile => always has to be a multipler of maxDis and effectDis and also alphaDecStart
    private constant real       speedPart       = 10.                                                                //The speed of the part missile (needed for angle calculation, creates a rotation)
    private constant real       maxDeg          = 360.                                                      
    private constant real       maxDis          = 1100.                                                              //The distance the disc can fly 
    private constant real       effectDis       = 860.                                                               //At this distance the effect for the last explosion spawns
    private constant real       partMisDist     = 80.                                                                //The distance between the main missile and the part missiles
    private constant real       treeKillRange   = 60.                                                                //Radius where Trees get killed                                                               
    private constant real       pDamage         = 25.                                                                //Damage of the part missiles
    private constant real       mDamage         = 65.                                                                //Damage of the main missile
    private constant real       mDamageRange    = 250.                                                               //Radius of main missile Damage
    private constant real       pDamageRange    = 50.                                                                //Radius of part missile Damage
    
    //The following strings are the effect strings
    private constant string     mainEffect      = "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl"
    private constant string     partEffect      = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
    private constant string     partEffect2     = "Abilities\\Spells\\Other\\ImmolationRed\\ImmolationRedDamage.mdl"
    private constant string     explodeEffect   = "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl"
    
    //Following Variables should not be changed
    private          group      tmpG            = CreateGroup()
    private          player     tmpP
    private          boolexpr   Cond            = null
    private          boolexpr   condTree        = null
endglobals
//Setup end
//constantFunctionPart
private function partDamage takes integer lvl returns real
    return lvl*pDamage
endfunction

private function mainDamage takes integer lvl returns real
    return lvl*mDamage
endfunction
//endconstantFunctionPart 

//Do not change anything below!
private function DummyFilter takes nothing returns boolean
    return true
endfunction

private function GroupFilter takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),tmpP) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0) and IsUnitType(GetFilterUnit(),UNIT_TYPE_GROUND) and (GetUnitTypeId(GetFilterUnit())!=dummyID)
endfunction

private function TreeFilter takes nothing returns boolean
    local destructable d = GetFilterDestructable()
    local boolean i = IsDestructableInvulnerable(d)
    local unit u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), dummyID, GetWidgetX(d), GetWidgetY(d), 0)
    local boolean result = false
    call UnitAddAbility(u, 'Ahrl')
    if i then
        call SetDestructableInvulnerable(d, false)
    endif
    set result = IssueTargetOrder(u, "harvest", d)
    call RemoveUnit(u)
    if i then
      call SetDestructableInvulnerable(d, true)
    endif
    set u = null
    set d = null
    return result
endfunction

private function KillTree takes nothing returns nothing
    call KillDestructable(GetEnumDestructable())
endfunction

//Following struct is used for the single parts of the disc, so each part of the disc works for its own
private struct discPart
    integer alpha = 255  //Alpha-Channel
    unit caster            
    unit missile          
    unit tarMissile      //The mainMissile
    real angle      = 0. //Angle, needed for the speed of rotation
    real x          = 0. //x-point of the end
    real y          = 0. //y-point of the end
    real dis        = 0. //how far the missile got
    group g              //Is the unit already hit?
    method actions takes nothing returns nothing
        local real x = 0.
        local real y = 0.
        local rect r
        local unit u
        local integer i = 0
        //Moving Part of the missile
        set .angle = .angle + speedPart
        set x = GetUnitX(.tarMissile) + partMisDist * Cos(.angle * bj_DEGTORAD)
        set y = GetUnitY(.tarMissile) + partMisDist * Sin(.angle * bj_DEGTORAD)
        call SetUnitFacing(.missile,.angle)
        call SetUnitPosition(.missile,x,y)
        //endmovingpart
        //TreeFilter part
        set r = Rect(x-treeKillRange,y-treeKillRange,x+treeKillRange,y+treeKillRange)
        call EnumDestructablesInRect(r,condTree,function KillTree)
        //end TreeFilter part
        //Unit damaging part
        set tmpP = GetOwningPlayer(.caster)
        call GroupEnumUnitsInRange(tmpG,x,y,pDamageRange,Cond)
        loop
            set u = FirstOfGroup(tmpG)
            exitwhen u == null
            if IsUnitInGroup(u,.g) != true then
                call UnitDamageTarget(.caster,u,partDamage(GetUnitAbilityLevel(.caster,spellID)),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)            
                call GroupAddUnit(.g,u)
            endif
            call GroupRemoveUnit(tmpG,u)            
        endloop
        //end unit damaging part
        //hiding part => alpha-channel manipulation
        set .dis = .dis + speed
        if .dis >= alphaDecStart then
            set .alpha = .alpha - alphaDec
            call SetUnitVertexColor(.missile,255,255,255,.alpha)
        endif      
        //end hiding part
        //destroying part of the struct + clear leaks
        if .dis >= maxDis then          
            call RemoveUnit(.missile)
            call ReleaseGroup(.g)
            set .missile = null
            set .g = null
            set .caster = null
            set .active = false
        endif 
        call RemoveRect(r)
        set u = null
        set r = null
    endmethod
    implement structStack
endstruct

//Following struct is used for the mainPart of the disc (this missile in the middle, where all partMissiles will fly aroung
private struct discMain
    integer alpha = 255  //Alpha-Channel
    unit caster
    unit missile
    real x       = 0.    //X-Point of the end
    real y       = 0.    //Y-Point of the end
    real angle   = 0.    //Angle between caster and SpellTargetPoint
    real dis     = 0.    //how far the missile got
    method actions takes nothing returns nothing
        //moving part of the missile
        local real x = GetUnitX(.missile) + speed * Cos(.angle * bj_DEGTORAD)
        local real y = GetUnitY(.missile) + speed * Sin(.angle * bj_DEGTORAD) 
        local unit u
        call SetUnitPosition(.missile,x,y)
        set .dis = .dis + speed
        //endmovingpart
        //part for the last effect => AOE damage and hiding part by manipulating the alpha-channels
        if .dis == effectDis then
            call DestroyEffect(AddSpecialEffect(explodeEffect,.x,.y)) 
        elseif .dis >= alphaDecStart then
            set .alpha = .alpha - alphaDec
            call SetUnitVertexColor(.missile,255,255,255,.alpha)
        endif
        //end effect/hiding part
        //destroying part of the struct + clear leaks
        if .dis >= maxDis then
            set tmpP = GetOwningPlayer(.caster)
            call GroupEnumUnitsInRange(tmpG,x,y,mDamageRange,Cond)
            loop
                set u = FirstOfGroup(tmpG)
                exitwhen u == null
                call UnitDamageTarget(.caster,u,mainDamage(GetUnitAbilityLevel(.caster,spellID)),false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS) 
                call GroupRemoveUnit(tmpG,u)
            endloop
            call RemoveUnit(.missile)
            set .missile = null
            set .caster = null
            set .active = false
        endif
        set u = null
    endmethod    
    implement structStack
endstruct

private function cond takes nothing returns boolean
    return GetSpellAbilityId() == spellID
endfunction

private function action takes nothing returns nothing
    local discMain dM = discMain.create(interval)
    local discPart dP
    local location tmpLoc = GetSpellTargetLoc()
    local integer i = 0
    local real x = 0
    local real y = 0
    //initialize mainMissile
    set dM.caster = GetTriggerUnit()
    set dM.missile = CreateUnit(GetOwningPlayer(dM.caster),dummyID,GetUnitX(dM.caster),GetUnitY(dM.caster),0)
    call UnitAddAbility(dM.missile,flyID)
    call UnitRemoveAbility(dM.missile,flyID)
    call SetUnitFlyHeight(dM.missile,100,0)
    call AddSpecialEffectTarget(mainEffect,dM.missile,"origin")
    set dM.angle = bj_RADTODEG * Atan2(GetLocationY(tmpLoc) - GetUnitY(dM.caster), GetLocationX(tmpLoc) - GetUnitX(dM.caster))
    set dM.x = GetUnitX(dM.caster) + maxDis * Cos(dM.angle * bj_DEGTORAD)
    set dM.y = GetUnitY(dM.caster) + maxDis * Sin(dM.angle * bj_DEGTORAD)    
    //mainMissile initialization finished
    //initialize partMissile
    loop
        exitwhen i >= partMissiles
        set dP = discPart.create(interval)
        set dP.caster = dM.caster
        set dP.tarMissile = dM.missile
        set dP.angle = (maxDeg/partMissiles)*i
        set x = GetUnitX(dP.tarMissile) + partMisDist * Cos(dP.angle * bj_DEGTORAD)
        set y = GetUnitY(dP.tarMissile) + partMisDist * Sin(dP.angle * bj_DEGTORAD)
        set dP.missile = CreateUnit(GetOwningPlayer(dP.caster),dummyID,x,y,0)
        call UnitAddAbility(dP.missile,flyID)
        call UnitRemoveAbility(dP.missile,flyID)
        call SetUnitFlyHeight(dP.missile,100,0)
        call AddSpecialEffectTarget(partEffect,dP.missile,"origin")   
        set dP.x = dM.x
        set dP.y = dM.y
        set dP.g = NewGroup()
        set i = i + 1
    endloop
    //partMissile initialization finished
    call RemoveLocation(tmpLoc)
    set tmpLoc = null
endfunction

private function init takes nothing returns nothing
    local trigger int = CreateTrigger()
    local integer i = 0
    local boolexpr boolTemp = Filter(function DummyFilter)
    loop
        call TriggerRegisterPlayerUnitEvent(int,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,boolTemp)
        set i = i + 1
        exitwhen i >= bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition(int,Condition(function cond))
    call TriggerAddAction(int,function action)
    set int = null
    //Setup the filters
    set condTree = Filter(function TreeFilter)
    set Cond = Filter(function GroupFilter)
    
    //Preload
    call Preload(mainEffect)
    call Preload(partEffect)
    call Preload(partEffect2)
    call Preload(explodeEffect)
    call DestroyBoolExpr(boolTemp)
    set boolTemp = null
endfunction
endlibrary

JASS:
//**********************************************************************************
//* xDModules v1.1 by xD.Schurke  -  16.04.2009
//* --------------------------------------------
//*       
//* Requires:
//*     * JNGP (JassHelper v0.9.G.0)
//*     
//*
//*     * Implement the module in your structs, which need timers.
//*     * The struct needs a method called actions 
//*
//* Example:
//*
//* struct Data
//*     integer count = 0
//*     method actions takes nothing returns nothing
//*         call BJDebugMsg("Hello World")
//*         set .count = .count + 1
//*         if count == 5 then
//*             set .active = false 
//*         endif
//*     endmethod
//*     implement structStack
//* endstruct
//*
//* If you want to destroy the struct just the this.active = false (.active = false).
//* But don't forget to clear all leaks before
//*
//* Changelog:
//*     * Now the timer interval are commited by the create parameters
//*
//*
//**********************************************************************************
library xDModules
    module structStack
        boolean active = true
        
        private integer i    
        private static integer Total = 0
        private static thistype array Data
        private static timer Tim = CreateTimer()
        private static method callback takes nothing returns nothing
            local thistype dat
            local integer i = 0
            loop
                exitwhen i >= thistype.Total
                set dat = thistype.Data[i]
                if dat.active == true then
                    call dat.actions()
                else                
                    call thistype.destroy(dat)
                    set i = i - 1
                endif
                set i = i + 1
            endloop
            if thistype.Total == 0 then
                call PauseTimer(thistype.Tim)
            endif 
        endmethod
    
        static method create takes real interval returns thistype
            local thistype dat = thistype.allocate()
            if thistype.Total == 0 then
                call TimerStart(thistype.Tim,interval,true,function thistype.callback)
            endif
            set thistype.Data[thistype.Total] = dat
            set dat.i = thistype.Total
            set thistype.Total = thistype.Total + 1
            return dat
        endmethod
        
        private method onDestroy takes nothing returns nothing
            set thistype.Total=thistype.Total-1
            set thistype.Data[.i]=thistype.Data[thistype.Total]
            set thistype.Data[.i].i=.i     
        endmethod
    endmodule
endlibrary

JASS:
library GroupRecycler
//*********************************************************************
//* Group Recycler 1.0 by xD.Schurke
//* --------------------------------
//*
//* To implement just create a custom text trigger and paste the script
//* there.
//*
//* This script requires vJass (JassNewGenPack)
//*
//* Usage of the scriot:
//* - Recycle Groups
//*
//* set group g = NewGroup() : Get a group (alternative to CreateGroup)
//* call ReleaseGroup(g) : Releases a group (alternative to
//* DestroyGroup)
//*
//*********************************************************************
    globals
        private constant integer MAX_GROUPS = 8191

        private group array rG
private integer rN = 0
    endglobals

    function NewGroup takes nothing returns group
        if (rN == 0) then
            set rG[0] = CreateGroup()
        else
            set rN = rN - 1
        endif
     return rG[rN]
    endfunction

    function ReleaseGroup takes group g returns nothing
        if(g == null) then
            debug call BJDebugMsg("Warning: Try to release a null group")
            return
        endif
        if (rN == MAX_GROUPS) then
            debug call BJDebugMsg("Warning: Limit reached, Destroying Group")
            call DestroyGroup(g)
        else
            call GroupClear(g)
            set rG[rN] = g
            set rN = rN + 1
        endif
    endfunction
endlibrary

Keywords:
Fire, Disc, Jass, vJass, Schurke, xD, JESP, Good, Flame, Rotating, dummy, struct, module
Contents

Fire Disc v1.2d (Map)

Reviews
15:29, 8th Oct 2009 TriggerHappy187: There's nothing wrong visually with the spell, it looks nice and has a cool effect. You may want to use GetWidgetLife when trying to get a units life, it's faster. local boolexpr boolTemp =...

Moderator

M

Moderator

15:29, 8th Oct 2009
TriggerHappy187:

There's nothing wrong visually with the spell, it looks nice and has a cool effect.

  • You may want to use GetWidgetLife when trying to get a units life, it's faster.
  • local boolexpr boolTemp = Filter(function DummyFilter) is completely useless, null boolexprs don't leak inside events.
  • Patch 1.24 includes GetSpellTargetX/Y, so there's no need to use the location alternative.

Though there are no leaks and nothing really wrong with your code this can be approved.
 
Nice spell out there. I checked it out idea is great in my option but 768 dmg per second is overpowerd i guess... well i first tested spell then checked triggers and i must say that spell is somehow strange working actually units which are ofc in range of spell are not damaged at all and even most of times only few units take like 100 dmg well its impossible that any unit takes no damage. check that out!!! i added bug here so check it

then i find out that you used module in other library well thats not supposed to be used like that i would suggest you make it private module in your own spell coz well private onDestroy is same as public onDestroy coz thats not a method thats a destructor and you cant define 2 destructors so it wont work for anyone with that method...

i checked quickly your code and well find out you leak few handle types, boolexpr filter...

so thats all for now try to fix this if possible and it will be 5/5
as well must say GJ on the setup spell is easy editable with constants up there...

well about coding skills if you ask me i would suggest you to make this more readable its i mean almost no spaces, new empty lines its all one on another and there are no comments which explains what some lines of code will do...

ok that was a suggestion it will help you to easier edit your code as well as other to learn from it, hmm am i right?


k last of all i like spell idea really and its different from most of spells here nice rotation but plz add some fire effects to units who takes damage

for now it will be 3.7/5 but if you fix this it will be 5/5
~Dark Dragon
 

Attachments

  • Bug.w3g
    2.4 KB · Views: 173
Level 16
Joined
Feb 22, 2006
Messages
960
Nice spell out there. I checked it out idea is great in my option but 768 dmg per second is overpowerd i guess... well i first tested spell then checked triggers and i must say that spell is somehow strange working actually units which are ofc in range of spell are not damaged at all and even most of times only few units take like 100 dmg well its impossible that any unit takes no damage. check that out!!! i added bug here so check it

then i find out that you used module in other library well thats not supposed to be used like that i would suggest you make it private module in your own spell coz well private onDestroy is same as public onDestroy coz thats not a method thats a destructor and you cant define 2 destructors so it wont work for anyone with that method...

i checked quickly your code and well find out you leak few handle types, boolexpr filter...

so thats all for now try to fix this if possible and it will be 5/5
as well must say GJ on the setup spell is easy editable with constants up there...

well about coding skills if you ask me i would suggest you to make this more readable its i mean almost no spaces, new empty lines its all one on another and there are no comments which explains what some lines of code will do...

ok that was a suggestion it will help you to easier edit your code as well as other to learn from it, hmm am i right?


k last of all i like spell idea really and its different from most of spells here nice rotation but plz add some fire effects to units who takes damage

for now it will be 3.7/5 but if you fix this it will be 5/5
~Dark Dragon

thank you for the good review, I give some comments on it :D

1. The damage part:
I already uploaded a new version which changed this, now it should be more clear how this spell damages units. The disc is built by 9 parts (1main 8arms)
and each arm can deal damage to units it hits

2. I don't get your idea... my idea behind this module was to implement the constructor and destructor + a callbkack method it works like it should, it's more handy like this, but if I understand you wrong tell me ;)

3. Where do I leak??, there are no leaks.... :(((

You're right I could add some more documentation on the structs etc.
 
ahh k i will point out all thinks you misunderstanded!

1. k i will test it again and see but i beleve you it is fine now with damage

2. module is just part of struct which can be implemented in it do not thread that as something other its that based struct and you are in that module coding your destructor that destructor is not coded for your module but for the struct so this is destructor of struct in which you implemented that module.

i am not sure did you understanded well what modules are but i do not know how to exactly expalin you. but just note that its just part of code which can be simply added.

3. k about nulling hmm i think i saw it well i quickly looked at code but well you null them everywhere i usually null then at end of code (function/method... bla bla) to make it more readable but maybe you allready fixed it and y while writing this i just now tested your spell and it damages units correct now.

but to the real matter about leaks you leak 16 tables of boolexpr type or better to say conditionfunc in your spell...

well as you can see every spell thats posted here (almost every) leaks boolexpr's coz null is a pointer which points to empty and that causes (as i learned) empty boolexpr's in memory taking space and object id's not handle ones but directly in memory thats worse then locations or some other types coz well its actually blizzard bug for coding thinks bad but we have to fix it. however there is no tutor which explains this really very good so i hade to check this a bit by myself and well now i told you about it ofc Hanky teached me as well about this.

so ill directly send you to his tutor i think as fare as i saw thats best tutor about leaks and here it is read it and well you will see that he never expalins actually what happens in memory but teaches you how to do it in correct way so enjoy: Best Leak Tutor

4. well its your choice but i think it will help you out making code more readable coz well after a 1 year you will ask yourself hmmm what did i do here and here and there... xD

Greets!
~Dark Dragon
 
Level 16
Joined
Feb 22, 2006
Messages
960
ahh k i will point out all thinks you misunderstanded!

1. k i will test it again and see but i beleve you it is fine now with damage

2. module is just part of struct which can be implemented in it do not thread that as something other its that based struct and you are in that module coding your destructor that destructor is not coded for your module but for the struct so this is destructor of struct in which you implemented that module.

i am not sure did you understanded well what modules are but i do not know how to exactly expalin you. but just note that its just part of code which can be simply added.

3. k about nulling hmm i think i saw it well i quickly looked at code but well you null them everywhere i usually null then at end of code (function/method... bla bla) to make it more readable but maybe you allready fixed it and y while writing this i just now tested your spell and it damages units correct now.

but to the real matter about leaks you leak 16 tables of boolexpr type or better to say conditionfunc in your spell...

well as you can see every spell thats posted here (almost every) leaks boolexpr's coz null is a pointer which points to empty and that causes (as i learned) empty boolexpr's in memory taking space and object id's not handle ones but directly in memory thats worse then locations or some other types coz well its actually blizzard bug for coding thinks bad but we have to fix it. however there is no tutor which explains this really very good so i hade to check this a bit by myself and well now i told you about it ofc Hanky teached me as well about this.

so ill directly send you to his tutor i think as fare as i saw thats best tutor about leaks and here it is read it and well you will see that he never expalins actually what happens in memory but teaches you how to do it in correct way so enjoy: Best Leak Tutor

4. well its your choice but i think it will help you out making code more readable coz well after a 1 year you will ask yourself hmmm what did i do here and here and there... xD

Greets!
~Dark Dragon

1. Yep I understood what modules are, so I don't get your problem^^, because I only implement a premade con/destructor to my structs :O

2. Ah I see... yep in the init function I used null for the TriggerRegisterPlayerUnitEvent, I create a dummy boolexpr function

3. I add some more description also for others, maybe someone wants to learn something^^
 
as nerovesper said its now fixed well gj on ur spell 5/5 from me as well +rep

and about modules it works perfectly in your spell but i suggest you to delete that trigger and library it only slows stuff down and what i wanted to say seems i could not expalin with words so here an example:

JASS:
private struct triggerx
    private trigger t
    private triggeraction ta

    implement optional Module // lets say this is your one well i wont write action method

    method onDestroy takes nothing returns nothing
        call TriggerRemoveAction(this.t, this.ta)
        call DestroyTrigger(this.t)
        null...
    endmethod
endstruct

what i am trying to explain is that this code CAN'T compile coz module is not like struct its like a part of code which adds specific option to struct in which it is implemented so modules must not have constructor create nor destructor onDestroy.

what i think is that you did not understand what destructor is. well destructor can be only one and one who tells how struct is destroyed module is not struct and private method onDestroy is == to method onDestroy -> remove that private it does nothing just confuses u...

here a little tutor just for u!

method create is a method which is auto created and is a method which by default allocates storage for struct

that method is called in following way:

JASS:
set myStruct = struct.create(arg...)

while onDestroy method is NOT a destroy method destroy method is a method which destroys struct and onDestroy is a keyword which tells when .destroy method is called what else should i do so private or public is all the same you are coding onDestroy two times and i think that you know you cant have two functions or methods with same name...

duno did you understand again what i wanted to say so you must test it on your own make your own test struct make constructor and destructor + implement your module

you will see what i mean.


K now gj on ur spell everything is fine now it works but in my option i would like you to reduce that extra trigger and library and make your module private in your main spell trigger but choose what you want since its your spell xD

once again 5/5 +rep!
~Dark Dragon
 
Level 16
Joined
Feb 22, 2006
Messages
960
as nerovesper said its now fixed well gj on ur spell 5/5 from me as well +rep

and about modules it works perfectly in your spell but i suggest you to delete that trigger and library it only slows stuff down and what i wanted to say seems i could not expalin with words so here an example:

JASS:
private struct triggerx
    private trigger t
    private triggeraction ta

    implement optional Module // lets say this is your one well i wont write action method

    method onDestroy takes nothing returns nothing
        call TriggerRemoveAction(this.t, this.ta)
        call DestroyTrigger(this.t)
        null...
    endmethod
endstruct

what i am trying to explain is that this code CAN'T compile coz module is not like struct its like a part of code which adds specific option to struct in which it is implemented so modules must not have constructor create nor destructor onDestroy.

what i think is that you did not understand what destructor is. well destructor can be only one and one who tells how struct is destroyed module is not struct and private method onDestroy is == to method onDestroy -> remove that private it does nothing just confuses u...

here a little tutor just for u!

method create is a method which is auto created and is a method which by default allocates storage for struct

that method is called in following way:

JASS:
set myStruct = struct.create(arg...)

while onDestroy method is NOT a destroy method destroy method is a method which destroys struct and onDestroy is a keyword which tells when .destroy method is called what else should i do so private or public is all the same you are coding onDestroy two times and i think that you know you cant have two functions or methods with same name...

duno did you understand again what i wanted to say so you must test it on your own make your own test struct make constructor and destructor + implement your module

you will see what i mean.


K now gj on ur spell everything is fine now it works but in my option i would like you to reduce that extra trigger and library and make your module private in your main spell trigger but choose what you want since its your spell xD

once again 5/5 +rep!
~Dark Dragon

hehe, I know what a destructor is, but what I do here is not creating the constructor and the onDestroy method also for the struct for the module but for the struct where the module is implemented^^
 
Level 16
Joined
Feb 22, 2006
Messages
960
it also should work for other people i only should add a comment that they dont need to create a onDestroy method :O^^

edit says: I have to test something :O
eidt2: okay i don't have to mention that because when script is compiled it throws an error that onDestroy is redeclared.... if you use this module you just have to set .active = false
 
Last edited:
Level 16
Joined
Feb 22, 2006
Messages
960
GroupUtils - Wc3campaigns, BoolexprUtils - Wc3campaigns

That module sure is efficient, but WHY is it a module? Far too specific, if you ask me.

thanks for the links, I know both systems but my grouprecylcer does the same (is not that complex but simple^^) and for thee boolexpr thing I wrote 1 small DummyFilter ;)

So to say the thruth I use this module because
1. I wanted to test modules
2. So I have not that much lines :D
 
Level 16
Joined
Feb 22, 2006
Messages
960
Then why dont you use GroupUtils, simply for the sake of building up a standard?
Why dont you abstract the DummyFilter into BoolexprUtils? That DummyFilter has nothing to do with your spell, so why do you implement it?

1. I used this grouprecycler because I had it around and made it aeons ago
2. why implementing BoolexprUtils when I just need 1 single function for the TriggerRegisterPlayerUnitEvent :O
 
Level 14
Joined
Nov 18, 2007
Messages
816
@1.) At least is the interface for GroupRecycler is the same as for GroupUtils. Else i would have asked you to use GroupUtils instead.
@2.) Because we have libraries for a reason. They separate unrelated code. They allow modular code. And they allow code reuse.
 
Top