[TFS1.1] Script to open teleport in local x when monster x dies

Discussion in 'Requests' started by dgprado, Nov 24, 2014.

  1. dgprado

    dgprado Member

    Joined:
    Apr 5, 2009
    Messages:
    789
    Likes Received:
    21
    Best Answers:
    0
    I need a script to open teleport in local x when monster x dies.

    For TFS 1.1
     
  2. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
  3. dgprado

    dgprado Member

    Joined:
    Apr 5, 2009
    Messages:
    789
    Likes Received:
    21
    Best Answers:
    0
  4. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
    Post your script how you changed it and the problems.
     
  5. dgprado

    dgprado Member

    Joined:
    Apr 5, 2009
    Messages:
    789
    Likes Received:
    21
    Best Answers:
    0
    I did some random attempts, no idea what to do, ;/
     
  6. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,740
    Likes Received:
    565
    Best Answers:
    7
    just post your script
     
  7. dgprado

    dgprado Member

    Joined:
    Apr 5, 2009
    Messages:
    789
    Likes Received:
    21
    Best Answers:
    0
    PHP:
    1. local config = {
    2.    ["bossname"] = {time = 60, toPos = {x = 100, y = 100, z = 7}, tpPos = {x = 100, y = 100, z = 7}}
    3. }
    4. local function deleteTeleport(tp)
    5.    local teleport = getTileItemById(tp, 1387).uid
    6.    if(teleport > 0) then
    7.      doRemoveItem(teleport)
    8.      doSendMagicEffect(tp, CONST_ME_POFF)
    9.    end
    10.    return true
    11.  
    12. function onKill(cid, target)
    13.    local monster = config[getCreatureName(target):lower()]
    14.  
    15.    if(isPlayer(target) or not monster) then
    16.      return true
    17.    end
    18.    doCreateTeleport(1387, monster.toPos, monster.tpPos)
    19.    doCreatureSay(cid, "You have "..monster.time.." seconds to enter the teleport!", TALKTYPE_ORANGE_1)
    20.    addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
    21.    return true
     
  8. Ninja

    Ninja 「Speedwagon Foundation」 Staff Member Global Moderator

    Joined:
    Apr 6, 2010
    Messages:
    5,885
    Likes Received:
    1,485
    Best Answers:
    14
    Code (Text):
    1. local config = {
    2.     ["bossname"] = {time = 60, toPos = Position(100, 100, 7), tpPos = Position(100, 100, 7)}
    3. }
    4.  
    5. local function deleteTeleport(position)
    6.     local teleport = Tile(position):getItemById(1387)
    7.     if teleport then
    8.         teleport:remove()
    9.         position:sendMagicEffect(CONST_ME_POFF)
    10.     end
    11. end
    12.  
    13. function onKill(creature, target)
    14.     local monster = config[target:getName():lower()]
    15.     if not monster or target:isPlayer() then
    16.         return true
    17.     end
    18.  
    19.     local item = Game.createItem(1387, 1, monster.tpPos)
    20.     if item:isTeleport() then
    21.         item:setDestination(monster.toPos)
    22.     end
    23.  
    24.     creature:say("You have " .. monster.time .. " seconds to enter the teleport!", TALKTYPE_MONSTER_SAY)
    25.     addEvent(deleteTeleport, monster.time * 1000, monster.tpPos)
    26.     return true
    27. end
     
    Saints Anathema and dgprado like this.
  9. dgprado

    dgprado Member

    Joined:
    Apr 5, 2009
    Messages:
    789
    Likes Received:
    21
    Best Answers:
    0
    Perfect, very thx.
     
  10. wafuboe

    wafuboe Member

    Joined:
    Dec 24, 2010
    Messages:
    667
    Likes Received:
    9
    Best Answers:
    1
    what do i have to put on login.lua,creaturescripts xml and monster file to make this script work_
     
  11. Saints Anathema

    Saints Anathema Old School Doleran

    Joined:
    Feb 24, 2009
    Messages:
    654
    Likes Received:
    7
    Best Answers:
    0
    ninjas script is confirmed working on 1.2 10.98

    nice script was needing it as well
     

Share This Page

Loading...