dudeim
New Member
- Reaction score
- 22
Heej all,
i've now been bussy with jass for some days and made a little exp system.. But well it doesn't work it automaticly crashes wc3 to the starting screen of wc3 and JassCraft doesn't give any errors at all.. well here's the system
It's probably really ineffecient and it will leak something if you see some please tell them
Thanks
Rep+ for helping
i've now been bussy with jass for some days and made a little exp system.. But well it doesn't work it automaticly crashes wc3 to the starting screen of wc3 and JassCraft doesn't give any errors at all.. well here's the system
JASS:
// this checks if unit in range of killing hero is a friend
function CheckGroup takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))
endfunction
// this is used for floating text doesn't need any changes except if you want to change the exp per creep
function Floating_Text_Friends takes nothing returns nothing
local unit k = GetKillingUnit()
local unit d = GetDyingUnit()
local location loc = GetUnitLoc(k)
local real Bonus_Exp = GetRandomReal((0.5 * GetUnitLevel(d)), (1.0 * GetUnitLevel(d)))
local group friends = GetUnitsInRangeOfLocMatching(1200,loc, Condition(function CheckGroup))
local real Start_Exp = GetUnitLevel(k) *9
local real Total_Exp
local integer Divide = CountUnitsInGroup(friends)
local real Total_Exp_Killer
local unit u = GetEnumUnit()
set Total_Exp = (Start_Exp + Bonus_Exp) / Divide
set Total_Exp_Killer = Total_Exp * GetRandomReal(1.5,2.0)
call GroupRemoveUnit(friends, k)
call CreateTextTagUnitBJ( ( ( "+" + I2S(R2I(Total_Exp_Killer)) ) + "EXP!!!" ), GetEnumUnit(), 0, 7, 50.00, 100, 100, 0 )
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), GetPlayersAll() )
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), GetForceOfPlayer(GetOwningPlayer(k)) )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 90.00, 90 )
call SetTextTagPermanent( GetLastCreatedTextTag(), false )
call SetTextTagLifespan( GetLastCreatedTextTag(), 2.00 )
call AddHeroXP(k,R2I(Total_Exp_Killer),false)
call CreateTextTagUnitBJ( ( ( "+" + I2S(R2I(Total_Exp)) ) + "EXP!!!" ), GetEnumUnit(), 0, 7, 50.00, 100, 100, 0 )
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), GetPlayersAll() )
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), GetForceOfPlayer(GetOwningPlayer(u)) )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 90.00, 90 )
call SetTextTagPermanent( GetLastCreatedTextTag(), false )
call SetTextTagLifespan( GetLastCreatedTextTag(), 2.00 )
call AddHeroXP(u,R2I(Total_Exp),false)
set k = null
set d = null
set u = null
call RemoveLocation(loc)
set loc = null
endfunction
function Players_For_FT_Friends takes nothing returns nothing
local unit k = GetKillingUnit()
local group friends = GetUnitsInRangeOfLocMatching(1200,GetUnitLoc(k), Condition(function CheckGroup))
call ForGroup(friends, function Floating_Text_Friends )
set k = null
endfunction
function Floating_Text_Killer takes nothing returns nothing
local unit k = GetKillingUnit()
local unit d = GetDyingUnit()
local location loc = GetUnitLoc(k)
local real Bonus_Exp = GetRandomReal((0.5 * GetUnitLevel(d)), (1.0 * GetUnitLevel(d)))
local group friends = GetUnitsInRangeOfLocMatching(1200,loc, Condition(function CheckGroup))
local real Start_Exp = GetUnitLevel(k) *9
local real Total_Exp
local integer Divide = CountUnitsInGroup(friends)
local real Total_Exp_Killer
set Total_Exp_Killer = Start_Exp + Bonus_Exp
call CreateTextTagUnitBJ( ( ( "+" + I2S(R2I(Total_Exp_Killer)) ) + "EXP!!!" ), GetEnumUnit(), 0, 7, 50.00, 100, 100, 0 )
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), GetPlayersAll() )
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), GetForceOfPlayer(GetOwningPlayer(GetEnumUnit())) )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 90.00, 90 )
call SetTextTagPermanent( GetLastCreatedTextTag(), false )
call SetTextTagLifespan( GetLastCreatedTextTag(), 2 )
call AddHeroXP(k,R2I(Total_Exp),false)
call RemoveLocation(loc)
set loc = null
set k = null
set d = null
endfunction
function Players_For_FT_Killer takes nothing returns nothing
local unit k = GetKillingUnit()
local location loc = GetUnitLoc(k)
local group friends = GetUnitsInRangeOfLocMatching(1200,loc, Condition(function CheckGroup))
call ForGroup( friends, function Floating_Text_Killer )
set k = null
call RemoveLocation(loc)
set loc = null
endfunction
// floating text end
function Add_Exp takes nothing returns nothing
local unit k = GetKillingUnit()
local unit d = GetDyingUnit()
local location loc = GetUnitLoc(k)
local real Bonus_Exp = GetRandomReal((0.5 * GetUnitLevel(d)), (1.0 * GetUnitLevel(d)))
local group friends = GetUnitsInRangeOfLocMatching(1200,loc, Condition(function CheckGroup))
local real Start_Exp = GetUnitLevel(k) *9
local real Total_Exp
local integer Divide = CountUnitsInGroup(friends)
local real Total_Exp_Killer
local trigger trig = CreateTrigger( )
set Total_Exp = (Start_Exp + Bonus_Exp) / Divide
set Total_Exp_Killer = Start_Exp + Bonus_Exp
call TriggerAddAction(trig,function Players_For_FT_Friends)
set k = null
set d = null
call RemoveLocation(loc)
set loc = null
endfunction
// this is where i check if the player is hunting alone or if he has any friends with him
function Something_Actions takes nothing returns nothing
local unit k = GetKillingUnit()
local unit d = GetDyingUnit()
local location loc = GetUnitLoc(k)
local real Bonus_Exp = GetRandomReal((0.5 * GetUnitLevel(d)), (1.0 * GetUnitLevel(d)))
local group friends = GetUnitsInRangeOfLocMatching(1200,loc, Condition(function CheckGroup))
local real Start_Exp = GetUnitLevel(k) *9
local real Total_Exp
local integer Divide = CountUnitsInGroup(friends)
local real Total_Exp_Killer
if Divide == 1 then
set Total_Exp = Start_Exp + Bonus_Exp
call ForGroup(friends, function Players_For_FT_Killer)
elseif Divide > 1 then
call ForGroup( friends, function Add_Exp )
set k = null
set d = null
call RemoveLocation(loc)
set loc = null
endif
endfunction
//===========================================================================
function InitTrig_Something takes nothing returns nothing
local trigger trig = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( trig, function Something_Actions )
endfunction
It's probably really ineffecient and it will leak something if you see some please tell them
Thanks
Rep+ for helping