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

saw792

Is known to say things. That is all.
Reaction score
280
Obvious answer first: do you click save before you click test map?
 

XeNiM666

I lurk for pizza
Reaction score
138
Obvious answer first: do you click save before you click test map?
- Yes. Sometimes I save it 2 times...
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
boolean array PStatus
Where do you init this array? Or boolean arrays being init to false/true on auto?
 

XeNiM666

I lurk for pizza
Reaction score
138
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
 

ZugZugZealot

New Member
Reaction score
33
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.

      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