• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[JASS] Trigger issue.

Status
Not open for further replies.
Level 6
Joined
Oct 10, 2009
Messages
1,426
[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:
Yes, I am more than 100% sure.
Untitled1.jpg

Unless the array size affects it somehow?
 
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.
Back
Top