Local Player Custom Script Question

S

shadowvzs

Guest
i dont can use variable inside the this custom script?
i need this, exemple:
Code:
Set Player = (Triggering player)
Set TempInteger = (Player number of Player)
Custom script:   Custom script:   if GetLocalPlayer() == Player(udg_TempInteger) then
Cinematic - Apply a filter over 4.00 seconds using Normal blending on texture Black Mask, starting with color (0.00%, 0.00%, 0.00%) and 100.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
Custom script:   endif

and work if i want change player group to local player? exempl:
Code:
Dodo
    Events
        Unit - A unit enters Dodo Forest <gen>
    Conditions
        (Quests[0] is discovered) Equal to False
        (Entering unit) Equal to MyHero[(Player number of (Owner of (Entering unit)))]
    Actions
        Quest - Flash the quest dialog button
        Quest - Mark Quests[0] as Discovered
        Camera - Lock camera target for (Owner of (Triggering unit)) to (Triggering unit), offset by (0.00, 0.00) using Default rotation
        Camera - Set (Owner of (Triggering unit))'s camera Distance to target to 600.00 over 2.00 seconds
        Camera - Set (Owner of (Triggering unit))'s camera Angle of attack to 340.00 over 2.00 seconds
        Camera - Set (Owner of (Triggering unit))'s camera Rotation to ((Facing of (Triggering unit)) + 180.00) over 2.00 seconds
        Camera - Set (Owner of (Triggering unit))'s camera Height Offset to 75.00 over 2.00 seconds
Custom script:   Custom script:   if GetLocalPlayer() == Player(0) then
        Cinematic - Turn cinematic mode On for (All players)
        Cinematic - Send transmission to (All players) from (Triggering unit) named (Name of (Triggering unit)): Play No sound and display Oh yeah, i found th....  Modify duration: Set to 3.00 seconds and Wait
        Wait 3.00 seconds
        Cinematic - Turn cinematic mode Off for (All players)
Custom script:   Custom script:   endif
        Camera - Reset camera for (Owner of (Triggering unit)) to standard game-view over 2.00 seconds
        Trigger - Turn off (This trigger)

i dont like playergroup there because if i use unit transmission and 2 player have trans mission then playergroup will be overwrited and first player dont have cinematic mode off
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Yes, you can do that, but it would be better just to use a player variable:
Code:
Set Player = (Triggering player)
Custom script:   Custom script:   if GetLocalPlayer() == udg_Player then
Cinematic - Apply a filter over 4.00 seconds using Normal blending on texture Black Mask, starting with color (0.00%, 0.00%, 0.00%) and 100.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
Custom script:   endif
If you do it with the integer variable, you should know that Player 1 in JASS is Player(0); Player 2 (Blue) is Player(1); Player 12 (Brown) is Player(11). Thus, you'd do this:
Code:
Set TempInteger = (Player number of Player) - 1


EDIT: There is no need for the LocalPlayer() if block in your new code. You're doing things for All Players inside the block, which will cause desyncs.
 
S

shadowvzs

Guest
Yes, you can do that, but it would be better just to use a player variable:
Code:
Set Player = (Triggering player)
Custom script:   Custom script:   if GetLocalPlayer() == udg_Player then
Cinematic - Apply a filter over 4.00 seconds using Normal blending on texture Black Mask, starting with color (0.00%, 0.00%, 0.00%) and 100.00% transparency and ending with color (100.00%, 100.00%, 100.00%) and 0.00% transparency
Custom script:   endif
If you do it with the integer variable, you should know that Player 1 in JASS is Player(0); Player 2 (Blue) is Player(1); Player 12 (Brown) is Player(11). Thus, you'd do this:
Code:
Set TempInteger = (Player number of Player) - 1


EDIT: There is no need for the LocalPlayer() if block in your new code. You're doing things for All Players inside the block, which will cause desyncs.

2 expected a code statement error

HTML:
function Trig_Create_Ur_Hero_Actions takes nothing returns nothing
    set udg_Player = GetTriggerPlayer()
    [b]Custom script:   if GetLocalPlayer() == udg_Player then[/b]
    call CinematicFilterGenericBJ( 5.00, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00, 0 )
    [b]endif[/b]
    set udg_Tempory_nr[14] = 0
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 4
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Create_Ur_Hero_Func006Func001C() ) then
            set udg_Temp_point[1] = GetRandomLocInRect(gg_rct_StartLocation)
            call CreateNUnitsAtLoc( 1, udg_SaveLoad_Heroes[( 25 + GetForLoopIndexA() )], udg_Player, udg_Temp_point[1], bj_UNIT_FACING )
            call RemoveLocation(udg_Temp_point[1])
            call SetUnitAbilityLevelSwapped( 'A03A', GetLastCreatedUnit(), ( GetForLoopIndexA() + 1 ) )
            call SetPlayerHandicapXPBJ( GetOwningPlayer(GetLastCreatedUnit()), ( 150.00 * I2R(udg_Number_of_player) ) )
            call ShowUnitHide( GetLastCreatedUnit() )
            set udg_MyHero[GetConvertedPlayerId(udg_Player)] = GetLastCreatedUnit()
            call RemoveLocation(udg_Temp_point[1])
            set udg_Point = GetRandomLocInRect(gg_rct_Ship)
            call CreateNUnitsAtLoc( 1, 'nbot', udg_Player, udg_Point, 90.00 )
            call SetUnitPositionLocFacingBJ( GetLastCreatedUnit(), udg_Point, 90.00 )
            call RemoveLocation(udg_Point)
            set udg_Point = GetRandomLocInRect(gg_rct_ShipDock)
            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_Point )
            call RemoveLocation(udg_Point)
            set udg_PlayerGroup = GetForceOfPlayer(udg_Player)
            call CinematicModeBJ( true, udg_PlayerGroup )
            call DestroyForce (udg_PlayerGroup)
            set udg_Point = GetUnitLoc(GetLastCreatedUnit())
            call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetLastCreatedUnit()), udg_Point, 0 )
            call RemoveLocation(udg_Point)
            call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(GetLastCreatedUnit()), GetLastCreatedUnit(), 0, 0, false )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_TARGET_DISTANCE, 800.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ROTATION, 25.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ANGLE_OF_ATTACK, 355.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ZOFFSET, 150.00, 2.00 )
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    if ( Trig_Create_Ur_Hero_Func007C() ) then
        set udg_Player = GetTriggerPlayer()
        set udg_Point = GetRandomLocInRect(udg_Region[GetRandomInt(3, 5)])
        call CreateNUnitsAtLoc( 1, 'nmdm', udg_Player, udg_Point, 180.00 )
        call PanCameraToTimedLocForPlayer( udg_Player, udg_Point, 0 )
        call RemoveLocation(udg_Point)
        call SetUnitVertexColorBJ( GetLastCreatedUnit(), 100, 100, 100, 50.00 )
        call UnitShareVisionBJ( true, GetLastCreatedUnit(), udg_Player )
        set udg_PlayerGroup = GetForceOfPlayer(udg_Player)
        call CinematicModeBJ( true, udg_PlayerGroup )
        call DestroyForce (udg_PlayerGroup)
        call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(GetLastCreatedUnit()), GetLastCreatedUnit(), 0, 0, false )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_TARGET_DISTANCE, 800.00, 0 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ROTATION, 90.00, 2.00 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ANGLE_OF_ATTACK, 346.00, 2.00 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ZOFFSET, 340.00, 2.00 )
        set udg_Point = GetRectCenter(gg_rct_LoadRegion)
        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_Point )
        call RemoveLocation(udg_Point)
    else
    endif
    call CreateFogModifierRectBJ( true, GetTriggerPlayer(), FOG_OF_WAR_VISIBLE, gg_rct_Arena )
    if ( Trig_Create_Ur_Hero_Func009C() ) then
        call EnableTrigger( gg_trg_Some_Defintion )
        call TriggerExecute( gg_trg_Some_Defintion )
    else
        call TriggerExecute( gg_trg_Update_Definition )
    endif
endfunction

i dont know why dont work but same thing with TempInteger (tempinteger=player number of triggering player -1)
 

SerraAvenger

Cuz I can
Reaction score
234
First of all: ConvertedPlayer(0) does not exist, and if you want to get a player number, GetConvertedPlayerId( GetTriggerplayer() ), Will be 1 for player red (1), 2 for player blue (2), and so on...
You won't get 0.

Then, I will check where the errors are now and EDIT then.

EDIT: I saw the error on first glance. it is the Custom script:, remove it and the trigger will be right, third line...
EDIT2: y all fine now
 
S

shadowvzs

Guest
First of all: ConvertedPlayer(0) does not exist, and if you want to get a player number, GetConvertedPlayerId( GetTriggerplayer() ), Will be 1 for player red (1), 2 for player blue (2), and so on...
You won't get 0.

Then, I will check where the errors are now and EDIT then.

EDIT: I saw the error on first glance. it is the Custom script:, remove it and the trigger will be right, third line...
EDIT2: y all fine now

i tryed this but same error what was with udg_Player variable, pls somebody tell me how can i do advanced fade filter for only triggering player and give me a exemple what working sure pls

and second question if i have array integer,real, or string work set variable=nulll custom script?
 

SerraAvenger

Cuz I can
Reaction score
234
integer and real are set to 0.
others are set to "null".

And after deleting the custom script it was

Code:
function Trig_Create_Ur_Hero_Actions takes nothing returns nothing
[B]    set udg_Player = GetTriggerPlayer()
    if GetLocalPlayer() == udg_Player then
        call CinematicFilterGenericBJ( 5.00, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00, 0 )
    endif[/B]
    set udg_Tempory_nr[14] = 0
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 4
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Create_Ur_Hero_Func006Func001C() ) then
            set udg_Temp_point[1] = GetRandomLocInRect(gg_rct_StartLocation)
            call CreateNUnitsAtLoc( 1, udg_SaveLoad_Heroes[( 25 + GetForLoopIndexA() )], udg_Player, udg_Temp_point[1], bj_UNIT_FACING )
            call RemoveLocation(udg_Temp_point[1])
            call SetUnitAbilityLevelSwapped( 'A03A', GetLastCreatedUnit(), ( GetForLoopIndexA() + 1 ) )
            call SetPlayerHandicapXPBJ( GetOwningPlayer(GetLastCreatedUnit()), ( 150.00 * I2R(udg_Number_of_player) ) )
            call ShowUnitHide( GetLastCreatedUnit() )
            set udg_MyHero[GetConvertedPlayerId(udg_Player)] = GetLastCreatedUnit()
            call RemoveLocation(udg_Temp_point[1])
            set udg_Point = GetRandomLocInRect(gg_rct_Ship)
            call CreateNUnitsAtLoc( 1, 'nbot', udg_Player, udg_Point, 90.00 )
            call SetUnitPositionLocFacingBJ( GetLastCreatedUnit(), udg_Point, 90.00 )
            call RemoveLocation(udg_Point)
            set udg_Point = GetRandomLocInRect(gg_rct_ShipDock)
            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_Point )
            call RemoveLocation(udg_Point)
            set udg_PlayerGroup = GetForceOfPlayer(udg_Player)
            call CinematicModeBJ( true, udg_PlayerGroup )
            call DestroyForce (udg_PlayerGroup)
            set udg_Point = GetUnitLoc(GetLastCreatedUnit())
            call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetLastCreatedUnit()), udg_Point, 0 )
            call RemoveLocation(udg_Point)
            call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(GetLastCreatedUnit()), GetLastCreatedUnit(), 0, 0, false )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_TARGET_DISTANCE, 800.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ROTATION, 25.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ANGLE_OF_ATTACK, 355.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ZOFFSET, 150.00, 2.00 )
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    if ( Trig_Create_Ur_Hero_Func007C() ) then
        set udg_Player = GetTriggerPlayer()
        set udg_Point = GetRandomLocInRect(udg_Region[GetRandomInt(3, 5)])
        call CreateNUnitsAtLoc( 1, 'nmdm', udg_Player, udg_Point, 180.00 )
        call PanCameraToTimedLocForPlayer( udg_Player, udg_Point, 0 )
        call RemoveLocation(udg_Point)
        call SetUnitVertexColorBJ( GetLastCreatedUnit(), 100, 100, 100, 50.00 )
        call UnitShareVisionBJ( true, GetLastCreatedUnit(), udg_Player )
        set udg_PlayerGroup = GetForceOfPlayer(udg_Player)
        call CinematicModeBJ( true, udg_PlayerGroup )
        call DestroyForce (udg_PlayerGroup)
        call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(GetLastCreatedUnit()), GetLastCreatedUnit(), 0, 0, false )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_TARGET_DISTANCE, 800.00, 0 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ROTATION, 90.00, 2.00 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ANGLE_OF_ATTACK, 346.00, 2.00 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ZOFFSET, 340.00, 2.00 )
        set udg_Point = GetRectCenter(gg_rct_LoadRegion)
        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_Point )
        call RemoveLocation(udg_Point)
    endif
    call CreateFogModifierRectBJ( true, GetTriggerPlayer(), FOG_OF_WAR_VISIBLE, gg_rct_Arena )
    if ( Trig_Create_Ur_Hero_Func009C() ) then
        call EnableTrigger( gg_trg_Some_Defintion )
        call TriggerExecute( gg_trg_Some_Defintion )
    else
        call TriggerExecute( gg_trg_Update_Definition )
    endif
endfunction
wich worked perfectly for me (without all that globals that where "undeclared variable" for me, of course). If you declared all of them, it will be fine.
and udg_Player should be of type player...
 
S

shadowvzs

Guest
integer and real are set to 0.
others are set to "null".

And after deleting the custom script it was

Code:
function Trig_Create_Ur_Hero_Actions takes nothing returns nothing
[B]    set udg_Player = GetTriggerPlayer()
    if GetLocalPlayer() == udg_Player then
        call CinematicFilterGenericBJ( 5.00, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00, 0 )
    endif[/B]
    set udg_Tempory_nr[14] = 0
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 4
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Create_Ur_Hero_Func006Func001C() ) then
            set udg_Temp_point[1] = GetRandomLocInRect(gg_rct_StartLocation)
            call CreateNUnitsAtLoc( 1, udg_SaveLoad_Heroes[( 25 + GetForLoopIndexA() )], udg_Player, udg_Temp_point[1], bj_UNIT_FACING )
            call RemoveLocation(udg_Temp_point[1])
            call SetUnitAbilityLevelSwapped( 'A03A', GetLastCreatedUnit(), ( GetForLoopIndexA() + 1 ) )
            call SetPlayerHandicapXPBJ( GetOwningPlayer(GetLastCreatedUnit()), ( 150.00 * I2R(udg_Number_of_player) ) )
            call ShowUnitHide( GetLastCreatedUnit() )
            set udg_MyHero[GetConvertedPlayerId(udg_Player)] = GetLastCreatedUnit()
            call RemoveLocation(udg_Temp_point[1])
            set udg_Point = GetRandomLocInRect(gg_rct_Ship)
            call CreateNUnitsAtLoc( 1, 'nbot', udg_Player, udg_Point, 90.00 )
            call SetUnitPositionLocFacingBJ( GetLastCreatedUnit(), udg_Point, 90.00 )
            call RemoveLocation(udg_Point)
            set udg_Point = GetRandomLocInRect(gg_rct_ShipDock)
            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_Point )
            call RemoveLocation(udg_Point)
            set udg_PlayerGroup = GetForceOfPlayer(udg_Player)
            call CinematicModeBJ( true, udg_PlayerGroup )
            call DestroyForce (udg_PlayerGroup)
            set udg_Point = GetUnitLoc(GetLastCreatedUnit())
            call PanCameraToTimedLocForPlayer( GetOwningPlayer(GetLastCreatedUnit()), udg_Point, 0 )
            call RemoveLocation(udg_Point)
            call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(GetLastCreatedUnit()), GetLastCreatedUnit(), 0, 0, false )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_TARGET_DISTANCE, 800.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ROTATION, 25.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ANGLE_OF_ATTACK, 355.00, 2.00 )
            call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ZOFFSET, 150.00, 2.00 )
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    if ( Trig_Create_Ur_Hero_Func007C() ) then
        set udg_Player = GetTriggerPlayer()
        set udg_Point = GetRandomLocInRect(udg_Region[GetRandomInt(3, 5)])
        call CreateNUnitsAtLoc( 1, 'nmdm', udg_Player, udg_Point, 180.00 )
        call PanCameraToTimedLocForPlayer( udg_Player, udg_Point, 0 )
        call RemoveLocation(udg_Point)
        call SetUnitVertexColorBJ( GetLastCreatedUnit(), 100, 100, 100, 50.00 )
        call UnitShareVisionBJ( true, GetLastCreatedUnit(), udg_Player )
        set udg_PlayerGroup = GetForceOfPlayer(udg_Player)
        call CinematicModeBJ( true, udg_PlayerGroup )
        call DestroyForce (udg_PlayerGroup)
        call SetCameraTargetControllerNoZForPlayer( GetOwningPlayer(GetLastCreatedUnit()), GetLastCreatedUnit(), 0, 0, false )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_TARGET_DISTANCE, 800.00, 0 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ROTATION, 90.00, 2.00 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ANGLE_OF_ATTACK, 346.00, 2.00 )
        call SetCameraFieldForPlayer( GetOwningPlayer(GetLastCreatedUnit()), CAMERA_FIELD_ZOFFSET, 340.00, 2.00 )
        set udg_Point = GetRectCenter(gg_rct_LoadRegion)
        call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", udg_Point )
        call RemoveLocation(udg_Point)
    endif
    call CreateFogModifierRectBJ( true, GetTriggerPlayer(), FOG_OF_WAR_VISIBLE, gg_rct_Arena )
    if ( Trig_Create_Ur_Hero_Func009C() ) then
        call EnableTrigger( gg_trg_Some_Defintion )
        call TriggerExecute( gg_trg_Some_Defintion )
    else
        call TriggerExecute( gg_trg_Update_Definition )
    endif
endfunction
wich worked perfectly for me (without all that globals that where "undeclared variable" for me, of course). If you declared all of them, it will be fine.
and udg_Player should be of type player...

ohh man i am blind :D i write to custom script this
Custom script: if GetLocalPlayer() == udg_Player then
and not if GetLocalPlayer() == udg_Player then

thx again SerraAvenger
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
You can use a local player inside a GUI if/then/else, too.

Events
- Map initialization
Conditions
Actions
- Custom script: set udg_localPlayer = GetLocalPlayer()

Events
- A unit dies
Conditons
Actions
- if ((Owner of (Triggering unit)) equal to localPlayer)
- then
- Cinematic - Turn cinematic mode On for (localplayer)
- else
 

SerraAvenger

Cuz I can
Reaction score
234
shall I help you on this issue?
Or what did you mean with "don't have tipp"?

And look again on emjlr3's thread, posted something on its last page (long to read, but quite informative I hope)
greetings Serra
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top