Re: Ask a simple question, get a simple answer
Posted: Tue Jan 09, 2018 7:28 pm
Here is an alternate holy_water_flask. It is not a tile-damager, and affects single monsters, one at a time; even in groups. It is possible to miss with these. It could certainly use a custom model and icon; it presently uses default assets.
Code: Select all
defineObject{
name = "holy_water_flask",
baseObject = "flask",
components = {
{
class = "Item",
uiName = "Holy Water Flask",
gameEffect = "Burns the undead",
description = "A flask of blessed water.",
gfxIndex = 150,
impactSound = "impact_blunt",
stackable = true,
projectileRotationSpeed = 15,
projectileRotationZ = -50,
projectileRotationY = 40,
weight = 0.5,
stackable = true,
traits = { "throwing_weapon" },
ConvertToItemOnImpact = "holy_water_spray",
onThrowAttackHitMonster = function(self, monster)
monster.go:playSound("water_hit_small")
if monster.go.monster:hasTrait('undead') and not monster.go.burningmonster then
monster.go:createComponent('BurningMonster')
monster.go.poisonedParticle:setParticleSystem("devine_flames")
monster.go:playSound("ice_hit")
monster.go.burningmonster:setCausedByChampion(math.random(4))
--[[ So I had an elaborate system in place to detect which champion
tossed the holy water flask; for the XP award after the monster dies.
But then I discover that the game apparently doesn't care (!?); it splits
the XP between the party members regardless of who caused the damage.
So what is the purpose of :setCausedByChampion? (Because it's not Boolean)
--]]
end
end
},
{
class = "ThrowAttack",
attackPower = 2,
cooldown = 4,
},
},
tags = { "weapon", "weapon_throwing" },
}
defineObject{
name = "holy_water_spray",
baseObject = "base_spell",
components = {
{
class = "Particle",
particleSystem = "hit_ice",
offset = vec(0, 1.5, 0),
},
},
}
defineParticleSystem{
name = "devine_flames",
emitters = {
{
emitterShape = "MeshShape",
emissionRate = 50,
emissionTime = 0,
maxParticles = 50,
sprayAngle = {0,360},
velocity = {0.1*2,0.5*2},
texture = "assets/textures/particles/smoke_01.tga",
lifetime = {0.5,0.7},
color = {0.15, 0.15, 0.15},
opacity = 1,
fadeIn = 0.1,
fadeOut = 0.5,
size = {0.5, 1.3},
gravity = {0,2,0},
airResistance = 0.05,
rotationSpeed = 0.6,
blendMode = "Translucent",
depthBias = 0.1,
},
{
-- flames
emitterShape = "MeshShape",
maxParticles = 400,
emissionRate = 600,
emissionTime = 0,
sprayAngle = {0,30},
velocity = {0.0, 0.0},
texture = "assets/textures/particles/flame.tga",
frameRate = 40,
frameSize = 32,
frameCount = 40,
lifetime = {0.4, 0.7},
colorAnimation = true,
color0 = {.2, .2, 2.0},
color1 = {0.2, 0.2, 2.0},
color2 = {0.3, 0.5, 1.25},
color3 = {0.1, 0.1, 2},
fadeIn = 0.01,
fadeOut = 0.1,
size = {0.021*2, 0.12*3},
gravity = {0,3,0},
airResistance = 1,
rotationSpeed = 0,
blendMode = "Additive",
objectSpace = true,
},
{
-- small flames
emitterShape = "MeshShape",
maxParticles = 400,
emissionRate = 500,
emissionTime = 0,
sprayAngle = {0,30},
velocity = {0.0, 0.0},
texture = "assets/textures/particles/flame.tga",
frameRate = 40,
frameSize = 32,
frameCount = 40,
lifetime = {0.2, 0.4},
colorAnimation = true,
color0 = {.2, .2, 2.0},
color1 = {0.2, 0.2, 2.0},
color2 = {0.3, 0.5, 1.25},
color3 = {0.1, 0.1, 2},
fadeIn = 0.01,
fadeOut = 0.1,
size = {0.021*2*0.5, 0.12*3*0.7},
gravity = {0,4,0},
airResistance = 1,
rotationSpeed = 0,
blendMode = "Additive",
},
}
}