#i have ability like lina's dragon slave, but it does not cause damage.
1 messages · Page 1 of 1 (latest)
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
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
and ApplyDamage is a global function, or you just override it to your ability?
?
First line in OnProjectileHit also wrong. You used target instead of Target
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
You did changes accroding to this?
i see it in console, after use abil
ye
Its random spam that means nothing
You dont changed first line, its still wrong
how? i very dumb
if not target then return end
to
if not Target then return end
Lua is a language that case sensitive
it didin't help
Put debug prints after/before every line so you will know when its stuck due to some bug
Like
print("if condition")
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
deb prints do not appear in the console
Do this, missing debug prints means that your projectile don't touch anyone
🥲
same
Is console printing anything? It might print errors
Is projectile (particle) actually touching unit in game? Just to be sure because i can't find any errors left
Well, its seems harpy from dota so change creep back from basic if its true
I was assuming you are using custom made units
Can you post last version of your code after all changes?
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
any print in console?
only one print?
you mean, it only print one line "if condition" each cast?
in this screenshot, you cast three times
ye
it's the print of projectile destruction, it means that it didnt catch any enemies
🤨
but I launch it at enemies
Okay
change DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_CREEP + DOTA_UNIT_TARGET_BASIC
to DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC
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
thank u