- Joined
- Jun 30, 2006
- Messages
- 230
JASS:
function PlayerAllianceLeavesGold takes nothing returns nothing
local integer gold = (GetPlayerState( Player(0), PLAYER_STATE_RESOURCE_GOLD ) + 500) / {stuck here, should be the number of the players in the group udg_Alliance after removing the leaving player}
call SetPlayerState( GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD ) + gold )
endfunction
function PlayerAllianceLeavesActions takes nothing returns nothing
call ForceRemovePlayerSimple( Player(0), GetPlayersAll() )
call ForForce( udg_Alliance, function PlayerAllianceLeavesGold )
// the following set the research level to zero so that creeps for that player quit spawning
call SetPlayerTechResearchedSwap( 'R004', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R005', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R007', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R008', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R009', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00A', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00B', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00C', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00D', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00E', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00F', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00G', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00H', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00V', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00W', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R00Y', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R011', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R012', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R013', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R014', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R018', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R019', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R01E', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R01F', 0, Player(0) )
call SetPlayerTechResearchedSwap( 'R01I', 0, Player(0) )
endfunction
//===========================================================================
function InitTrig_PlayerAllianceLeaves takes nothing returns nothing
set gg_trg_PlayerAllianceLeaves = CreateTrigger( )
call TriggerRegisterPlayerEventLeave( gg_trg_PlayerAllianceLeaves, Player(0) )
call TriggerAddAction( gg_trg_PlayerAllianceLeaves, function PlayerAllianceLeavesActions )
endfunction
Second part would be replacing Player(0) with something dynamic such as Player(i), i being an integer from 0-4(the numbers of the players I want), and setting the actions accordingly. I do know how to do loops, but I've never succesfully done one for an event or such. Help?
Last edited: