- Joined
- Nov 30, 2007
- Messages
- 1,202
-
IncomeTimer
-
Events
- Time - incomeTimer expires
- Conditions
-
Actions
- -------- Expected a function name?! --------
- Custom script: call GiveIncome()
-
Events
JASS:
function PickAllTowns takes nothing returns nothing
local integer pID = GetPlayerId(GetOwningPlayer(GetEnumUnit()))
local integer uID = GetUnitUserData(GetEnumUnit())
// Adds Global resources from Picked Town to Owning Player
set udg_playerResources[pID] = udg_playerResources[pID] + udg_baseResourceGold [uID + 2000]
set udg_playerResources[pID + 15] = udg_playerResources[pID + 15] + udg_baseResourceLumber [uID + 2000]
set udg_playerResources[pID + 30] = udg_playerResources[pID + 30] + udg_baseResourceIron [uID + 2000]
// Adds Local resources from picked Town to Stock and Player Count
// Check for breaches and adds appropriate amount if breached
if udg_baseResourceRecruits [uID] + udg_baseResourceRecruits [uID + 2000] < udg_baseResourceRecruits [uID + 1000] then
set udg_playerResources [pID + 45] = udg_playerResources [pID + 45] + udg_baseResourceRecruits [uID + 2000]
set udg_baseResourceRecruits [uID] = udg_baseResourceRecruits [uID] + udg_baseResourceRecruits [uID + 2000]
else //Cap was Breached
set udg_playerResources [pID + 45] = udg_playerResources [pID + 45] + (udg_baseResourceRecruits [uID + 1000] - udg_baseResourceRecruits [uID])
set udg_baseResourceRecruits [uID] = udg_baseResourceRecruits [uID + 1000]
endif
if udg_baseResourceFood [uID] + udg_baseResourceFood [uID + 2000] < udg_baseResourceFood [uID + 1000] then
set udg_playerResources [pID + 60] = udg_playerResources [pID + 60] + udg_baseResourceFood [uID + 2000]
set udg_baseResourceFood[uID] = udg_baseResourceFood [uID] + udg_baseResourceFood [uID + 2000]
else //Cap was Breached
set udg_playerResources [pID + 60] = udg_playerResources [pID + 60] + (udg_baseResourceFood [uID + 1000] - udg_baseResourceFood [uID])
set udg_baseResourceFood [uID] = udg_baseResourceFood [uID + 1000]
endif
if udg_baseResourceWeapons [uID ] + udg_baseResourceWeapons [uID + 2000] < udg_baseResourceWeapons [uID + 1000] then
set udg_playerResources [pID + 75] = udg_playerResources [pID + 75] + udg_baseResourceWeapons [uID + 2000]
set udg_baseResourceWeapons [uID] = udg_baseResourceWeapons [uID] + udg_baseResourceWeapons [uID + 2000]
else //Cap was Breached
set udg_playerResources [pID + 75] = udg_playerResources [pID + 75] + (udg_baseResourceWeapons [uID + 1000] - udg_baseResourceWeapons [uID])
set udg_baseResourceWeapons [uID] = udg_baseResourceWeapons [uID + 1000]
endif
endfunction
function GiveIncome takes nothing returns nothing
local integer i = 0
call BJDebugMsg("Income Recived...")
call ForGroup( udg_townGroup, function PickAllTowns )
// Update Multiboard if a Base is currently selected
loop
exitwhen i > 10
if IsUnitInGroup(udg_playerSelectedBase[i], udg_townGroup) == true or IsUnitInGroup(udg_playerSelectedBase[i], udg_campGroup) == true then
call BJDebugMsg("A multiboard selection was found!")
//set udg_transferredData_pID = i
//call TriggerExecute( gg_trg_UpdateMultiboardValues )
call UpdateMultiboardValues(i) //Expected a function name?!
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_GiveIncome takes nothing returns nothing
endfunction
JASS:
function UpdateMultiboardValues takes integer pID returns nothing
local unit u = udg_playerSelectedBase[pID]
local integer uID = GetUnitUserData(u)
local integer pID2 = GetPlayerId(GetOwningPlayer(u))
if IsUnitInGroup(u, udg_townGroup) == true and IsUnitInGroup(u, udg_campGroup) != true then
// Town is in current Selection
if IsPlayerEnemy(ConvertedPlayer(pID+1), GetOwningPlayer(u)) != true or udg_baseRevealed[uID] == true then
// Friendly Town or revealed is in current selection
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 1 ,1 ), (I2S(udg_baseResourceRecruits [uID]) + " / " + I2S(udg_baseResourceRecruits [uID + 1000])))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 2 ,1 ), (I2S(udg_baseResourceFood [uID]) + " / " + I2S(udg_baseResourceFood [uID + 1000])))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 3 ,1 ), (I2S(udg_baseResourceWeapons [uID]) + " / " + I2S(udg_baseResourceWeapons [uID + 1000])))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 6 ,1 ), I2S(udg_baseResourceGold [uID + 2000]))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 7 ,1 ), I2S(udg_baseResourceLumber [uID + 2000]))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 8 ,1 ), I2S(udg_baseResourceIron [uID + 2000]))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 9 ,1 ), I2S(udg_baseResourceRecruits [uID + 2000]))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 10,1 ), I2S(udg_baseResourceFood [uID + 2000]))
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 11,1 ), I2S(udg_baseResourceWeapons [uID + 2000]))
if IsPlayerEnemy(ConvertedPlayer(pID+1), GetOwningPlayer(u)) != true then
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 14,1 ), I2S(udg_playerResources[pID2 ])) // Gold
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 15,1 ), I2S(udg_playerResources[pID2 + 15])) // Lumber
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 16,1 ), I2S(udg_playerResources[pID2 + 30])) // Iron
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 17,1 ), I2S(udg_playerResources[pID2 + 45])) // Recruits
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 18,1 ), I2S(udg_playerResources[pID2 + 60])) // Food
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 19,1 ), I2S(udg_playerResources[pID2 + 75])) // Weapons
endif
else
// Not equal to friendly town or revealed
endif
else
// Camp is in current Selection
if IsPlayerEnemy(ConvertedPlayer(pID+1), GetOwningPlayer(u)) != true then
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 6 ,1 ), I2S(udg_playerResources[pID2 ])) // Gold
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 7 ,1 ), I2S(udg_playerResources[pID2 + 15])) // Lumber
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 8 ,1 ), I2S(udg_playerResources[pID2 + 30])) // Iron
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 9 ,1 ), I2S(udg_playerResources[pID2 + 45])) // Recruits
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 10 ,1 ), I2S(udg_playerResources[pID2 + 60])) // Food
call MultiboardSetItemValue( MultiboardGetItem( udg_multiboard[pID], 11,1 ), I2S(udg_playerResources[pID2 + 75])) // Weapons
endif
endif
// if (udg_baseRevealed[uID] == true or IsPlayerEnemy(p, GetOwningPlayer(u)) != true) and IsUnitInGroup(u, udg_townGroup) == true then
endfunction
//===========================================================================
function InitTrig_UpdateMultiboardValues takes nothing returns nothing
endfunction
I saw them doing something like this in Blizzard Bomber and Commander not working for me however..