• 🏆 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] Array problem

Status
Not open for further replies.
Level 10
Joined
Sep 3, 2009
Messages
458
So I made a global integer array called ATTACK_ANIM[15] then set values in the different arrays respectively but for some reason I get errors, mainly:

*syntax error
*3 lines of undefined type ATTACK_ANIM

dunno what I'm doing wrong.

here's the code
JASS:
globals
        constant integer ATTACK_BUFF_ID = 'B001'
        constant integer ATTACK_DUMMY_ID = 'u003'
        constant integer ATTACK_DUMMY_ABILITY_ID = 'A006'
        
        constant string  ATTACK_BUFF_ORDER = "bloodlust"
        constant string  ATTACK_ORDER_ID = "holdposition"
        
        integer array ATTACK_ANIM[15]
        
        set ATTACK_ANIM[1] = 4
        set ATTACK_ANIM[2] = 5
        set ATTACK_ANIM[3] = 2
        
    endglobals

can anyone help me out?

EDIT: The undeclared part should be undefined
 
JASS:
scope guy initializer init
    globals
        constant integer ATTACK_BUFF_ID = 'B001'
        constant integer ATTACK_DUMMY_ID = 'u003'
        constant integer ATTACK_DUMMY_ABILITY_ID = 'A006'
        
        constant string  ATTACK_BUFF_ORDER = "bloodlust"
        constant string  ATTACK_ORDER_ID = "holdposition"
        
        integer array ATTACK_ANIM // there is no way to manually cap your array in JASS.
                            // vJass "allows" it but it is slower than using normal arrays and not advised,
                            // because it uses stupid methods to protocol things like that.
        
    endglobals
    private function init takes nothing returns nothing // always make an initializer private
        set ATTACK_ANIM[0] = 4 // arrays start at 0, not 1.
        set ATTACK_ANIM[1] = 5
        set ATTACK_ANIM[2] = 2
    endfunction
endscope
 
Status
Not open for further replies.
Top