CastorFlynn
Member
- Joined
- Aug 29, 2021
- Messages
- 103
- Reaction score
- 18
I'm trying to create a creature that, when casting a custom spell, would apply area damage and then be removed.
When casting the spell, the creature sends the effect, but deals no damage.
When casting the spell, the creature sends the effect, but deals no damage.
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_YELLOWSMOKE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
function removemushroom(cid)
local creature = Creature(cid)
if not creature then
return false
end
creature:remove()
end
local spell = Spell("instant")
function spell.onCastSpell(creature, var)
addEvent(removemushroom, 1, creature.uid)
return combat:execute(creature, var)
end
spell:name("fungus explode")
spell:words("####fungusexplode)
spell:isAggressive(true)
spell:needLearn(true)
spell:register()
local mType = Game.createMonsterType("Giant Fungus")
local monster = {}
monster.description = "a giant fungus""
monster.experience = 0
monster.outfit = {
lookTypeEx = 49540,
lookHead = 0,
lookBody = 0,
lookLegs = 0,
lookFeet = 0,
lookAddons = 0,
lookMount = 0,
}
monster.health = 1
monster.maxHealth = 1
monster.race = "blood"
monster.corpse = 0
monster.speed = 0
monster.manaCost = 0
monster.changeTarget = {
interval = 4000,
chance = 20,
}
monster.flags = {
summonable = false,
attackable = false,
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = false,
illusionable = false,
canPushItems = false,
canPushCreatures = false,
staticAttackChance = 90,
targetDistance = 1,
runHealth = 0,
healthHidden = true,
isBlockable = false,
canWalkOnEnergy = true,
canWalkOnFire = true,
canWalkOnPoison = true,
}
monster.attacks = {
{ name = "combat", interval = 2000, chance = 100, type = COMBAT_EARTHDAMAGE, minDamage = -300, maxDamage = -500, radius = 3, effect = CONST_ME_YELLOWSMOKE, target = false },
{ name = "fungus explode", interval = 5000, chance = 100, minDamage = -700, maxDamage = -2000, range = 5 }
}
monster.defenses = {
defense = 1,
armor = 1,
}
monster.elements = {
{ type = COMBAT_PHYSICALDAMAGE, percent = 100 },
{ type = COMBAT_ENERGYDAMAGE, percent = 100 },
{ type = COMBAT_EARTHDAMAGE, percent = 100 },
{ type = COMBAT_FIREDAMAGE, percent = 100 },
{ type = COMBAT_DROWNDAMAGE, percent = 100 },
{ type = COMBAT_ICEDAMAGE, percent = 100 },
{ type = COMBAT_HOLYDAMAGE, percent = 100 },
{ type = COMBAT_DEATHDAMAGE, percent = 100 },
}
monster.immunities = {
{ type = "paralyze", condition = true },
{ type = "outfit", condition = true },
{ type = "invisible", condition = true },
{ type = "energy", condition = true },
{ type = "fire", condition = true },
{ type = "poison", condition = true },
{ type = "ice", condition = true },
{ type = "holy", condition = true },
{ type = "death", condition = true },
}
mType:register(monster)