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
    Likes Received:
    18
    Best Answers:
    0
    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 (Text):
      1.     <event type="death" name="VolatileSpiderling" script="volatilespiderling.lua"/>
    • data/creaturescripts/scripts/volatilespiderling.lua
      Code (Text):
      1. local combat = Combat()
      2. combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
      3. combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
      4. combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -0.4, 0, -0.5, 0)
      5. combat:setArea(createCombatArea(AREA_CROSS1X1))
      6.  
      7. local condition = Condition(CONDITION_POISON)
      8. condition:setParameter(condition, CONDITION_PARAM_DELAYED, 1)
      9.  
      10. local damageTable = {
      11.     {4, -3},
      12.     {9, -2},
      13.     {20, -1}
      14. }
      15. for i = 1, #damageTable do
      16.     local t = damageTable[i]
      17.     condition:addDamage(t[1], 4000, t[2])
      18. end
      19.  
      20. combat:setCondition(condition)
      21.  
      22.  
      23. function onDeath(cid, ...)
      24.     local creature = Creature(cid)
      25.     combat:execute(creature, numberToVariant(cid))
      26.     return true
      27. end
      28.  
    • data/spells/spells.xml

      Code (Text):
      1.         <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">
      2.                 <vocation name="Paladin"/>
      3.                 <vocation name="Royal Paladin"/>
      4.         </instant>
    • data/spells/scripts/attack/volatile spiderling.lua
      Code (Text):
      1. local combat = Combat()
      2. combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
      3. combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
      4. combat:setFormula(COMBAT_FORMULA_LEVELMAGIC, -0.4, 0, -0.5, 0)
      5. combat:setArea(createCombatArea(AREA_CROSS1X1))
      6.  
      7. local condition = Condition(CONDITION_POISON)
      8. condition:setParameter(condition, CONDITION_PARAM_DELAYED, 1)
      9.  
      10. local damageTable = {
      11.     {4, -3},
      12.     {9, -2},
      13.     {20, -1}
      14. }
      15. for i = 1, #damageTable do
      16.     local t = damageTable[i]
      17.     condition:addDamage(t[1], 4000, t[2])
      18. end
      19.  
      20. combat:setCondition(condition)
      21.  
      22.  
      23. function onCastSpell(cid, var)
      24.     local player = Player(cid)
      25.     if player == nil then
      26.         return false
      27.     end
      28.  
      29.     local playerPos = player:getPosition()
      30.     if player:getMana() < 20 then
      31.         player:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
      32.         playerPos:sendMagicEffect(CONST_ME_POFF)
      33.         return false
      34.     end
      35.  
      36.     if #player:getSummons() >= 2 then
      37.         player:sendCancelMessage("You cannot summon more creatures.")
      38.         playerPos:sendMagicEffect(CONST_ME_POFF)
      39.         return false
      40.     end
      41.  
      42.     local creatureId = doSummonCreature("Spider", playerPos)
      43.     if creatureId == false then
      44.         player:sendCancelMessage(RET_NOTENOUGHROOM)
      45.         playerPos:sendMagicEffect(CONST_ME_POFF)
      46.         return false
      47.     end
      48.  
      49.     local monster = Monster(creatureId)
      50.     monster:setMaster(player)
      51.     monster:registerEvent("VolatileSpiderling")
      52.  
      53.     addEvent(function(cid)
      54.         local creature = Creature(cid)
      55.         if creature ~= nil then
      56.             combat:execute(creature, numberToVariant(cid))
      57.             creature:getPosition():sendMagicEffect(CONST_ME_HITBYPOISON)
      58.             creature:remove()
      59.         end
      60.     end, 5000, creatureId)
      61.  
      62.     player:addMana(-20)
      63.     player:addManaSpent(20)
      64.  
      65.     monster:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
      66.     playerPos:sendMagicEffect(CONST_ME_MAGIC_BLUE)
      67.     return true
      68. end
      69.  
     
    Last edited: Jan 3, 2014
  2. totolol123

    totolol123 Active Member

    Joined:
    Oct 19, 2010
    Messages:
    303
    Likes Received:
    56
    Best Answers:
    0
    Really creative spell.
    Great work!

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

    Code (Text):
    1. local damageTable = {
    2. {4, -3},
    3. {9, -2},
    4. {20, -1}
    5. }
    6. for i = 1, #damageTable do
    7. local t = damageTable[i]
    8. condition:addDamage(t[1], 4000, t[2])
    9. end
     
    Last edited: Dec 28, 2013
  3. kamilwxx

    kamilwxx This account is inactive.

    Joined:
    Dec 7, 2013
    Messages:
    86
    Likes Received:
    18
    Best Answers:
    0
    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,589
    Likes Received:
    1,865
    Best Answers:
    4
    Really nice bro :) as always :D
     
  5. wafuboe

    wafuboe Member

    Joined:
    Dec 24, 2010
    Messages:
    612
    Likes Received:
    9
    Best Answers:
    0
    elise lol xD
     
    Lifer420 likes this.
  6. Codinablack

    Codinablack Dreamer

    Joined:
    Dec 26, 2013
    Messages:
    1,119
    Likes Received:
    347
    Best Answers:
    0
    Thats awesome dude
     
  7. Wasbo

    Wasbo Member

    Joined:
    Mar 30, 2008
    Messages:
    168
    Likes Received:
    1
    Best Answers:
    0
    Does this work for 0.3.6?
     
  8. kamilwxx

    kamilwxx This account is inactive.

    Joined:
    Dec 7, 2013
    Messages:
    86
    Likes Received:
    18
    Best Answers:
    0
    It works only for forgottenserver 1.0.
     
  9. cbrm

    cbrm Just another mod Staff Member Global Moderator

    Joined:
    Jan 6, 2009
    Messages:
    6,520
    Likes Received:
    787
    Best Answers:
    0
    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
    Likes Received:
    0
    Best Answers:
    0
    This work on 1.1/1.2 :)?
     
  11. trayron1

    trayron1 Member

    Joined:
    Jun 28, 2015
    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    How to make a spider not gain experience too?
    thanks
     
  12. Snizzle Snap

    Snizzle Snap Active Member

    Joined:
    Jul 31, 2012
    Messages:
    658
    Likes Received:
    195
    Best Answers:
    0
  13. trayron1

    trayron1 Member

    Joined:
    Jun 28, 2015
    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    How to make a spider not gain experience too?
    Thanks
    Sorry for double post :/
     
  14. trayron1

    trayron1 Member

    Joined:
    Jun 28, 2015
    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    can help me please?+
     
  15. Vladimir Glebov

    Vladimir Glebov http://www.zorgania.com

    Joined:
    Mar 25, 2016
    Messages:
    78
    Likes Received:
    11
    Best Answers:
    0
    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:
    807
    Likes Received:
    197
    Best Answers:
    6
  17. Vladimir Glebov

    Vladimir Glebov http://www.zorgania.com

    Joined:
    Mar 25, 2016
    Messages:
    78
    Likes Received:
    11
    Best Answers:
    0
    any can says, how to make like 3 spiders in one time for cast? what edit?
     

Share This Page

Loading...