Проблема в следующем: у меня был триггер инициализации на GUI. Я решил перевести его в jass, дабы было удобнее работать. Так теперь этот триггер не хочет запускатся! Точнее, запускаются только нативки, указанные в действиях напрямую, а всякие ForForce не работают (проверял выводом текста).
Я пробовал запускать этот триггер через промежуток времени, вызывать из другого триггера - ничего не помогает. Просмотрел академию на форуме - люди говорят что "рукотворные" инициализации работают с вероятностью 50%. Меня это не особо устраивает. Что делать?
Код
function Bounty_and_food_off takes nothing returns nothing
call SetPlayerState( GetEnumPlayer(), PLAYER_STATE_RESOURCE_FOOD_USED, 0 )
call SetPlayerState( GetEnumPlayer(), PLAYER_STATE_GIVES_BOUNTY, 0 )
call SetPlayerState( GetEnumPlayer(), PLAYER_STATE_RESOURCE_HERO_TOKENS, 1 )
endfunction
function PeoplePlayers takes nothing returns nothing
if GetPlayerController(GetEnumPlayer()) == MAP_CONTROL_USER and GetPlayerSlotState(GetEnumPlayer()) == PLAYER_SLOT_STATE_PLAYING then
call ForceAddPlayer( udg_HumanPlayers, GetEnumPlayer() )
endif
endfunction
function Trig_InitGame_Func027A takes nothing returns nothing
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(4), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(5), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(6), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(7), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(8), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(10), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(9), GetEnumPlayer(), bj_ALLIANCE_ALLIED_UNITS )
call SetPlayerAllianceStateBJ( Player(8), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function Trig_InitGame_Func028A takes nothing returns nothing
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(0), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(1), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(2), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(3), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(9), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( GetEnumPlayer(), Player(11), bj_ALLIANCE_UNALLIED )
call SetPlayerAllianceStateBJ( Player(8), GetEnumPlayer(), bj_ALLIANCE_ALLIED_UNITS )
call SetPlayerAllianceStateBJ( Player(9), GetEnumPlayer(), bj_ALLIANCE_UNALLIED )
endfunction
function GiveStartResources takes nothing returns nothing
local player p = GetEnumPlayer()
local force side
if IsPlayerInForce( p, udg_Alliance ) == true then
set side = udg_Alliance
elseif IsPlayerInForce( p, udg_Scourge ) == true
set side = udg_Scourge
endif
call SetPlayerState( p, PLAYER_STATE_RESOURCE_GOLD, ( 3000 / ( CountPlayersInForceBJ(side) - 1 ) ) )
call SetPlayerState( p, PLAYER_STATE_RESOURCE_LUMBER, ( 500 / ( CountPlayersInForceBJ(side) - 1 ) ) )
set p = null
set side = null
call Say("StartResourcesGived")
endfunction
function CreateSouls takes nothing returns nothing
local unit soul
call Say("CreateSouls")
set soul = CreateUnit( GetEnumPlayer(), 'esou', GetStartLocationX(GetPlayerStartLocation(GetEnumPlayer())), GetStartLocationY(GetPlayerStartLocation(GetEnumPlayer())), 270.0 )
//set soul = CreateUnitAtLoc( GetEnumPlayer(), 'esou', GetStartLocationLoc(GetPlayerStartLocation(GetEnumPlayer())), 270.0 )
call GroupAddUnit( udg_HeroesSouls, soul )
call SelectUnitForPlayerSingle( soul, GetEnumPlayer() )
set soul = null
endfunction
function Trig_InitGameActions_Actions takes nothing returns nothing
local integer p = 0
local force side
call Say("Init")
//Main - - Это РАБОТАЕТ!
call FogEnable(true)
call CreateFogModifierRadiusLocBJ( true, Player(9), FOG_OF_WAR_VISIBLE, GetRectCenter(gg_rct_VillagePoint001), 3000.00 )
call CreateFogModifierRadiusLocBJ( true, Player(8), FOG_OF_WAR_VISIBLE, GetRectCenter(gg_rct_VillagePoint003), 3000.00 )
call SetFloatGameState(GAME_STATE_TIME_OF_DAY, bj_MELEE_STARTING_TOD)
call SetPlayerFlagBJ( PLAYER_STATE_GIVES_BOUNTY, false, Player(PLAYER_NEUTRAL_AGGRESSIVE) )
call SetPlayerOnScoreScreen( Player(8), false )
call SetPlayerOnScoreScreen( Player(9), false )
call ForForce( bj_FORCE_ALL_PLAYERS, function Bounty_and_food_off )
// Add players to their groups - Это НЕ работает!
call ForForce( bj_FORCE_ALL_PLAYERS, function PeoplePlayers )
call ForceAddPlayer( udg_Alliance, Player(9) )
call ForceAddPlayer( udg_Scourge, Player(8) )
loop
exitwhen p > 12
call Say(I2S(p))
if GetPlayerSlotState(Player(p)) == PLAYER_SLOT_STATE_PLAYING then
if p >= 0 and p >= 3 then
call Say(I2S(p)+"a")
set side = udg_Alliance
elseif p >= 4 and p >= 7 then
call Say(I2S(p)+"s")
set side = udg_Scourge
endif
call ForceAddPlayer( side, Player(p) )
endif
set p = p + 1
endloop
set side = null
//Change colours of the player 3 and player 8 - Это РАБОТАЕТ!
call SetPlayerColor( Player(3), PLAYER_COLOR_LIGHT_GRAY )
call SetPlayerColor( Player(8), PLAYER_COLOR_PURPLE )
// Set alliances - Это НЕ работает!
call ForForce( udg_Alliance, function Trig_InitGame_Func027A )
call ForForce( udg_Scourge, function Trig_InitGame_Func028A )
//Start resources. - Это НЕ работает!
call ForForce( udg_Alliance, function GiveStartResources )
call ForForce( udg_Scourge, function GiveStartResources )
call Say("StartResourcesEnum")
//Create souls - Это НЕ работает!
call ForForce( bj_FORCE_ALL_PLAYERS, function CreateSouls )
endfunction
//===========================================================================
function InitTrig_InitGameActions takes nothing returns nothing
set gg_trg_InitGameActions = CreateTrigger( )
call TriggerAddAction( gg_trg_InitGameActions, function Trig_InitGameActions_Actions )
endfunction
P.S. Заодно протестируем новую академию.
Принятый ответ
ну это вообще пушкаp >= 0 and p >= 3
и это p >= 4 and p >= 7
`
ОЖИДАНИЕ РЕКЛАМЫ...
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
Да и не удобно с GUI-то.
16GB:
Ред. Zahanc
Вообщем, поправил я это дело и всё заработало не буду больше писать код по ночам