I've create system to give hero exp and gold when killing unit.
Everything (Gold, Exp, Gem (It's variable)) works very well except for the floating text which I used GetLocalPlayer(). The floating text isn't appear at all.
When I remove GetLocalPlayer(), the floating text appears for all players. But I want only specific player to see it. So I've to use GetLocalPlayer().
I've tried to used a BJ function for floating text visibility but it's still have problem.
Doesn't GetLocalPlayer() work in map-specific custom script (Code above all trigger) ??
+rep to those helpful reply. Thank you so much
(Don't care much about mathematics in system)
Everything (Gold, Exp, Gem (It's variable)) works very well except for the floating text which I used GetLocalPlayer(). The floating text isn't appear at all.
When I remove GetLocalPlayer(), the floating text appears for all players. But I want only specific player to see it. So I've to use GetLocalPlayer().
I've tried to used a BJ function for floating text visibility but it's still have problem.
Doesn't GetLocalPlayer() work in map-specific custom script (Code above all trigger) ??
Code:
/////////////////////////////////////////////////////////////////////////////////
//////////////Below are the system of Experience + Gold + Gem////////////////////
/////////////////////////////////////////////////////////////////////////////////
[COLOR="red"]function EXPCalculator takes integer Low, integer High returns integer
local real TempInt1 = (((High + 1) - Low) / 3)
local integer TempInt2
local integer TempInt3
if (GetRandomInt(1,5) == 1) then
return GetRandomInt(Low,High)
else
set TempInt2 = ( Low + R2I(TempInt1) )
set TempInt3 = ( High + R2I(TempInt1) )
return GetRandomInt(TempInt2, TempInt3)
endif
return 0
endfunction
You don't have to care about mathematics[/COLOR]
function EXP takes integer GdLow, integer GdHigh, integer ExpLow, integer ExpHigh, integer Gem, location DiePoint returns nothing
local location TempLoc
local integer Gold = EXPCalculator(GdLow, GdHigh)
local integer Experience = EXPCalculator(ExpLow, ExpHigh)
local string TempString = null
local integer Index = 0
local force TempPlayerGroup
if (Gold > 0) then
set TempString = "|c00666600" + TempString + "+ " + I2S(Gold) + " Gold|r\n"
endif
if (Gem > 0) then
set TempString = "|c0000ff66" + TempString + "+ " + I2S(Gem) + " Gem|r\n"
endif
if (Experience > 0) then
set TempString = "|c00660099" + TempString + "+ " + I2S(Experience) + " Exp|r"
endif
loop
exitwhen Index > 11
set TempLoc = GetUnitLoc(udg_Hero_of_Player[Index])
if ( DistanceBetweenPoints(TempLoc, DiePoint) <= 1000 ) then
call AddHeroXPSwapped( Experience, udg_Hero_of_Player[Index], false )
call AdjustPlayerStateBJ( Gold, ConvertedPlayer(Index), PLAYER_STATE_RESOURCE_GOLD )
set udg_Hero_Resource_Gem[Index] = ( udg_Hero_Resource_Gem[Index] + Gem )
call ForceAddPlayer(TempPlayerGroup, GetOwningPlayer(udg_Hero_of_Player[Index]))
endif
set Index = Index + 1
endloop
if (IsPlayerInForce(GetLocalPlayer(), TempPlayerGroup)) then
set TempLoc = PolarProjectionBJ(DiePoint, 80.00, 45.00)
call CreateTextTagLocBJ( TempString, TempLoc, 0, 8, 100, 100, 100, 0 )
call SetText (GetLastCreatedTextTag(), 2, 30 )
call RemoveLocation (TempLoc)
endif
call RemoveLocation (DiePoint)
endfunction
Code:
Chicken
Events
Unit - A unit Dies
Conditions
(Unit-type of (Triggering unit)) Equal to Chicken
Actions
Set TempPoint = (Position of (Triggering unit))
Custom script: call EXP (1,3,0,2,0, udg_TempPoint)
If ((Random integer number between 1 and 100) Less than or equal to 3) then do (Item - Create [001] Chicken Claw at TempPoint) else do (Do nothing)
Custom script: call RemoveLocation (udg_TempPoint)
+rep to those helpful reply. Thank you so much
(Don't care much about mathematics in system)