• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Jass Error: deallocate is not a member of..

Status
Not open for further replies.
Level 2
Joined
Jan 7, 2013
Messages
13
Can anyone help?
I ill be tankfully here is the print about the error:

Code:
//***********************************************************************
//*                                                                     *
//*                            Stunning Ward                            *
//*                            By: Deuterium                            *
//*                                                                     *
//***********************************************************************
//*                                                                     *
//* Spell Description:                                                  *
//*                                                                     *
//*     The caster creates a temporal ward which mini-stuns enemy units *
//*     at a certain range.                                             *
//*                                                                     *
//***********************************************************************
//*                                                                     *
//* How to adjust and customize:                                        *
//*                                                                     *
//*     Simply adjust the settings found between the two tags:          *
//*     ADJUSTABLES/ADJUSTABLES END                                     *
//*                                                                     *
//***********************************************************************
//*                                                                     *
//* How to import:                                                      *
//*                                                                     *
//*     1. Copy and paste the abilities "Stunning Ward" and             *
//*        "SW_MiniStun" in the Object Editor into your map.            *
//*                                                                     *
//*     2. Copy and paste the unit "SW_Ward" in the Object Editor into  *
//*        your map.                                                    *
//*                                                                     *
//*     3. Copy and paste the trigger "Stunning Ward" and in the        *
//*        Trigger Editor into your map.                                *
//*                                                                     *
//*     4. Adjust the ID's present among the adjustable variables.      *
//*                                                                     *
//***********************************************************************
//* Changelog:                                                          *
//*                                                                     *
//*     v1.00:                                                          *
//*         - Released                                                  *
//*                                                                     *
//*     v1.01:                                                          *
//*         - Converted from GUI to vJass                               *
//*                                                                     *
//***********************************************************************
//*                                                                     *
//* Credit is appreciated.                                              *
//*                                                                     *
//***********************************************************************



scope StunningWard

globals
    private real array STUN_INTERVAL_TIME
    private real array STUN_INTERVALS
    private real array STUN_RADIUS
endglobals

//===========================================================================
        
    ////////////////////////////////////
    //          ADJUSTABLES           //
    ////////////////////////////////////
      
    globals
        
        // --- IDs ---
        private constant integer    ABILITY_ID                      = 'A005'            // The ID of the Balminess ability
        private constant integer    STUN_ABILITY_ID                 = 'A006'            // The ID of the SW_MiniStun ability
        private constant integer    WARD_ID                         = 'h001'            // The ID of the SW_Ward unit
    
        // --- Spell setting ---
        private constant boolean    WARD_INVULNERABLE               = false              // If set to true, ward is invulnerable
                                                                                        // If set to false, ward isn't invulnerable
        
    endglobals
    
    private function Setup takes nothing returns nothing
    
        // General Setup note:
        //      the array integer refers to the level of the intended ability
        
        
        // --- Stun settings ---
        
        // The time gap between each stun instance
        set STUN_INTERVAL_TIME[1] = 1.
        set STUN_INTERVAL_TIME[2] = 1.
        set STUN_INTERVAL_TIME[3] = 1.
        set STUN_INTERVAL_TIME[4] = 1.
        
        // The number of stun intervals plus the initial stun
        set STUN_INTERVALS[1] = 6
        set STUN_INTERVALS[2] = 8
        set STUN_INTERVALS[3] = 10
        set STUN_INTERVALS[4] = 12
        
        // The radius around the ward at which stunning takes effect
        set STUN_RADIUS[1] = 400.
        set STUN_RADIUS[2] = 400.
        set STUN_RADIUS[3] = 400.
        set STUN_RADIUS[4] = 400.
        
    endfunction

    //! objectediting
    
        // Stun duration (Ability Editor -- SW_MiniStun):
        //      Adjust "Level # - Stats - Duration" to the required values.
    
            
        // AoE targetting image size (Ability Editor -- Stunning Ward):
        //      Adjust "Level # - Area of Effect" to the required values.
    
    //! endobjectediting    
    
    ////////////////////////////////////
    //        ADJUSTABLES END         //
    ////////////////////////////////////
    
//===========================================================================

private struct SW

//= Struct Variables ========================================================

    unit tr     // Triggering unit
    player pt   // Triggering player
    integer lvl // Ability level
    
    unit w      // Ward
    real x      // Ward's X
    real y      // Ward's Y
    
    group g     // Group
    
    integer ico  // Interval counter
    
    timer time  // Timer
    
    static SW Temp

//= onDestroy ===============================================================

    private method destroy takes nothing returns nothing
        call PauseTimer(this.time)
        call FlushTimerUserData(this.time)
        call DestroyTimer(this.time)
        
        call DestroyGroup(this.g)
        
        set this.tr     = null
        set this.pt     = null
        set this.w      = null
        set this.g      = null
        set this.time   = null
        set this.ico     = 0
        
        debug call BJDebugMsg("|cffc3dbffStunning Ward:|r Struct instance |cffff0000" + I2S(this) + "|r destroyed")
        debug call BJDebugMsg(" ")
        
        call .deallocate()
    endmethod
    
//= Stun ==================================================================    

    private static method FilterOut takes nothing returns boolean
        set bj_lastCreatedUnit = GetFilterUnit()
        return (IsUnitEnemy(bj_lastCreatedUnit, SW.Temp.pt) == true) and (IsUnitType(bj_lastCreatedUnit, UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(bj_lastCreatedUnit, UNIT_TYPE_MECHANICAL) == false) and (IsUnitType(bj_lastCreatedUnit, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitType(bj_lastCreatedUnit, UNIT_TYPE_DEAD) == false)
    endmethod
    
    private static method GroupLoop takes nothing returns nothing
        call DummyCastTargetDT(SW.Temp.pt, GetEnumUnit(), STUN_ABILITY_ID, "thunderbolt", SW.Temp.lvl)
    endmethod

    private static method RunStun takes integer i returns nothing
        local SW d = i
        call GroupEnumUnitsInRange(d.g, d.x, d.y, STUN_RADIUS[d.lvl], Condition(function SW.FilterOut))
        call ForGroup(d.g, function SW.GroupLoop)
        call GroupClear(d.g)
        call DestroyCondition(Condition(function SW.FilterOut))
    endmethod

//= Timed Actions =========================================================

    private static method Loop takes nothing returns nothing
    
        // --- Announcing instance and running timer counter ---
        local SW d = SW(GetTimerUserData(GetExpiredTimer()))
        set SW.Temp = integer(d)
        set d.ico = d.ico + 1
        
        // --- Debug ---
        debug call BJDebugMsg("|cffc3dbffStunning Ward:|r Stunned -- Stun instance: " + I2S(d.ico))
        debug call BJDebugMsg("|cffffcc00Struct instance:|r |cffff0000" + I2S(d) + "|r")
        debug call BJDebugMsg(" ")
        
        // --- Checking if ward is dead ---
        if IsUnitType(d.w, UNIT_TYPE_DEAD) then
            debug call BJDebugMsg("|cffc3dbffStunning Ward:|r Ward died")
            debug call BJDebugMsg("|cffffcc00Struct instance:|r |cffff0000" + I2S(d) + "|r")
            debug call BJDebugMsg(" ")
            
            call d.destroy()
            return
        endif
        
        // --- Stunning ---
        call SW.RunStun(d)
        
        // --- Checking if all intervals ran ---
        if d.ico >= STUN_INTERVALS[d.lvl] then
            debug call BJDebugMsg("|cffc3dbffStunning Ward:|r All intervals ran")
            debug call BJDebugMsg("|cffffcc00Struct instance:|r |cffff0000" + I2S(d) + "|r")
            debug call BJDebugMsg(" ")
        
            call d.destroy()
        endif
    endmethod

//= Initial Actions =========================================================

    private static method Create takes nothing returns nothing
    
        // --- Allocating new instance ---
        local SW d = SW.allocate()
        set SW.Temp = integer(d)
        
        // --- Debug ---
        debug call BJDebugMsg("|cffc3dbffStunning Ward:|r Initiated")
        debug call BJDebugMsg("|cffffcc00Struct instance:|r |cffff0000" + I2S(d) + "|r")
        debug call BJDebugMsg(" ")
        
        // --- Setting some variables ---
        set d.tr = GetTriggerUnit()
        set d.pt = GetOwningPlayer(d.tr)
        set d.lvl = GetUnitAbilityLevel(d.tr, ABILITY_ID)
        
        // --- Creating ward ---
        set d.w = CreateUnit(d.pt, WARD_ID, GetSpellTargetX(), GetSpellTargetY(), bj_UNIT_FACING)
        
        set d.x = GetUnitX(d.w)
        set d.y = GetUnitY(d.w)
        
        call UnitApplyTimedLife(d.w, 'BTLF', STUN_INTERVALS[d.lvl] * STUN_INTERVAL_TIME[d.lvl])
        if WARD_INVULNERABLE then
            call SetUnitInvulnerable(d.w, true)
        endif
        
        // --- Running stun ---
        set d.g = CreateGroup()
        call SW.RunStun(d)
        
        // --- Running timer ---
        set d.time = CreateTimer()
        call SetTimerUserData(d.time, integer(d))
        call TimerStart(d.time, STUN_INTERVAL_TIME[d.lvl], true, function SW.Loop)
    endmethod

//= Condition and Initializer ===============================================

    private static method ConditionCheck takes nothing returns boolean
        return GetSpellAbilityId() == ABILITY_ID
    endmethod

    private static method onInit takes nothing returns nothing
        call SpellInitDT(EVENT_PLAYER_UNIT_SPELL_EFFECT, function SW.Create, function SW.ConditionCheck)
        call Setup()
        
        call PreloadUnitDT(WARD_ID)
    endmethod
    
endstruct

endscope
Thanks Sincerely,
Jamal XVI
 
Level 2
Joined
Jan 7, 2013
Messages
13
Don't u have to do call this.deallocate() ? I'm not really sure tho lol

So this is the problem.The script is not mine.The original script is made by Deuterium but i dont know what object its refer i ill edit the post and pass the code to you see.
Thanks,
Jamal XVI
 
Level 2
Joined
Jan 7, 2013
Messages
13
.deallocate() and this.deallocate() are the same. You can leave out the this or write it.

The script compiled for me when I disable all external library function calls.

Do you have the latest version of jasshelper? I have 0.A.2.B

mine is 0.9.I.2, how can i update?
 
Status
Not open for further replies.
Top