- Joined
- May 9, 2007
- Messages
- 3,563
JASS:
real damage = (GetHeroInt(GetTriggerUnit(), true ) + GetUnitAbilityLevel(GetTriggerUnit(), 'A003'))
For some reason this is returning 0, even if intelligence is one (default for the current map that I'm making. Any ideas why?
JASS:
scope StormBolt initializer Init
globals
private constant integer Rawcode = 'A003'
private constant string Model = "Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl"
private real damage = (GetHeroInt(GetTriggerUnit(), true ) + GetUnitAbilityLevel(GetTriggerUnit(), 'A003'))
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == Rawcode
endfunction
function StormBoltHit takes nothing returns nothing
local Projectile p = ProjectileInt
if IsUnitEnemy( p.hit, GetOwningPlayer( p.origin ) ) then
call KnockbackTarget( p.hit, Atan2( GetUnitY( p.hit ) - GetUnitY( p.missile ), GetUnitX( p.hit ) - GetUnitX( p.missile ) ), 500, 60, false, true )
call BJDebugMsg(R2S(damage))
call UnitDamageTarget( p.origin, p.hit, damage, false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null )
set p.end = true
endif
endfunction
private function Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real damage = (GetHeroInt( caster, true ) + GetUnitAbilityLevel( caster, Rawcode) * 10 )
local location loc = GetSpellTargetLoc()
local real x = GetUnitX( caster )
local real y = GetUnitY( caster )
local real tx = GetLocationX( loc )
local real ty = GetLocationY( loc )
local real a = Atan2( ty - y, tx -x )
local unit projectile = AddProjectile( caster, x + 50 * Cos( a ), y + 50 * Sin( a ), x + 2000 * Cos( a ), y + 2000 * Sin( a ), 1000, 115, 0, Model, "StormBoltHit", false, 0 )
call SetUnitFlyHeight( projectile, 55, 0 )
call SetUnitScale( projectile, 1.3, 1.3, 1.3 )
set caster = null
call RemoveLocation( loc )
set loc = null
set projectile = null
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( t, function Actions )
call TriggerAddCondition( t, Condition( function Conditions ) )
endfunction
endscope
I've just started JASS, so please excuse me if its a stupid mistake,
I'm using systems by Bobo_The_Kodo (a friend of mine)