• 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.

Jass Syntax Error setting local

Status
Not open for further replies.
Level 6
Joined
Sep 11, 2006
Messages
172
I seem to be having some trouble designating a local player (p) variable in my script.

JASS:
function InitGlobals takes nothing returns nothing
endfunction

function Trig_To_Mansion_Front_Copy_Actions takes nothing returns nothing
    local player p
    set local player p=GetOwningPlayer(GetTriggerUnit())
    if GetLocalPlayer()==p then
    call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
    call SetCineFilterStartColor(0,0,0,0)
    call SetCineFilterEndColor(0,0,0,255)
    call SetCineFilterDuration(2) // fades within 2 seconds
    call DisplayCineFilter(true)
    endif
    call TriggerSleepAction( 2 )
    call SetUnitPositionLocFacingBJ( GetTriggerUnit(), GetRectCenter(gg_rct_Region_012), bj_UNIT_FACING )
    if GetLocalPlayer()==p then
    call SetCineFilterStartColor(0,0,0,255)
    call SetCineFilterEndColor(0,0,0,0)
    call SetCineFilterDuration(2) // fades in within 2 seconds
    call DisplayCineFilter(true)
    endif
    set p=null
endfunction

//===========================================================================
function InitTrig_To_Mansion_Front_Copy takes nothing returns nothing
    set gg_trg_To_Mansion_Front_Copy = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_To_Mansion_Front_Copy, gg_rct_Region_006 )
    call TriggerAddAction( gg_trg_To_Mansion_Front_Copy, function Trig_To_Mansion_Front_Copy_Actions )
endfunction

The error pops up even if i try to declare the variable on the same line that i call from.

I'm very new to Jass and I'm probably missing something totally obvious, but I just cant pick it out yet.

Any help would be greatly appreciated ^w^
 
Level 15
Joined
Jul 6, 2009
Messages
889
=( I get no error on:

JASS:
function Action takes nothing returns nothing
    local player p=GetOwningPlayer(GetTriggerUnit())
    if GetLocalPlayer()==p then
    call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
    call SetCineFilterStartColor(0,0,0,0)
    call SetCineFilterEndColor(0,0,0,255)
    call SetCineFilterDuration(2) // fades within 2 seconds
    call DisplayCineFilter(true)
    endif
    call TriggerSleepAction( 2 )
    call SetUnitPositionLocFacingBJ( GetTriggerUnit(), GetRectCenter(null), bj_UNIT_FACING )
    if GetLocalPlayer()==p then
    call SetCineFilterStartColor(0,0,0,255)
    call SetCineFilterEndColor(0,0,0,0)
    call SetCineFilterDuration(2) // fades in within 2 seconds
    call DisplayCineFilter(true)
    endif
    set p=null
endfunction

//===========================================================================
function InitTrig_To_Mansion_Front_Copy takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterEnterRectSimple( t, null )
    call TriggerAddAction( t, function Action )
endfunction
 
Level 6
Joined
Sep 11, 2006
Messages
172
Ill just post the whole trigger here, as it appears on the WE checker. Its not letting me enable the trigger so something must be off. Thank you for looking at it. I really just started learning all this stuff x3

//***************************************************************************
//*
//* Global Variables
//*
//***************************************************************************

JASS:
globals
    // User-defined
    sound                   udg_sound                  = null

    // Generated
    rect                    gg_rct_Region_000          = null
    rect                    gg_rct_Region_001          = null
    rect                    gg_rct_Region_002          = null
    rect                    gg_rct_Region_003          = null
    rect                    gg_rct_Region_004          = null
    rect                    gg_rct_Region_005          = null
    rect                    gg_rct_Region_006          = null
    rect                    gg_rct_Region_007          = null
    rect                    gg_rct_Region_008          = null
    rect                    gg_rct_Region_009          = null
    rect                    gg_rct_Region_010          = null
    rect                    gg_rct_Region_011          = null
    rect                    gg_rct_Region_012          = null
    rect                    gg_rct_Region_013          = null
    rect                    gg_rct_Region_014          = null
    sound                   gg_snd_door_1_open         = null
    sound                   gg_snd_door_1_close        = null
    trigger                 gg_trg_Melee_Initialization = null
    trigger                 gg_trg_OpenClose           = null
    trigger                 gg_trg_OpenClose_Copy      = null
    trigger                 gg_trg_OpenClose_Copy_2    = null
    trigger                 gg_trg_OpenClose_Copy_3    = null
    trigger                 gg_trg_OpenClose_Copy_4    = null
    trigger                 gg_trg_To_Mansion_Front    = null
    trigger                 gg_trg_To_Inside_Mansion   = null
    trigger                 gg_trg_To_Top_Floor        = null
    trigger                 gg_trg_To_Bottom_Floor     = null
    trigger                 gg_trg_Test_1              = null
    destructable            gg_dest_B002_0402          = null
    destructable            gg_dest_B003_0445          = null
    destructable            gg_dest_B005_0446          = null
    destructable            gg_dest_B005_0447          = null
    destructable            gg_dest_B003_0448          = null
endglobals

function InitGlobals takes nothing returns nothing
endfunction

function Trig_To_Mansion_Front_Actions takes nothing returns nothing
    set udg_sound = null
    if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
    set udg_sound = gg_snd_door_1_open
    endif
    call PlaySoundBJ( udg_sound )
    local player p
    set p = GetOwningPlayer(GetTriggerUnit())
    if GetLocalPlayer()==p then
    call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\Black_mask.blp")
    call SetCineFilterStartColor(0,0,0,0)
    call SetCineFilterEndColor(0,0,0,255)
    call SetCineFilterDuration(2) // fades within 2 seconds
    call DisplayCineFilter(true)
    endif
    call TriggerSleepAction( 2 )
    call SetUnitPositionLocFacingBJ( GetTriggerUnit(), GetRectCenter(gg_rct_Region_012), bj_UNIT_FACING )
    if GetLocalPlayer()==p then
    call SetCineFilterStartColor(0,0,0,255)
    call SetCineFilterEndColor(0,0,0,0)
    call SetCineFilterDuration(2) // fades in within 2 seconds
    call DisplayCineFilter(true)
    endif
    set p=null
endfunction

//===========================================================================
function InitTrig_To_Mansion_Front takes nothing returns nothing
    set gg_trg_To_Mansion_Front = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_To_Mansion_Front, gg_rct_Region_006 )
    call TriggerAddAction( gg_trg_To_Mansion_Front, function Trig_To_Mansion_Front_Actions )
endfunction

I can post the map as well if you want to take a look. I probably shouldn't be messing with local players right now, but I want to knock that out before I move on to the other stuffs :3

The script works fine until after the
call PlaySoundBJ( udg_sound )
 
Status
Not open for further replies.
Top