but it can be done easily without the framework too, so I post it here.
I also made hold monster spell, but it's pretty hard to do without dynamic hooks (see above link)
Code: Select all
defineSpell{
name = "magic_missile",
uiName = "Magic missile",
skill = "fire_magic",
level = 0,
runes = "AD",
manaCost = 15,
onCast = function(champ, x, y, direction, skill)
local dx,dy = getForward(party.facing)
playSoundAt("fireball_launch",party.level,party.x,party.y)
shootProjectile('magic_missile', party.level, party.x+dx, party.y+dy, direction, 14, 0, 0, 0, 0, 0, skill*5, nil, true)
end
}
defineObject{
name = "magic_missile",
class = "Item",
uiName = "Magic missile",
model = "assets/models/items/quarrel.fbx", --assets/models/items/arrow.fbx
--ammoType = "arrow",
gfxIndex = 109,
attackPower = 1,
impactSound = "fireball_hit",
particleEffect = "magic_missile",
stackable = false,
sharpProjectile = false,
projectileRotationY = 90,
weight = 0.1,
}
defineParticleSystem{
name = "magic_missile",
emitters = {
-- flames
{
emissionRate = 50,
emissionTime = 0,
maxParticles = 50,
boxMin = {-0.0, -0.0, 0.0},
boxMax = { 0.0, 0.0, -0.0},
sprayAngle = {0,360},
velocity = {0.3, 0.3},
texture = "assets/textures/particles/torch_flame.tga",
frameRate = 35,
frameSize = 64,
frameCount = 16,
lifetime = {0.8, 0.8},
colorAnimation = true,
color0 = {1, 1, 1},
opacity = 1,
fadeIn = 0.15,
fadeOut = 0.3,
size = {0.125, 0.25},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 1,
blendMode = "Additive",
objectSpace = true,
},
-- glow
{
spawnBurst = true,
emissionRate = 1,
emissionTime = 0,
maxParticles = 1,
boxMin = {0,0,-0.1},
boxMax = {0,0,-0.1},
sprayAngle = {0,30},
velocity = {0,0},
texture = "assets/textures/particles/glow.tga",
lifetime = {1000000, 1000000},
colorAnimation = false,
color0 = {1, 1, 1},
opacity = 1,
fadeIn = 0.1,
fadeOut = 0.1,
size = {0.8, 0.8},
gravity = {0,0,0},
airResistance = 1,
rotationSpeed = 2,
blendMode = "Additive",
objectSpace = true,
}
}
}