#i have ability like lina's dragon slave, but it does not cause damage.

1 messages · Page 1 of 1 (latest)

severe root
#

help me to solve this problem

#

test_dragonscale = class({})

function test_dragonscale:OnSpellStart()
local caster = self:GetCaster()

local point = self:GetCursorPosition()
local casterp = caster:GetOrigin()
local direction = (point - casterp)
direction    = direction:Normalized()        
local offcet = {
    EffectName = "particles/econ/items/vengeful/vengeful_arcana/vengeful_arcana_wave_of_terror_v3.vpcf",
    ability = self,
    Source = casterp,
    vSpawnOrigin = casterp,
    fStartRadius = 700,
    fEndRadius = 700,
    fDistance = 1200,
    iUnitTargetTeam =  2,
    iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE,
    iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_CREEP,
    vVelocity = direction * 1200,
    bProvidesVision = true,
    IsVisionTeamNumber = 2,
    iVisionRadius = 500,
}

ProjectileManager:CreateLinearProjectile( offcet )

end
function test_dragonscale:OnProjectileHit(Target, location)
if not target then return end

local damage = {
    victim = Target,
    attacker = self:GetCaster(),
    damage = 100,
    damage_type = DAMAGE_TYPE_MAGICAL,
    ability = self

test_dragonscale:ApplyDamage( damage )

end

zealous sage
#

You have syntax error: missing "}". Before ApplyDamage line

#

You also should not hardcode constants values in projectile definition or you will suffer greatly when valve decided to change them

prisma epoch
#

and ApplyDamage is a global function, or you just override it to your ability?

severe root
#

?

zealous sage
#

First line in OnProjectileHit also wrong. You used target instead of Target

zealous sage
# severe root ?

Remove test_dragonscale: part before ApplyDamage. This function defined in global namespace and you don't defined it in your ability so you probably wanted to use valve ApplyDamage

severe root
#

okey

#

damage is not appear

zealous sage
severe root
#

i see it in console, after use abil

severe root
zealous sage
#

Its random spam that means nothing

severe root
zealous sage
#

You dont changed first line, its still wrong

severe root
#

how? i very dumb

zealous sage
#

if not target then return end
to
if not Target then return end

prisma epoch
#

Lua is a language that case sensitive

severe root
#

it didin't help

zealous sage
#

Put debug prints after/before every line so you will know when its stuck due to some bug

#

Like
print("if condition")

eternal bronze
#

do you have the console open

#

seems very easy to debug this

severe root
#

like this?

zealous sage
#

Yes

#

Also in projectile table change creep to basic

#

DOTA_UNIT_TARGET_CREEP
to
DOTA_UNIT_TARGET_BASIC

#

Creep is dota only useless thing for custom games

severe root
#

deb prints do not appear in the console

zealous sage
severe root
#

that didn't help either

#

maybe trouble in "unit_custom"?

#

idk

zealous sage
#

Change
Source = casterp
To
Source = caster

#

In OnSpellStart

severe root
#

ok

#

dmg did not appear

zealous sage
#

🥲

severe root
#

same

zealous sage
#

Is console printing anything? It might print errors

severe root
#

its all

zealous sage
#

Is projectile (particle) actually touching unit in game? Just to be sure because i can't find any errors left

severe root
zealous sage
#

Well, its seems harpy from dota so change creep back from basic if its true

#

I was assuming you are using custom made units

severe root
#

i use it)

#

This is not a hero

zealous sage
#

Can you post last version of your code after all changes?

severe root
#

test_dragonscale = class({})

function test_dragonscale:OnSpellStart()
local caster = self:GetCaster()

local point = self:GetCursorPosition()
local casterp = caster:GetOrigin()
local direction = (point - casterp)
direction    = direction:Normalized()        
local offcet = {
    EffectName = "particles/econ/items/vengeful/vengeful_arcana/vengeful_arcana_wave_of_terror_v3.vpcf",
    ability = self,
    Source = caster,
    vSpawnOrigin = casterp,
    fStartRadius = 700,
    fEndRadius = 700,
    fDistance = 1200,
    iUnitTargetTeam =  2,
    iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE,
    iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_CREEP + DOTA_UNIT_TARGET_BASIC,
    vVelocity = direction * 1200,
    bProvidesVision = true,
    IsVisionTeamNumber = 2,
    iVisionRadius = 500,
}

ProjectileManager:CreateLinearProjectile( offcet )

end
function test_dragonscale:OnProjectileHit(Target, location)
print("if condition")
if not Target then return end
print('ApplyDamage')

local damage = {
    victim = Target,
    attacker = self:GetCaster(),
    damage = 100,
    damage_type = DAMAGE_TYPE_MAGICAL,
    ability = self
}
ApplyDamage( damage )

end

prisma epoch
#

case sensitive, very important

severe root
#

not work :c

prisma epoch
#

did you reload the code?

#

or restart the game

severe root
#

ye

#

i do rebuild or reload

prisma epoch
#

any print in console?

severe root
#

if condition

#

problem after "if"

prisma epoch
#

only one print?

severe root
#

ye

prisma epoch
#

you mean, it only print one line "if condition" each cast?

#

in this screenshot, you cast three times

severe root
#

ye

prisma epoch
#

it's the print of projectile destruction, it means that it didnt catch any enemies

#

🤨

severe root
#

but I launch it at enemies

prisma epoch
#

Okay

#

change DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_CREEP + DOTA_UNIT_TARGET_BASIC
to DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC

severe root
#

omg

#

it worked

prisma epoch
#

BASIC already has the definition of CREEP, shouldnt use them together

#

HERO+CREEP+BASIC = 21,
and it will be parsed into 16 + 4 + 1,
it means your projectile will hit hero, building, and courier, but not contain creep

severe root
#

thank u