Volatile Spiderling
forgottenserver 1.0
forgottenserver 1.0
Summons a spider that remains on the field for up to 5 seconds. At the end of its duration or when dying the spider will explode, dealing poison damage to nearby enemies and poisoning them.
- data/creaturescripts/creaturescripts.xml
Code:<event type="death" name="VolatileSpiderling" script="volatilespiderling.lua"/>
- data/creaturescripts/scripts/volatilespiderling.lua
Code:local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA) combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -0.4, 0, -0.5, 0) combat:setArea(createCombatArea(AREA_CROSS1X1)) local condition = Condition(CONDITION_POISON) condition:setParameter(condition, CONDITION_PARAM_DELAYED, 1) local damageTable = { {4, -3}, {9, -2}, {20, -1} } for i = 1, #damageTable do local t = damageTable[i] condition:addDamage(t[1], 4000, t[2]) end combat:setCondition(condition) function onDeath(cid, ...) local creature = Creature(cid) combat:execute(creature, numberToVariant(cid)) return true end
- data/spells/spells.xml
Code:<instant group="attack" spellid="9" name="Volatile Spiderling" words="utevo res tera" lvl="40" mana="0" selftarget="1" prem="1" exhaustion="2000" groupcooldown="2000" needlearn="0" script="attack/volatile spiderling.lua"> <vocation name="Paladin"/> <vocation name="Royal Paladin"/> </instant>
- data/spells/scripts/attack/volatile spiderling.lua
Code:local combat = Combat() combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE) combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA) combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -0.4, 0, -0.5, 0) combat:setArea(createCombatArea(AREA_CROSS1X1)) local condition = Condition(CONDITION_POISON) condition:setParameter(condition, CONDITION_PARAM_DELAYED, 1) local damageTable = { {4, -3}, {9, -2}, {20, -1} } for i = 1, #damageTable do local t = damageTable[i] condition:addDamage(t[1], 4000, t[2]) end combat:setCondition(condition) function onCastSpell(cid, var) local player = Player(cid) if player == nil then return false end local playerPos = player:getPosition() if player:getMana() < 20 then player:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA) playerPos:sendMagicEffect(CONST_ME_POFF) return false end if #player:getSummons() >= 2 then player:sendCancelMessage("You cannot summon more creatures.") playerPos:sendMagicEffect(CONST_ME_POFF) return false end local creatureId = doSummonCreature("Spider", playerPos) if creatureId == false then player:sendCancelMessage(RET_NOTENOUGHROOM) playerPos:sendMagicEffect(CONST_ME_POFF) return false end local monster = Monster(creatureId) monster:setMaster(player) monster:registerEvent("VolatileSpiderling") addEvent(function(cid) local creature = Creature(cid) if creature ~= nil then combat:execute(creature, numberToVariant(cid)) creature:getPosition():sendMagicEffect(CONST_ME_HITBYPOISON) creature:remove() end end, 5000, creatureId) player:addMana(-20) player:addManaSpent(20) monster:getPosition():sendMagicEffect(CONST_ME_TELEPORT) playerPos:sendMagicEffect(CONST_ME_MAGIC_BLUE) return true end
Last edited: