- Joined
- Nov 22, 2006
- Messages
- 1,260
Hello everybody,
I am creating a spell, more precise, remaking an existing spell from GUI to JASS. I'm an experienced jasser, so I have no idea why can't I find the problem in such a simple spell. Here's what the spell does (passive): It's supposed to create an orb above the caster, the orb grows every time the hero is attacked, until it grows to 100% of his original size. Then it is destroyed and it casts an ability on the unit who hit the last. The problem is that the orb is not showing, I don't know why. I tried detecting it with PingMinimap, and it shows that the orb is in the position of the caster, how it should be. That's a little weird, because I don't see it. Here's the code (it has 2 triggers):
I checked the rawcodes couple of times, but unfortunately, they are correct. Also, the orb doesn't cast the ability when the hits reaches 20, and it should. Integer h is raising like it should, so there's no problem there.
Thanks in advance
I am creating a spell, more precise, remaking an existing spell from GUI to JASS. I'm an experienced jasser, so I have no idea why can't I find the problem in such a simple spell. Here's what the spell does (passive): It's supposed to create an orb above the caster, the orb grows every time the hero is attacked, until it grows to 100% of his original size. Then it is destroyed and it casts an ability on the unit who hit the last. The problem is that the orb is not showing, I don't know why. I tried detecting it with PingMinimap, and it shows that the orb is in the position of the caster, how it should be. That's a little weird, because I don't see it. Here's the code (it has 2 triggers):
JASS:
constant function NorthrendShield_SpellId takes nothing returns integer
return 'A00I'
endfunction
constant function NorthrendShield_OrbDamageId takes nothing returns integer
return 'A00J'
endfunction
constant function NorthrendShield_OrbId takes nothing returns integer
return 'h00B'
endfunction
constant function NorthrendShield_HitsRequired takes nothing returns real
return 20.0
endfunction
//===========================================================================
function Trig_Northrend_Shield_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), NorthrendShield_SpellId()) > 0
endfunction
function Trig_Northrend_Shield_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local unit t = GetAttacker()
local unit u = GetHandleUnit(c, "o")
local integer h = GetHandleInt(c, "h")
local real r = 1/NorthrendShield_HitsRequired()
if h == 0 then
set u = CreateUnit(GetOwningPlayer(c), NorthrendShield_OrbId(), GetUnitX(c), GetUnitY(c), 0)
endif
set h = h + 1
call BJDebugMsg(R2S(r))
call SetHandleInt(c, "h", h)
call SetHandleHandle(c, "o", u)
call SetUnitScale(u, r * h, r * h, r * h)
if h == R2I(NorthrendShield_HitsRequired()) then
call SetUnitAbilityLevel(u, NorthrendShield_OrbDamageId(), GetUnitAbilityLevel(c, NorthrendShield_SpellId()))
call IssueTargetOrder(u, "shadowstrike", t)
call UnitApplyTimedLife(u, 'BTLF', 0.01)
call SetHandleInt(c, "h", 0)
call SetHandleHandle(c, "o", null)
endif
set c = null
set t = null
set u = null
endfunction
//===========================================================================
function NorthrendShield_OrbMoveFilter takes nothing returns boolean
return GetUnitAbilityLevel(GetFilterUnit(), NorthrendShield_SpellId()) > 0
endfunction
function NorthrendShield_OrbMoveActions takes nothing returns nothing
local group g = CreateGroup()
local boolexpr b = Condition(function NorthrendShield_OrbMoveFilter)
local unit u
local unit o
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, b)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
set o = GetHandleUnit(u, "o")
if o != null then
call SetUnitX(o, GetUnitX(u))
call SetUnitY(o, GetUnitY(u))
endif
endloop
call DestroyGroup(g)
call DestroyBoolExpr(b)
set g = null
set b = null
set o = null
endfunction
//===========================================================================
function InitTrig_Northrend_Shield takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set gg_trg_Northrend_Shield = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Northrend_Shield, Player(i), EVENT_PLAYER_UNIT_ATTACKED, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(gg_trg_Northrend_Shield, Condition(function Trig_Northrend_Shield_Conditions))
call TriggerAddAction(gg_trg_Northrend_Shield, function Trig_Northrend_Shield_Actions)
call TriggerRegisterTimerEvent(t, 0.035, true)
call TriggerAddAction(t, function NorthrendShield_OrbMoveActions)
set t = null
endfunction
I checked the rawcodes couple of times, but unfortunately, they are correct. Also, the orb doesn't cast the ability when the hits reaches 20, and it should. Integer h is raising like it should, so there's no problem there.
Thanks in advance