• 🏆 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] it dont run for other players -_-

Status
Not open for further replies.
Level 7
Joined
Mar 22, 2010
Messages
228
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
function AutoIn_Conditions takes nothing returns boolean
    return GetTriggerUnit() == gg_unit_h000_0000
endfunction

function Trig_AutoIn_Actions takes nothing returns nothing
    call DialogSetMessageBJ( udg_Auto_In_D[GetConvertedPlayerId(GetTriggerPlayer())], "Options" )
    call DialogAddButtonBJ( udg_Auto_In_D[GetConvertedPlayerId(GetTriggerPlayer())], "Get Inside" )
    set udg_Auto_In_In[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedButtonBJ()
    call DialogAddButtonBJ( udg_Auto_In_D[GetConvertedPlayerId(GetTriggerPlayer())], "Check" )
    set udg_Auto_In_Ch[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedButtonBJ()
    call DialogAddButtonBJ( udg_Auto_In_D[GetConvertedPlayerId(GetTriggerPlayer())], "Cancel" )
    set udg_Auto_In_Ca[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedButtonBJ()
    call SelectUnitForPlayerSingle( udg_Player_Hero[GetConvertedPlayerId(GetTriggerPlayer())], GetTriggerPlayer() )
    call DialogDisplayBJ( true, udg_Auto_In_D[GetConvertedPlayerId(GetTriggerPlayer())], GetTriggerPlayer() )
endfunction

//===========================================================================
function InitTrig_AutoIn takes nothing returns nothing
    set gg_trg_AutoIn = CreateTrigger(  )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(0), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(1), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(2), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(3), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(4), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(5), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(6), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(7), true )    
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(8), true )
    call TriggerRegisterPlayerSelectionEventBJ( gg_trg_AutoIn, Player(9), true )
    call TriggerAddCondition( gg_trg_AutoIn, Condition( function AutoIn_Conditions ) )
    call TriggerAddAction( gg_trg_AutoIn, function Trig_AutoIn_Actions )
endfunction

my point for this jass is when a player selects a unit, a dialog buton will be shown. This works for Player 1(Player(0)), but when i tried to use Player 2(Player (1)) as a user the dialog wont show...i cant figure it out...!
 
JASS:
function AutoIn_Conditions takes nothing returns boolean
    local player p = GetTriggerPlayer()
    local integer id = GetPlayerId(p) + 1
 
    //call SelectUnitForPlayerSingle( udg_Player_Hero[id],p) Why are you doing this?
 
    call DialogSetMessage( udg_Auto_In_D[id], "Options" )
    set udg_Auto_In_In[id] = DialogAddButton( udg_Auto_In_D[id],"Get Inside",0)
    set udg_Auto_In_Ch[id] = DialogAddButton( udg_Auto_In_D[id],"Check",0)
    set udg_Auto_In_Ca[id] = DialogAddButton( udg_Auto_In_D[id],"Cancel",0)
    call DialogDisplay(p,udg_Auto_In_D[id],true)
    return false
endfunction
 
//===========================================================================
function InitTrig_AutoIn takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent(t,gg_unit_h000_0000,EVENT_UNIT_SELECTED)
    call TriggerAddCondition(t,Condition(function AutoIn_Conditions))
endfunction
 
Level 7
Joined
Mar 22, 2010
Messages
228
JASS:
    //call SelectUnitForPlayerSingle( udg_Player_Hero[id],p) Why are you doing this?
thats because i want the hero of a selecting player to be selected back after selecting

ok thanks so much!!it work now..
 
Status
Not open for further replies.
Top