• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Kill monster then appear Teleporter.

Blysco

New Member
Joined
Oct 12, 2013
Messages
163
Reaction score
2
I dont know why it dont works...
I get no Errors but it dont works.
Nothing happend after i killed the Monster

Code:
local config = {
  timeToRemove = 50, -- seconds
  message = "Teleporter appeared for 50 seconds, You should enter the Teleporter !",
  teleportId = 1387,

  monster = {
  ["Carrion Worm"] = {pos ={x = 32359, y = 32205, z = 8, stackpos=1}, aid=1062}
  }
}

local function removal(position)
  doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
  return true
end

function onStepIn(cid, item, pos)

local tam = {x = 32441, y = 32180, z = 9}

    if item.actionid == 1062 then
        doTeleportThing(cid,tam)
        doSendMagicEffect(getCreaturePosition(cid),1)
        local tp = doRemoveItem(item.uid, 1387)
        end
    return 1
end

function onKill(cid, target, lastHit)
  if(config.bosses[getCreatureName(target)]) then
    local t = config.bosses[getCreatureName(target)]
    local teleport = doCreateItem(config.teleportId, t.pos)
    local position = t.pos
    doItemSetAttribute(teleport, "aid", t.aid)
    doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
    addEvent(removal, config.timeToRemove * 1000, position)
    end
  return true
end


Code:
local config =
{
  bosses = {
    [1062] = {pos = {x = 32441, y = 32180, z = 9, stackpos=1}, value = 1, text = "You got teleportet in a mystery cave !"}
  },
  storage = 56129
}

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
  if(config.bosses[item.actionid]) then
  local t = config.bosses[item.actionid]
  if getPlayerStorageValue(cid, config.storage) < t.value then
    setPlayerStorageValue(cid, config.storage, t.value)
  end

  doTeleportThing(cid,{x = 32441, y = 32180, z = 9})
  doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
  doCreatureSay(cid, t.text, TALKTYPE_ORANGE_1)
  end
end
end
 
registerCreatureEvent(cid, "CreateTeleport") you mean this ??

Yes.
I already have one of these Scripts that works with a Orschabal.
But idk why this one dont works.
 
Code:
local config = {
    timeToRemove = 50, -- seconds
    message = "Teleporter appeared for 50 seconds, You should enter the Teleporter !",
    teleportId = 1387,

  monster = {
      ["Carrion Worm"] = {pos ={x = 32359, y = 32205, z = 8, stackpos=1}, aid=1062}
  }
}

local function removal(position)
    doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
    return true
end

function onKill(cid, target, lastHit)
    if(config.monster[getCreatureName(target)]) then
        local t = config.monster[getCreatureName(target)]
        local teleport = doCreateItem(config.teleportId, t.pos)
        local position = t.pos
        doItemSetAttribute(teleport, "aid", t.aid)
        doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
        addEvent(removal, config.timeToRemove * 1000, position)
    end
    return true
end
 
onKill:
Code:
local config = {
  timeToRemove = 50, -- seconds
  message = "Teleporter appeared for 50 seconds, You should enter the Teleporter !",
  teleportId = 1387,

  monster = {
  ["Carrion Worm"] = {pos ={x = 32359, y = 32205, z = 8, stackpos=1}, aid=1062}
  }
}

local function removal(position)
  doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
  return true
end

function onKill(cid, target, lastHit)
  if(config.monster[getCreatureName(target)]) then
    local t = config.monster[getCreatureName(target)]
    local teleport = doCreateItem(config.teleportId, t.pos)
    local position = t.pos
    doItemSetAttribute(teleport, "aid", t.aid)
    doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
    addEvent(removal, config.timeToRemove * 1000, position)
    end
  return true
end

onStepIn:
Code:
local config =
{
  bosses = {
    [1062] = {pos = {x = 32441, y = 32180, z = 9, stackpos=1}, value = 1, text = "You got teleportet in a mystery cave !"}
  },
  storage = 56129
}

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
  if(config.bosses[item.actionid]) then
  local t = config.bosses[item.actionid]
  if getPlayerStorageValue(cid, config.storage) < t.value then
    setPlayerStorageValue(cid, config.storage, t.value)
  end

  doTeleportThing(cid,{x = 32441, y = 32180, z = 9})
  doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
  doCreatureSay(cid, t.text, TALKTYPE_ORANGE_1)
  end
end
end
 
Have you registered it correctly in creaturescripts.xml/login.lua? Because the script worked fine when I tested it.
 
I already have this script in another Quest and its working fine.
Do i need to register again ??? and how do register this 2x ?
registerCreatureEvent(cid, "CreateTeleport2") ?
 
Why aren't you just adding a second monster to the script?

e.g
Code:
monster = {
    ["Carrion Worm"] = {pos ={x = 32359, y = 32205, z = 8, stackpos=1}, aid=1062},
    ["Dragon"] = {pos ={x = 1000, y = 1000, z = 7, stackpos=1}, aid=1063}
}

Instead of using two scripts that does the same thing.
 
onKill:
Code:
local config = {
  timeToRemove = 50, -- seconds
  message = "Teleporter appeared for 50 seconds, You should enter the Teleporter !",
  teleportId = 1387,

  monster = {
  ["Carrion Worm"] = {pos ={x = 32359, y = 32205, z = 8, stackpos=1}, aid=1062}
  }
}

local function removal(position)
  doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
  return true
end

function onKill(cid, target, lastHit)
  if(config.monster[getCreatureName(target)]) then
    local t = config.monster[getCreatureName(target)]
    local teleport = doCreateItem(config.teleportId, t.pos)
    local position = t.pos
    doItemSetAttribute(teleport, "aid", t.aid)
    doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
    addEvent(removal, config.timeToRemove * 1000, position)
    end
  return true
end

onStepIn:
Code:
local config =
{
  bosses = {
    [1062] = {pos = {x = 32441, y = 32180, z = 9, stackpos=1}, value = 1, text = "You got teleportet in a mystery cave !"}
  },
  storage = 56129
}

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
  if(config.bosses[item.actionid]) then
  local t = config.bosses[item.actionid]
  if getPlayerStorageValue(cid, config.storage) < t.value then
    setPlayerStorageValue(cid, config.storage, t.value)
  end

  doTeleportThing(cid,{x = 32441, y = 32180, z = 9})
  doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
  doCreatureSay(cid, t.text, TALKTYPE_ORANGE_1)
  end
end
end


Escusme how to add this scripts to my server?

thnx to help.
 
Back
Top