Prob with trigger...

XeNiM666

I lurk for pizza
Reaction score
138
Hello. Been busy making my map lately.... XD
Im almost finished with it, the only problem is with the hero selection system.

I made this trigger:
JASS:
scope HeroPick initializer onInit

    globals
        boolean array PStatus
        
        force G = CreateForce()
        group HG = CreateGroup()
        
        rect array R
        integer array HeroType
        unit array HeroSelected
        camerasetup array Cam
    endglobals
    
    private function InitCam takes nothing returns nothing
        local integer i = 0
    
        set Cam[ 1 ] = gg_cam_SelectCam1
        set Cam[ 2 ] = gg_cam_SelectCam2
        set Cam[ 3 ] = gg_cam_SelectCam3
        set Cam[ 4 ] = gg_cam_SelectCam4
        set Cam[ 5 ] = gg_cam_SelectCam5
        set Cam[ 6 ] = gg_cam_SelectCam6
        set Cam[ 7 ] = gg_cam_SelectCam7
        set Cam[ 8 ] = gg_cam_SelectCam8
        
        loop
            call CameraSetupApplyForPlayer( true, Cam[ i + 1 ], Player( i ), 0.00 )        
            
            set i = i + 1
            exitwhen i > 8
        endloop

    endfunction
    
    private function HG_Actions takes nothing returns nothing
        local unit u = GetEnumUnit()
    
        call UnitRemoveAbility( u, 'Amov' )
        call UnitRemoveAbility( u, 'Aatk' )
        call UnitAddAbility( u, 'A00Y' )
        call UnitAddAbility( u, 'A00Z' )
            
        call UnitModifySkillPoints( u, 0 )
        call SetUnitInvulnerable( u, true )
        
        set u = null
    endfunction
    
    private function InitHero takes nothing returns nothing
        local integer i = 0
        
        set R[ 1 ] = gg_rct_SelectHero1
        set R[ 2 ] = gg_rct_SelectHero2
        set R[ 3 ] = gg_rct_SelectHero3
        set R[ 4 ] = gg_rct_SelectHero4
        set R[ 5 ] = gg_rct_SelectHero5
        set R[ 6 ] = gg_rct_SelectHero6
        set R[ 7 ] = gg_rct_SelectHero7
        set R[ 8 ] = gg_rct_SelectHero8
        
        set HeroType[ 1 ] = 'H00A'
        set HeroType[ 2 ] = 'H004'
        set HeroType[ 3 ] = 'H001'
        
        loop
            if PStatus[ i + 1 ] == false and GetPlayerController( Player( i ) ) == MAP_CONTROL_USER then
                call ClearSelectionForPlayer( Player( i ) )
                set HeroSelected[ i + 1 ] = CreateUnit( Player( i ), HeroType[ 1 ], GetRectCenterX( R[ i + 1 ] ), GetRectCenterY( R[ i + 1 ] ), 270.00 )
                call GroupAddUnit( HG, HeroSelected[ i + 1 ] )
                call SelectUnitForPlayerSingle( HeroSelected[ i + 1 ], Player( i ) ) 
            endif
            
            set i = i + 1
            exitwhen i > 8
        endloop
        
        call ForGroup( HG, function HG_Actions )
    endfunction
    
    private function onInit takes nothing returns nothing
        local integer i = 0
        
        loop
            call ForceAddPlayer( G, Player( i ) )
            
            if GetPlayerSlotState( Player( i ) ) == PLAYER_SLOT_STATE_PLAYING then
                set PStatus[ i + 1 ] = true
                set PStatus[ i + 9 ] = true
            endif
            
            set i = i + 1
            exitwhen i > 8
        endloop
        
        call InitHero()    
        call InitCam()
    endfunction 

endscope


Somehow I dont see any problems with it. But when I hit test map I returns to the warcraft main screen. When I disable the trigger, everything fine... I feel like such a noob.. XD

Thanks in advance...
 
Obvious answer first: do you click save before you click test map?
 
Obvious answer first: do you click save before you click test map?
- Yes. Sometimes I save it 2 times...
 
boolean array PStatus
Where do you init this array? Or boolean arrays being init to false/true on auto?
 
Where do you init this array?
- I believe they are "false" in default...

Still stuck with this. Tried commenting out some lines and still it bugs... T_T
 
Well, I just copy pasted the code, created 8 random regions conforming to gg_PickHero# and created 8 random camera setups conforming to gg_SelectCamera# and it was able to load without fail for me.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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