• 🏆 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!

Whats wrong with this?

Status
Not open for further replies.
Level 12
Joined
Dec 10, 2008
Messages
850
So as of late I've been converting alot of my map into JASS from GUI, but after I just finished re-coding 2 spells and trying to do another, I get an error from something that has never errored before. The best part? Its a freaking GUI thing, and its super crazy simple, but I cant see why NewGen is flagging it as an error....
JASS:
function Trig_FlameThrower_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetAttacker()) == 'h004' ) ) then
        return false
    endif
    if ( not ( GetUnitTypeId(GetAttacker()) == 'H00D' ) ) then
        return false
    endif
    return true
endfunction

function Trig_FlameThrower_Actions takes nothing returns nothing
    call AddSpecialEffectTargetUnitBJ( "weapon", GetAttacker(), "war3mapImported\\Konstrukt_FlameThrowerEffektAttachment.MDX" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
The condition line errors everytime
  • FlameThrower
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to FlameThrower
      • (Unit-type of (Attacking unit)) Equal to ABEM Flame
    • Actions
      • Special Effect - Create a special effect attached to the weapon of (Attacking unit) using war3mapImported\Konstrukt_FlameThrowerEffektAttachment.MDX
      • Special Effect - Destroy (Last created special effect)
Whats going on with this?
 
Level 8
Joined
Aug 3, 2008
Messages
391
JASS:
function Trig_FlameThrower_Conditions takes nothing returns boolean
    if ( ( GetUnitTypeId(GetAttacker()) == 'h004' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'H00D' ) ) then
        return true
    endif
    return false
endfunction

I don't know if that makes a diffrence, but that's the default thing I get when I convert from GUI to JASS.
 
Level 11
Joined
May 16, 2007
Messages
288
Weird, I CnP the trigger to my NewGen and it displays no errors...

Ok, there are only 2 things that could be causing this error:

1 - You didn't post the trigger here correctly, and the bug doesn't appear (very unlikely).

2 - The most probable option, but also the worst possible, a bug in NewGen caused by a syntax error in another trigger that doesn't display correctly and appears as if the error was in this trigger.

How to fix it if it's 2:
This won't be easy, sorry, but you've got to disable every other trigger in your map, and then enable them one by one, each time checking if the bug appears, when it appears, you have to search the trigger that is causing it for any possible syntax errors.

Possible syntax errors that cause it:
- An endfunction ending no function (basically, an endfunction in the middle of nowhere, with no funcion that it ends).
- Endloop, endmethod, endif ending no loop/method/if (same thing as above).
- Missing "(" or ")" in a function call.

These are the things that already happened to me that were causing it, I don't know if there are others (probably are).

Hope this post helped.
 
Level 12
Joined
Dec 10, 2008
Messages
850
facepalm.jpg

I missed an endfunction in a scope... $##^$$&*(%*^%$$&$^#^..........&*^%$%^&*^%$
 
Level 8
Joined
Feb 15, 2009
Messages
463
Due there is no wrong point in that ,
JASS:
function Trig_FlameThrower_Conditions takes nothing returns boolean
    if ( ( GetUnitTypeId(GetAttacker()) == 'h004' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'H00D' ) ) then
        return true
    endif
    return false
endfunction
i would write it like this coz it makes your code cleaner and smaller
JASS:
function Trig_FlameThrower_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetAttacker()) == 'h004' or GetUnitTypeId(GetAttacker()) =='H00D'
endfunction

may be u just have some mistakes with following signs "!/()='.,


and probably go for vJass making spells in scope to use private... and this sheet but i think thats not the point here
 
Level 8
Joined
Feb 15, 2009
Messages
463
Due there is no wrong point in that ,
JASS:
function Trig_FlameThrower_Conditions takes nothing returns boolean
    if ( ( GetUnitTypeId(GetAttacker()) == 'h004' ) ) then
        return true
    endif
    if ( ( GetUnitTypeId(GetAttacker()) == 'H00D' ) ) then
        return true
    endif
    return false
endfunction
i would write it like this coz it makes your code cleaner and smaller
JASS:
function Trig_FlameThrower_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetAttacker()) == 'h004' or GetUnitTypeId(GetAttacker()) =='H00D'
endfunction

may be u just have some mistakes with following signs "!/()='.,


and probably go for vJass making spells in scope to use private... and this sheet but i think thats not the point here
 
Status
Not open for further replies.
Top