What are these JASS triggers doing?

millzy

Ultra Cool Member
Reaction score
44
1
JASS:
function Trig_Player_1_Conditions takes nothing returns boolean
    if ( not ( GetPlayerSlotState(Player(0)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return false
    endif
    return true
endfunction

function Trig_Player_1_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(gg_rct_Player_1), bj_UNIT_FACING )
    call AdjustPlayerStateBJ( 25, Player(0), PLAYER_STATE_RESOURCE_GOLD )
endfunction

//===========================================================================
function InitTrig_Player_1 takes nothing returns nothing
    set gg_trg_Player_1 = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Player_1, 7.00 )
    call TriggerAddCondition( gg_trg_Player_1, Condition( function Trig_Player_1_Conditions ) )
    call TriggerAddAction( gg_trg_Player_1, function Trig_Player_1_Actions )
endfunction


2
JASS:
function Trig_Starting_Func001001001 takes nothing returns boolean
    return ( GetPlayerSlotState(GetFilterPlayer()) != PLAYER_SLOT_STATE_PLAYING )
endfunction

function Trig_Starting_Func001Func001A takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Starting_Func001A takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfPlayerAll(GetEnumPlayer()), function Trig_Starting_Func001Func001A )
endfunction

function Trig_Starting_Actions takes nothing returns nothing
    call ForForce( GetPlayersMatching(Condition(function Trig_Starting_Func001001001)), function Trig_Starting_Func001A )
endfunction


3
JASS:
function Trig_Player_one_Red_Actions takes nothing returns nothing
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(1), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(2), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(3), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(4), PLAYER_STATE_RESOURCE_GOLD )
endfunction

//===========================================================================
function InitTrig_Player_one_Red takes nothing returns nothing
    set gg_trg_Player_one_Red = CreateTrigger(  )
    call TriggerRegisterPlayerEventLeave( gg_trg_Player_one_Red, Player(0) )
    call TriggerAddAction( gg_trg_Player_one_Red, function Trig_Player_one_Red_Actions )
endfunction
 

Jooster

New Member
Reaction score
7
first one creates i believe a footmen, and gives u 25 gold? or takes 25 gold? im not sure. second one i didn't look at long enough. 3rd gives 500g to anyone playing. that's a quick gist of the 3
 

millzy

Ultra Cool Member
Reaction score
44
would changing the first 1 into gui work

buy doing

event
-periodic event....duno how long it is
condition
-...player slot stus is playing
action
-create 1 footmen for player(..) at .... regen
-add 25 gold to player current gold
 

wraithseeker

Tired.
Reaction score
122
if im correct

First one checks whether a player slot is playing

It then creates a footman at the player starting location and then give u 25 gold

2nd

it checks whether the player is in the game or not if not it will remove all the units the player have if im correct.It picks them around playable map area if im correct

3rd

it adds 500 gold to player 1 , 2 , 3 ,4 ??



3rd
 

saw792

Is known to say things. That is all.
Reaction score
280
The second one has no InitTrig function, and no trigger. It does nothing.

The third one is a leaver trigger that divides gold between player 2, 3, 4 and 5 when red leaves. I presume there would also be similar triggers for each player.

EDIT: Lol at azlier's edit.
 

Azlier

Old World Ghost
Reaction score
461
JASS:
function Trig_Player_1_Conditions takes nothing returns boolean
    if ( not ( GetPlayerSlotState(Player(0)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return false
    endif
    return true
endfunction

function Trig_Player_1_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(gg_rct_Player_1), bj_UNIT_FACING )
    call AdjustPlayerStateBJ( 25, Player(0), PLAYER_STATE_RESOURCE_GOLD )
endfunction

//===========================================================================
function InitTrig_Player_1 takes nothing returns nothing
    set gg_trg_Player_1 = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Player_1, 7.00 )
    call TriggerAddCondition( gg_trg_Player_1, Condition( function Trig_Player_1_Conditions ) )
    call TriggerAddAction( gg_trg_Player_1, function Trig_Player_1_Actions )
endfunction


This script checks whether Player 1 is playing or not. If so, it creates a footman and gives him 25 gold.

2
JASS:
function Trig_Starting_Func001001001 takes nothing returns boolean
    return ( GetPlayerSlotState(GetFilterPlayer()) != PLAYER_SLOT_STATE_PLAYING )
endfunction

function Trig_Starting_Func001Func001A takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Starting_Func001A takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfPlayerAll(GetEnumPlayer()), function Trig_Starting_Func001Func001A )
endfunction

function Trig_Starting_Actions takes nothing returns nothing
    call ForForce( GetPlayersMatching(Condition(function Trig_Starting_Func001001001)), function Trig_Starting_Func001A )
endfunction


This one takes all players, and if they are not playing, it removes all of their units. But, as saw said, it has no init function. So it fails to do its task.

3
JASS:
function Trig_Player_one_Red_Actions takes nothing returns nothing
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(1), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(2), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(3), PLAYER_STATE_RESOURCE_GOLD )
    call AdjustPlayerStateBJ( ( ( GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD) + 500 ) / 2 ), Player(4), PLAYER_STATE_RESOURCE_GOLD )
endfunction

//===========================================================================
function InitTrig_Player_one_Red takes nothing returns nothing
    set gg_trg_Player_one_Red = CreateTrigger(  )
    call TriggerRegisterPlayerEventLeave( gg_trg_Player_one_Red, Player(0) )
    call TriggerAddAction( gg_trg_Player_one_Red, function Trig_Player_one_Red_Actions )
endfunction


<nods in agreement with saw>
 
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