Function not being called!

Status
Not open for further replies.
Level 11
Joined
Jun 30, 2008
Messages
580
When I use:

  • Custom script: call IndexWeapon('I001', 2, 'a002', 'a003', true, 0, 0, 0, 5, 0, 0, 0, 15, 5, 5, 'a004', "")
suppose to call:

JASS:
    function IndexWeapon takes integer whatitem, integer whatslot, integer whaticon, integer whatmodel, boolean whathand, integer str, integer agi, integer int, integer whatattack, integer whatarmor, integer whathealth, integer whatmana, integer whatcrit, integer whatmiss, integer whatstun, integer whatability, string whatani returns nothing
        set IA = IA + 1
        set ItemID[IA] = whatitem
        set ModelID[IA] = whatmodel
        set IconID[IA] = whaticon
        set slot[IA] = whatslot
        set hand[IA] = whathand
        set Vitality[IA] = str
        set Dexterity[IA] = agi
        set Focus[IA] = int
        set Ability[IA] = whatability
        set Attack[IA] = whatattack
        set Armor[IA] = whatarmor
        set Health[IA] = whathealth
        set Mana[IA] = whatmana
        set CritChance[IA] = whatcrit
        set MissChance[IA] = whatmiss
        set StunChance[IA] = whatstun
        set animation[IA] = whatani
        call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
    endfunction

But it says everything is setup without any errors, but it won't run, a footman is not created so I am thinking that the variables are not being saved.
 
JASS:
 function IndexWeapon takes integer whatitem, integer whatslot, integer whaticon, integer whatmodel, boolean whathand, integer str, integer agi, integer int, integer whatattack, integer whatarmor, integer whathealth, integer whatmana, integer whatcrit, integer whatmiss, integer whatstun, integer whatability, string whatani returns nothing
        call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
        call BJDebugMsg("1")
        set IA = IA + 1
        set ItemID[IA] = whatitem
        set ModelID[IA] = whatmodel
        set IconID[IA] = whaticon
        set slot[IA] = whatslot
        set hand[IA] = whathand
        set Vitality[IA] = str
        set Dexterity[IA] = agi
        call BJDebugMsg("2")
        set Focus[IA] = int
        set Ability[IA] = whatability
        set Attack[IA] = whatattack
        set Armor[IA] = whatarmor
        set Health[IA] = whathealth
        set Mana[IA] = whatmana
        set CritChance[IA] = whatcrit
        set MissChance[IA] = whatmiss
        set StunChance[IA] = whatstun
        set animation[IA] = whatani
        call BJDebugMsg("3")
        
    endfunction

Only the "1" is being displayed... that means everything with the variables aren't being called.
 
JASS:
 function IndexWeapon takes integer whatitem, integer whatslot, integer whaticon, integer whatmodel, boolean whathand, integer str, integer agi, integer int, integer whatattack, integer whatarmor, integer whathealth, integer whatmana, integer whatcrit, integer whatmiss, integer whatstun, integer whatability, string whatani returns nothing
        call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
        call BJDebugMsg("1")
        set IA = IA + 1
        set ItemID[IA] = whatitem
        set ModelID[IA] = whatmodel
        set IconID[IA] = whaticon
        set slot[IA] = whatslot
        set hand[IA] = whathand
        set Vitality[IA] = str
        set Dexterity[IA] = agi
        call BJDebugMsg("2")
        set Focus[IA] = int
        set Ability[IA] = whatability
        set Attack[IA] = whatattack
        set Armor[IA] = whatarmor
        set Health[IA] = whathealth
        set Mana[IA] = whatmana
        set CritChance[IA] = whatcrit
        set MissChance[IA] = whatmiss
        set StunChance[IA] = whatstun
        set animation[IA] = whatani
        call BJDebugMsg("3")
        
    endfunction

Only the "1" is being displayed... that means everything with the variables aren't being called.

from the trigger it seems that IA is a global, just set it to 0 in the global declaration.
 
Status
Not open for further replies.
Back
Top