Page 1 of 1
Cannon that spawns after hit
Posted: Fri Aug 14, 2015 7:38 pm
by Emera Nova
So I recently just finished working on a pistol that could give a monster a status effect after being hit with the special attack. Next I'd like to just for the shits and giggles to work out a cannon that would after it lands a hit on an enemy or object check for the position and then either spawn say fireballs on that position or around it.
I was thinking that maybe a way to get around having to position check and all that would to just make when the cannon fires it shoots out a magma golums fireball so that it hits with damage plus doing an effective area damage.
Any idea's on how to make the secondaryAttack that I'm looking for here work right?
Going to try to work on the Magma Golum idea and see if it works how I think it should.
Re: Cannon that spawns after hit
Posted: Fri Aug 14, 2015 7:48 pm
by minmay
FirearmAttackComponent is kind of like a melee attack, it doesn't make a projectile that you can attach an onProjectileHit hook to. But unlike MeleeAttackComponent it also doesn't have an onHitMonster hook. I'm curious what you did to give the monster a "status effect after being hit" - did you use the MonsterComponent.onDamage hook? That's gross but also the only way I can think of to do it...
edit: welp, apparently I was wrong. I could swear I checked for the existence of FirearmAttackComponent.onHitMonster in an earlier version of the game, at least...
Re: Cannon that spawns after hit
Posted: Fri Aug 14, 2015 7:50 pm
by Emera Nova
This is what I used to give the monster a status effect
Code: Select all
{
class = "FirearmAttack",
name = "mark",
gameEffect = "Cause lingering damage over time",
uiName = "Mark of the Devourer",
cooldown = 8,
energyCost = 25,
ammo = "pellet",
attackPower = 10,
onHitMonster = function(self, monster)
monster:setCondition("poisoned", 18)
-- mark condition so that exp is awarded if monster is killed by the condition
local poisonedCondition = monster.go.poisoned
if poisonedCondition then
poisonedCondition:setCausedByChampion(1)
end
end,
requirements = { "firearms", 2, "critical", 1 }
},
Re: Cannon that spawns after hit
Posted: Fri Aug 14, 2015 7:51 pm
by Emera Nova
And Ok so if I make it a CastSpell instead and shoot out say a fireball, how can I get it so afterwards on the hit it will check for hte position of where it blew up and then spawn wall_fire in the squares around it if open. It turns out that the magma golem doesn't use a spell on it so I can't just call on the magma_meteor.