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

[JASS] Trigger issue.

Status
Not open for further replies.
Level 6
Joined
Oct 10, 2009
Messages
1,425
[solved] Trigger issue.

Solved

Hello again.
I have a slight issue with this trigger.
The line if GetTriggerPlayer() == udg_Mayors_Copy[1] has an issue.
It says the syntax is wrong because it's comparing to variable of different types. The variables are the same type, but the trigger is stupid and doesn't know that.
It won't let me run the map because of this issue and it's very annoying.
I'm sure it's this line as well.
How can I work around this?
Here's the full code if needed:
JASS:
function Conditions_Spy_232 takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Trig_Spy_Actions takes nothing returns nothing
    local location loc
    if GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD) < 1500 then
        call DisplayTextToPlayer(GetTriggerPlayer(),0,0,"Not enough gold.")
        call UnitResetCooldown(GetTriggerUnit())
       return
    endif
    if GetTriggerPlayer() == udg_Mayors_Copy[1] then
    set loc = gg_rct_spyT1
    else
    set loc = gg_rct_spyT2
    endif
    call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD)-1500)
    call CreateUnitAtLoc(GetTriggerPlayer(),'XXZZ',loc,GetRandomReal(0,359))
    call PanCameraToLocForPlayer(GetTriggerPlayer(),loc)
    call RemoveLocation(loc)
endfunction

//===========================================================================
function InitTrig_Spy takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddAction( t, function Trig_Spy_Actions )
    call TriggerAddCondition(t,Condition(function Conditions_Spy_232))
endfunction
Will reward with rep, of course. <3
Oh, and any tips you can give me on how to remove a few bjs or compress the code more are also welcomed with rep. <3
 
Last edited:
Level 6
Joined
Oct 10, 2009
Messages
1,425
Yes, I am more than 100% sure.
Untitled1.jpg

Unless the array size affects it somehow?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Weird, then. It's usually pretty good about giving correct line numbers, but after experience with several compilers (notably wc3's default compiler, but also for many languages which use semicolon-based linebreaks) I've gotten used to checking for errors in the lines above and below the listed error as well.
 
Status
Not open for further replies.
Top