Spell Volatile Spiderling

Discussion in 'GlobalEvents, Spells & CreatureEvents' started by kamilwxx, Dec 28, 2013.

  1. kamilwxx

    kamilwxx This account is inactive.

    Joined:
    Dec 7, 2013
    Messages:
    86
    Volatile Spiderling
    forgottenserver 1.0

    [​IMG]

    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: Jan 3, 2014
  2. totolol123

    totolol123 Active Member

    Joined:
    Oct 19, 2010
    Messages:
    303
    Really creative spell.
    Great work!

    PS: I have a question.
    For what it's for?

    Code:
    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
     
    Last edited: Dec 28, 2013
  3. kamilwxx

    kamilwxx This account is inactive.

    Joined:
    Dec 7, 2013
    Messages:
    86
    It adds poison to the condition. Poison damage starts at 3 HP for 4 turns, followed by 9 turns with 2 HP and 20 turns with 1 HP each, which adds up to 50 HP over a period of 2 minutes and 12 seconds (text copied from this article).
     
  4. Printer

    Printer if Printer then print("LUA") end Premium User

    Joined:
    Dec 27, 2009
    Messages:
    5,556
    Really nice bro :) as always :D
     
  5. wafuboe

    wafuboe Member

    Joined:
    Dec 24, 2010
    Messages:
    526
    elise lol xD
     
    Lifer420 likes this.
  6. Codinablack

    Codinablack Dreamer

    Joined:
    Dec 26, 2013
    Messages:
    1,119
    Thats awesome dude
     
  7. Wasbo

    Wasbo Member

    Joined:
    Mar 30, 2008
    Messages:
    168
    Does this work for 0.3.6?
     
  8. kamilwxx

    kamilwxx This account is inactive.

    Joined:
    Dec 7, 2013
    Messages:
    86
    It works only for forgottenserver 1.0.
     
  9. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,496
    Would be funnier if the spider chased the target to explode instead (and I developed a similar function for a spell before)
     
  10. EagerBeaver

    EagerBeaver New Member

    Joined:
    Jul 22, 2015
    Messages:
    4
    This work on 1.1/1.2 :)?
     
  11. trayron1

    trayron1 Member

    Joined:
    Jun 28, 2015
    Messages:
    43
    How to make a spider not gain experience too?
    thanks
     
  12. Snizzle Snap

    Snizzle Snap Active Member

    Joined:
    Jul 31, 2012
    Messages:
    656
  13. trayron1

    trayron1 Member

    Joined:
    Jun 28, 2015
    Messages:
    43
    How to make a spider not gain experience too?
    Thanks
    Sorry for double post :/
     
  14. trayron1

    trayron1 Member

    Joined:
    Jun 28, 2015
    Messages:
    43
    can help me please?+
     
  15. Vladimir Glebov

    Vladimir Glebov http://www.zorgania.com

    Joined:
    Mar 25, 2016
    Messages:
    77
    any can says, how to make like 3 spiders in one time for cast?
     
  16. andu

    andu Sold 649 scripts, 25 maps and 9 events!

    Joined:
    Aug 7, 2009
    Messages:
    783
  17. Vladimir Glebov

    Vladimir Glebov http://www.zorgania.com

    Joined:
    Mar 25, 2016
    Messages:
    77
    any can says, how to make like 3 spiders in one time for cast? what edit?
     

Share This Page