• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Dialog Not Coming Up

Status
Not open for further replies.
Level 11
Joined
Jun 30, 2008
Messages
580
JASS:
library GameInit initializer GameInitialization

    globals
//**************************************************************//
//                          Constants                           //
//**************************************************************//
        constant integer MAX_PLAYERS        = 9
        constant real TIMER_TIMEOUT         = 0.04
//
//**************************************************************//
//                          Variables
        integer CurrentPlayers
        
        dialog array StartDialog[MAX_PLAYERS]
        button array NewCharacterButton[MAX_PLAYERS]
//
//**************************************************************//
    endglobals  
    
    private function LoadPlayers takes nothing returns nothing
        local integer loop1 = 0
        call BJDebugMsg("LoadRun")
        
            loop
            exitwhen loop1 > MAX_PLAYERS
                call BJDebugMsg("Loop #"+I2S(loop1)) 
                if (GetPlayerController(Player(loop1)) == MAP_CONTROL_USER ) then
                    set CurrentPlayers = CurrentPlayers+1
                    
                    set StartDialog[loop1] = DialogCreate()
                    set NewCharacterButton[loop1] = DialogAddButton(StartDialog[loop1], "New Character", 0)
                endif
                
            set loop1 = loop1+1
            endloop
            set loop1 = 0
        call BJDebugMsg("LoadExecuted")
        call BJDebugMsg(I2S(CurrentPlayers))
    endfunction
    
    private function NewSelection takes nothing returns nothing
        local CHARDATA temp = CHARDATA.create(GetTriggerPlayer())
        call temp.ActivateCharacter(CreateUnit(GetTriggerPlayer(), 'CHAR', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0))
    endfunction
    
    private function GameInitialization takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer loop1 = 0
        
        call TriggerRegisterTimerEventSingle( t, 0.01 )
        call TriggerAddAction(t, function LoadPlayers)
        set t = CreateTrigger()
        
        loop
        exitwhen loop1 > MAX_PLAYERS
        
            call TriggerRegisterDialogButtonEvent(t, NewCharacterButton[loop1])
            call TriggerAddAction(t, function NewSelection)
            
        set loop1 = loop1+1
        endloop
        
        // Environment Setup
        call FogEnableOff(  )
        call FogMaskEnableOff(  )
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
    endfunction
endlibrary

The dialog wont come up, any idea why?
 
Sry about tht I'm on my phone I think I skipped past the first function. U shouldn't use the triggerregistertimereventsingle use the other one. Ill try to look at this more. Phones being a pain ATM tho

It might be because u create the local trigger t twice u should null it in the middle of them and call the function w the create dialog b4 u register them to the trigger.

Thts y it's not working u add the dialog button events b4 u create them u can put the second half of the bottom trigger the one were u create the trigger t and add the dialog buttons into the function tht u create the dialog buttons

If u don't understand what I mean I can fix it for u when i get home in about half an hr and relate it unless someone else does in the meantime.
 
here u go. this should work.

JASS:
library GameInit initializer GameInitialization

    globals
//**************************************************************//
//                          Constants                           //
//**************************************************************//
        constant integer MAX_PLAYERS        = 9
        constant real TIMER_TIMEOUT         = 0.04
//
//**************************************************************//
//                          Variables
        integer CurrentPlayers
        
        dialog array StartDialog[MAX_PLAYERS]
        button array NewCharacterButton[MAX_PLAYERS]
//
//**************************************************************//
    endglobals  
    
    private function LoadPlayers takes nothing returns nothing
        local integer loop1 = 0
        local trigger t = CreateTrigger()
        call BJDebugMsg("LoadRun")
        
            loop
            exitwhen loop1 > MAX_PLAYERS
                call BJDebugMsg("Loop #"+I2S(loop1)) 
                if (GetPlayerController(Player(loop1)) == MAP_CONTROL_USER ) then
                    set CurrentPlayers = CurrentPlayers+1
                    
                    set StartDialog[loop1] = DialogCreate()
                    set NewCharacterButton[loop1] = DialogAddButton(StartDialog[loop1], "New Character", 0)
                endif
                
            set loop1 = loop1+1
            endloop
            set loop1 = 0
        call BJDebugMsg("LoadExecuted")
        call BJDebugMsg(I2S(CurrentPlayers))
        set loop1 = 0
        loop
        exitwhen loop1 > MAX_PLAYERS
        
            call TriggerRegisterDialogButtonEvent(t, NewCharacterButton[loop1])
            call TriggerAddAction(t, function NewSelection)
            
        set loop1 = loop1+1
        endloop
    endfunction
    
    private function NewSelection takes nothing returns nothing
        local CHARDATA temp = CHARDATA.create(GetTriggerPlayer())
        call temp.ActivateCharacter(CreateUnit(GetTriggerPlayer(), 'CHAR', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0))
    endfunction
    
    private function GameInitialization takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer loop1 = 0
        
        call TriggerRegisterTimerEvent( t, 0.01, false )
        call TriggerAddAction(t, function LoadPlayers)
        // Environment Setup
        call FogEnable(false)
        call FogMaskEnable(false)
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
        set t = null // do not forget this
    endfunction
endlibrary
 
Level 11
Joined
Jun 30, 2008
Messages
580
I changed it to this;

JASS:
library GameInit initializer GameInitialization

    globals
//**************************************************************//
//                          Constants                           //
//**************************************************************//
        constant integer MAX_PLAYERS        = 9
        constant real TIMER_TIMEOUT         = 0.04
//
//**************************************************************//
//                          Variables
        integer CurrentPlayers
        
        dialog array StartDialog[MAX_PLAYERS]
        button array NewCharacterButton[MAX_PLAYERS]
//
//**************************************************************//
    endglobals  
    
    private function NewSelection takes nothing returns nothing
        local CHARDATA temp = CHARDATA.create(GetTriggerPlayer())
        call temp.ActivateCharacter(CreateUnit(GetTriggerPlayer(), 'CHAR', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0))
    endfunction
    
    private function LoadPlayers takes nothing returns nothing
        local integer loop1 = 0
        local trigger t = CreateTrigger()
        
            loop
            exitwhen loop1 > MAX_PLAYERS 
                if (GetPlayerController(Player(loop1)) == MAP_CONTROL_USER ) then
                    set CurrentPlayers = CurrentPlayers+1
                    
                    set StartDialog[loop1] = DialogCreate()
                    set NewCharacterButton[loop1] = DialogAddButton(StartDialog[loop1], "New Character", 0)
                    call TriggerRegisterDialogButtonEvent(t, NewCharacterButton[loop1])
                    call TriggerAddAction(t, function NewSelection)
                endif
                
            set loop1 = loop1+1
            endloop
            set loop1 = 0
    endfunction
    
    private function GameInitialization takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer loop1 = 0
        
        call TriggerRegisterTimerEventSingle( t, 0.01 )
        call TriggerAddAction(t, function LoadPlayers)
        
        // Environment Setup
        call FogEnableOff(  )
        call FogMaskEnableOff(  )
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
    endfunction
endlibrary

And it still doesn't work...
 
u have to show the dialog

here and i cleaned the bjs for u and the trigger leak

JASS:
library GameInit initializer GameInitialization

    globals
//**************************************************************//
//                          Constants                           //
//**************************************************************//
        constant integer MAX_PLAYERS        = 9
        constant real TIMER_TIMEOUT         = 0.04
//
//**************************************************************//
//                          Variables
        integer CurrentPlayers
        
        dialog array StartDialog[MAX_PLAYERS]
        button array NewCharacterButton[MAX_PLAYERS]
//
//**************************************************************//
    endglobals  
    
    private function LoadPlayers takes nothing returns nothing
        local integer loop1 = 0
        local trigger t = CreateTrigger()
        call BJDebugMsg("LoadRun")
        
            loop
            exitwhen loop1 > MAX_PLAYERS
                call BJDebugMsg("Loop #"+I2S(loop1)) 
                if (GetPlayerController(Player(loop1)) == MAP_CONTROL_USER ) then
                    set CurrentPlayers = CurrentPlayers+1
                    
                    set StartDialog[loop1] = DialogCreate()
                    set NewCharacterButton[loop1] = DialogAddButton(StartDialog[loop1], "New Character", 0)
                    
                    call TriggerRegisterDialogButtonEvent(t, NewCharacterButton[loop1])
                    call TriggerAddAction(t, function NewSelection)
                    call DialogDisplay( Player[Loop1], StartDialog[Loop1], true)
                endif
                
            set loop1 = loop1+1
            endloop
            set loop1 = 0
        call BJDebugMsg("LoadExecuted")
        call BJDebugMsg(I2S(CurrentPlayers))
        set t = null
    endfunction
    
    private function NewSelection takes nothing returns nothing
        local CHARDATA temp = CHARDATA.create(GetTriggerPlayer())
        call temp.ActivateCharacter(CreateUnit(GetTriggerPlayer(), 'CHAR', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0))
    endfunction
    
    private function GameInitialization takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer loop1 = 0
        
        call TriggerRegisterTimerEvent( t, 0.01, false )
        call TriggerAddAction(t, function LoadPlayers)
        // Environment Setup
        call FogEnable(false)
        call FogMaskEnable(false)
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
        set t = null // do not forget this
    endfunction
endlibrary
 
Level 11
Joined
Jun 30, 2008
Messages
580
Still nothing...

JASS:
library GameInit initializer GameInitialization

    globals
//**************************************************************//
//                          Constants                           //
//**************************************************************//
        constant integer MAX_PLAYERS        = 9
        constant real TIMER_TIMEOUT         = 0.04
//
//**************************************************************//
//                          Variables
                integer CurrentPlayers
                       
                dialog array StartDialog[MAX_PLAYERS]
                button array NewCharacterButton[MAX_PLAYERS]     
//
//**************************************************************//
    endglobals  
    
    private function NewSelection takes nothing returns nothing
        local CHARDATA temp = CHARDATA.create(GetTriggerPlayer())
        call temp.ActivateCharacter(CreateUnit(GetTriggerPlayer(), 'CHAR', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0))
    endfunction
    
   private function LoadPlayers takes nothing returns nothing
        local integer loop1 = 0
        local trigger t = CreateTrigger()
       
            loop
            exitwhen loop1 > MAX_PLAYERS
                if (GetPlayerController(Player(loop1)) == MAP_CONTROL_USER ) then
                    set CurrentPlayers = CurrentPlayers+1
                   
                    set StartDialog[loop1] = DialogCreate()
                    set NewCharacterButton[loop1] = DialogAddButton(StartDialog[loop1], "New Character", 0)
                    call DialogDisplay(Player(loop1), StartDialog[loop1], true)
                    call TriggerRegisterDialogButtonEvent(t, NewCharacterButton[loop1])
                    call TriggerAddAction(t, function NewSelection)
                endif
               
            set loop1 = loop1+1
            endloop
            set loop1 = 0
    endfunction
   
    private function GameInitialization takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer loop1 = 0
       
        call TriggerRegisterGameLoadedEventBJ(t)
        call TriggerAddAction(t, function LoadPlayers)
       
        // Environment Setup
        call FogEnableOff(  )
        call FogMaskEnableOff(  )
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
    endfunction
endlibrary

I tried changing the time elasped event to gameloaded event and still nothing...
 
i think i found the problem u didnt initialize the current players variable

here u go try this

JASS:
library GameInit initializer GameInitialization

    globals
//**************************************************************//
//                          Constants                           //
//**************************************************************//
        constant integer MAX_PLAYERS        = 9
        constant real TIMER_TIMEOUT         = 0.04
//
//**************************************************************//
//                          Variables
        integer CurrentPlayers = 0
        
        dialog array StartDialog[MAX_PLAYERS]
        button array NewCharacterButton[MAX_PLAYERS]
//
//**************************************************************//
    endglobals  
    
    private function LoadPlayers takes nothing returns nothing
        local integer loop1 = 0
        local trigger t = CreateTrigger()
        call BJDebugMsg("LoadRun")
        
            loop
            exitwhen loop1 > MAX_PLAYERS
                call BJDebugMsg("Loop #"+I2S(loop1)) 
                if (GetPlayerController(Player(loop1)) == MAP_CONTROL_USER ) then
                    set CurrentPlayers = CurrentPlayers+1
                    
                    set StartDialog[loop1] = DialogCreate()
                    set NewCharacterButton[loop1] = DialogAddButton(StartDialog[loop1], "New Character", 0)
                    
                    call TriggerRegisterDialogButtonEvent(t, NewCharacterButton[loop1])
                    call TriggerAddAction(t, function NewSelection)
                    call DialogDisplay( Player[Loop1], StartDialog[Loop1], true)
                endif
                
            set loop1 = loop1+1
            endloop
        call BJDebugMsg("LoadExecuted")
        call BJDebugMsg(I2S(CurrentPlayers))
    endfunction
    
    private function NewSelection takes nothing returns nothing
        local CHARDATA temp = CHARDATA.create(GetTriggerPlayer())
        call temp.ActivateCharacter(CreateUnit(GetTriggerPlayer(), 'CHAR', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0))
    endfunction
    
    private function GameInitialization takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer loop1 = 0
        
        call TriggerRegisterTimerEvent( t, 0.01, false )
        call TriggerAddAction(t, function LoadPlayers)
        // Environment Setup
        call FogEnable(false)
        call FogMaskEnable(false)
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
        set t = null // do not forget this
    endfunction
endlibrary
 
Status
Not open for further replies.
Top