• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Ivalid argument (integer)

Status
Not open for further replies.
Level 6
Joined
Oct 1, 2012
Messages
166
Heloes Hive Workshop

I've encountered a slight problem with this line in my function:

JASS:
call UnitAddAbilityBJ ('A016', GetLastCreatedUnit())

the editor says that it's 'Invalid argument (integer)'. I searched some web, nothing seems to be the problem. What's more, when I made same thing in GUI and converted it afterwards, there was no problem in converted trigger. After copying it to my own JASS trigger, despite looking the same, the same error would occur, as it prevously did. To make it anyhow more clear I'll post the rest of the trigger's part.

JASS:
call CreateNUnitsAtLoc(1, 'H002', GetPlayerId(GetOwningPlayer(caster)), GetUnitLoc(caster), bj_UNIT_FACING) 
    call UnitAddAbilityBJ ('A016', GetLastCreatedUnit())
    call IssueTargetOrderBJ (GetLastCreatedUnit(), "thunderbolt", cel)
    call RemoveUnit (GetLastCreatedUnit())

Any ideas, maybe?
 
Level 6
Joined
Oct 1, 2012
Messages
166
Yup, I know about the BJ's. Swapping doesn't work, I get the same error. It is kinda weird though, as, just like I said, the same trigger converted from GUI works.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Sometimes JASShelper can throw unreal arguments if theres an unclosed if-then-else, loop, function, struct, library, etcetc. Make sure all of them are closed. For example

JASS:
function a takes nothing returns nothing
if true then
call UnitAddAbilityBJ(0,unit)
endfunction
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, it is inside of a loop, but the loop is closed.
Maybe I'll post the whole if/then/else function

JASS:
if (LoadIntegerBJ(1, GetPlayerId(GetOwningPlayer(caster)) +1, udg_Tablica_Manipulator) == 1) then
    set efekt = "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl"
    set mnoznik = 2.4
    set ta = ATTACK_TYPE_MAGIC
    set to = DAMAGE_TYPE_FIRE
    elseif (LoadIntegerBJ(1, GetPlayerId(GetOwningPlayer(caster)) +1, udg_Tablica_Manipulator) == 2) then
    set efekt = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
    set mnoznik = 1.8
    set ta = ATTACK_TYPE_MAGIC
    set to = DAMAGE_TYPE_COLD
    call CreateNUnitsAtLoc(1, 'h002', GetPlayerId(GetOwningPlayer(caster)), GetUnitLoc(caster), 0.00) 
    call UnitAddAbility( GetLastCreatedUnit(), 'A01L' )
    call IssueTargetOrderBJ (GetLastCreatedUnit(), "frostnova", cel)
    call RemoveUnit (GetLastCreatedUnit())
    elseif (LoadIntegerBJ(1, GetPlayerId(GetOwningPlayer(caster)) +1, udg_Tablica_Manipulator) == 3) then
    set efekt = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
    set mnoznik = 1.5
    set ta = ATTACK_TYPE_SIEGE
    set to = DAMAGE_TYPE_NORMAL
    call CreateNUnitsAtLoc(1, 'H002', GetPlayerId(GetOwningPlayer(caster)), GetUnitLoc(caster), 0.00) 
    call UnitAddAbility (GetLastCreatedUnit(), 'A016')
    call IssueTargetOrderBJ (GetLastCreatedUnit(), "thunderbolt", cel)
    call RemoveUnit (GetLastCreatedUnit())
    elseif (LoadIntegerBJ(1, GetPlayerId(GetOwningPlayer(caster)) +1, udg_Tablica_Manipulator) == 4) then
    set efekt = "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl"
    set mnoznik = 2.0
    set ta = ATTACK_TYPE_MAGIC
    set to = DAMAGE_TYPE_LIGHTNING
    elseif (LoadIntegerBJ(1, GetPlayerId(GetOwningPlayer(caster)) +1, udg_Tablica_Manipulator) == 5) then
    set efekt = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
    set mnoznik = 2.5
    set ta = ATTACK_TYPE_MAGIC
    set to = DAMAGE_TYPE_DIVINE
    else
    set efekt = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
    set mnoznik = 2.5
    set ta = ATTACK_TYPE_PIERCE
    set to = DAMAGE_TYPE_NORMAL
    endif

mnoznik means % damage for the skill, I also set attack types and special effects taking place when casting certain spell. When the given hashtable value is 2 or 3, then the spell also causes additiona effects. Whithout them, it all works. Also, as I said prvously, the same function in GUI, when converted to JASS, worked perfectly.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
can u paste the full trigger ? also u should use a local integer variable for GetPlayerId(GetOwningPlayer(caster)) +1 since u call it so many times. also make a unit variable and do set unit = createunit( stuff in here). locations leak if not removed and since ur using jass use the x y values tht way u dont have to null or destroy them.( no leaks)
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, after you said all this I looked at the trigger and saw what's the problem - instead of Player data I inserted player number in place, where I say what player will get the dummy.
Thanks anyawy :p
 
Status
Not open for further replies.
Top