• 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!

Lua (OTHIRE) Monster die and transform in a teleport

massuco

Brazilian, sorry for my bad english XD
Joined
Feb 17, 2013
Messages
199
Solutions
8
Reaction score
22
Location
Brasil
Hello, as the tittle says, I have one monster and want to when he dies, he transform on one teleport, not on a corpse.

I am using OTHire and get this script.
Lua:
local bosses = {
        ["rat"] = { x = 1146, y = 981, z = 7 }                
}
local time = 30 -- Seconds
function onKill(cid, target, lastHit, fromPosition)
        for name, pos in pairs(bosses) do
                if (name == getCreatureName(target):lower()) then
                       
                        doCreateTeleport(1387, pos[1], getThingPos(uid))
                        addEvent(doRemoveItem, tpTime * 1000, getTileItemById(pos[2], 1387).uid, 1)
                end
        end
        return true
end

I have registered on login.lua of creaturescripts and on the monster script, but on the monster die, I get the error:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/monsterPortals.lua:onKill

LuaScriptInterface::luaGetThingPos(). Thing not found

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/monsterPortals.lua:onKill

attempt to index a nil value
stack traceback:
        [C]: in function 'doCreateTeleport'
        data/creaturescripts/scripts/monsterPortals.lua:10: in function <data/creaturescripts/scripts/monsterPortals.lua:6>
I dont know how to make this line works:
Lua:
doCreateTeleport(1387, pos[1], getThingPos(uid))

I know that the function doCreateTeleport on OThire have the params:
Lua:
doCreateTeleport(teleportID, positionToGo, createPosition)
teleportID = 1387
positionToGo is the position configured on the script
createPosition is the position that monster died.

Any ideias?
 
Right, and, I wanted to change something, I wanted that the tp teleport you next to the boss, its possible?
example: when you enter the teleport, you will be teleported to the monster name (just gonna have a monster with the name)
A teleport can only have one destination set to it.
The only way around this would be to set-up a movements script for the item 1387, and then run every single teleport through that script, to get the desired results.

Well, unless you want to remove and re-create the teleport multiple times, everytime your creature moves.. and constantly checking for available destinations to teleport to.

Both of my idea's sound less then ideal, but the first one may become a practical and needed endeavor if there are many such unique teleport situations you plan on creating.
 
Try to set the stackpos of the teleport pos to fix the bug.
and what stackpos I set to it?
A teleport can only have one destination set to it.
The only way around this would be to set-up a movements script for the item 1387, and then run every single teleport through that script, to get the desired results.

Well, unless you want to remove and re-create the teleport multiple times, everytime your creature moves.. and constantly checking for available destinations to teleport to.

Both of my idea's sound less then ideal, but the first one may become a practical and needed endeavor if there are many such unique teleport situations you plan on creating.
I have a custom teleport, with id 5000 for example, I can set a movement to this specifically teleport, to this teleport the player next to the monster I want?
 
Back
Top