• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Pythius the Rotten

Ray Rewind

Doctor
Joined
Jun 6, 2009
Messages
1,349
Reaction score
76
Location
Germany
Code:
[07/02/2014 13:51:41] [Error - CreatureScript Interface]
[07/02/2014 13:51:41] data/creaturescripts/scripts/pythius_the_rotten.lua:onDeath
[07/02/2014 13:51:41] Description:
[07/02/2014 13:51:41] data/creaturescripts/scripts/pythius_the_rotten.lua:12: attempt to index global 'item' (a nil value)
[07/02/2014 13:51:41] stack traceback:
[07/02/2014 13:51:41]    data/creaturescripts/scripts/pythius_the_rotten.lua:12: in function <data/creaturescripts/scripts/pythius_the_rotten.lua:6>

Code:
local config = {teleportId = 1387,
boss = "Pythius The Rotten"}

local portal_in_pos = {x = 394, y = 686, z = 7}

function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "PythiusDead")
if config.boss == getCreatureName(cid) then   
local position = portal_in_pos   
teleport = doCreateItem(config.teleportId,1,position)
doItemSetAttribute(teleport, "aid", 9022)
local tp = doRemoveItem(item.uid, 1387)
end
return TRUE
end
 
@Ray Rewind

Code:
local config = {teleportId = 1387,
boss = "Pythius The Rotten"}

local portal_in_pos = {x = 394, y = 686, z = 7}

function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "PythiusDead")
if config.boss == getCreatureName(cid) then
local position = portal_in_pos
teleport = doCreateItem(config.teleportId,1,position)
doItemSetAttribute(teleport, "aid", 9022)
doRemoveItem(item.uid, 1387)
end
return TRUE
end
 
Code:
local config = {teleportId = 1387,
boss = "Pythius The Rotten"}

local position = {x = 394, y = 686, z = 7}

function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "PythiusDead")
if config.boss == getCreatureName(cid) then
teleport = doCreateItem(config.teleportId,1,position)
doItemSetAttribute(teleport, "aid", 9022)
doRemoveItem(item.uid, 1387)
end
return TRUE
end
Why you have 1 local that says name it to "
portal_in_pos" when it's not used? and then in middle of script change it to "position" ?
I just, changed it...
 
same error

Code:
[07/02/2014 16:23:58] [Error - CreatureScript Interface]
[07/02/2014 16:23:58] data/creaturescripts/scripts/pythius_the_rotten.lua:onDeath
[07/02/2014 16:23:58] Description:
[07/02/2014 16:23:58] data/creaturescripts/scripts/pythius_the_rotten.lua:11: attempt to index global 'item' (a nil value)
[07/02/2014 16:23:58] stack traceback:
[07/02/2014 16:23:58]    data/creaturescripts/scripts/pythius_the_rotten.lua:11: in function <data/creaturescripts/scripts/pythius_the_rotten.lua:6>
 
Code:
local config = {teleportId = 1387,
boss = "Pythius The Rotten"}

local portal_in_pos = {x = 394, y = 686, z = 7}

function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "PythiusDead")
if config.boss == getCreatureName(cid) then  
local position = portal_in_pos  
teleport = doCreateItem(config.teleportId,1,position)
doItemSetAttribute(teleport, "aid", 9022)
doTeleportThing(cid, portal_in_pos)
local tp = doRemoveItem(item.uid, 1387)
end
return TRUE
end
Added doteleportthing as you didnt have it already inside the script so basically your portal_in_pos was useless.
 
Oh sorry I forgot to mention this is not the full script it also includes the movement script which is here.

Code:
function onStepIn(cid, item, position, fromPosition)

--Config-->
local starting = {x = 384, y = 687, z = 7, stackpos = 253}
local ending = {x = 375, y = 657, z = 7, stackpos = 253}
local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}
local portal_in_pos = {x = 374, y = 657, z = 7, stackpos = 1}
local portal_iten_pos = getThingfromPos(portal_in_pos)
local teleportId = 1387
local player_pos_entrada = {x = 385, y = 687, z = 7}
local player_pos_saida = {x = 402, y = 686, z = 7}
local boss_pos = {x = 392, y = 685, z = 7}
local boss = "Pythius The Rotten"
local queststatus = getPlayerStorageValue(cid, 53090) --ValueID DA QUEST QUANDO VOCE JA PEGO O ITEM
--EndConfig-->

--Do not touch this--
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end

if item.actionid == 9022 then
doTeleportThing(cid, player_pos_saida)
doSendMagicEffect(player_pos_saida, 10)
doCreateItem(1387, 1, {x = 374, y = 657, z = 7})
return TRUE
end

if item.actionid == 9021 and queststatus == -1 then
players = 0
totalmonsters = 0
monster = {}
repeat
creature = getThingfromPos(checking)
if creature.itemid > 0 then

if getPlayerAccess(creature.uid) == 0 then
players = players + 1
end

if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
totalmonsters = totalmonsters + 1
monster[totalmonsters] = creature.uid
end
end
checking.x = checking.x + 1

if checking.x > ending.x then
checking.x = starting.x
checking.y = checking.y + 1
end

until checking.y > ending.y

if players == 0 then

if totalmonsters ~= 0 then
current = 0
repeat
current = current + 1
doRemoveCreature(monster[current])
until current >= totalmonsters   
end

doTeleportThing(cid, player_pos_entrada)
doSendMagicEffect(player_pos_entrada, 10)
doCreateMonster("Pythius The Rotten",1, {x = 392, y = 685, z = 7})

if portal_iten_pos.itemid == teleportId then
doCreateItem(1387, 1, {x = 374, y = 660, z = 7})
end

else
doMoveCreature(cid, newdir)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'is in the room now. Wait a moment!')
end
else
doMoveCreature(cid, newdir)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Sorry you already did this quest!')
end
end

Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: Console.exe
Anwendungsversion: 0.3.6.3429
Anwendungszeitstempel: 528ce341
Fehlermodulname: Console.exe
Fehlermodulversion: 0.3.6.3429
Fehlermodulzeitstempel: 528ce341
Ausnahmecode: c0000005
Ausnahmeoffset: 0006c7e7
Betriebsystemversion: 6.1.7601.2.1.0.256.48
Gebietsschema-ID: 1031
Zusatzinformation 1: 0a9e
Zusatzinformation 2: 0a9e372d3b4ad19135b953a78882e789
Zusatzinformation 3: 0a9e
Zusatzinformation 4: 0a9e372d3b4ad19135b953a78882e789

Code:
local config = {teleportId = 1387,
boss = "Pythius The Rotten"}

local portal_in_pos = {x = 394, y = 686, z = 7}

function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "PythiusDead")
if config.boss == getCreatureName(cid) then 
local position = portal_in_pos 
teleport = doCreateItem(config.teleportId,1,position)
doItemSetAttribute(teleport, "aid", 9022)
doTeleportThing(cid, portal_in_pos)
local tp = doRemoveItem(item.uid, 1387)
end
return TRUE
end
Added doteleportthing as you didnt have it already inside the script so basically your portal_in_pos was useless.


Code:
[07/02/2014 16:40:21] [Error - CreatureScript Interface]
[07/02/2014 16:40:21] data/creaturescripts/scripts/pythius_the_rotten.lua:onDeath
[07/02/2014 16:40:21] Description:
[07/02/2014 16:40:21] data/creaturescripts/scripts/pythius_the_rotten.lua:13: attempt to index global 'item' (a nil value)
[07/02/2014 16:40:21] stack traceback:
[07/02/2014 16:40:21]    data/creaturescripts/scripts/pythius_the_rotten.lua:13: in function <data/creaturescripts/scripts/pythius_the_rotten.lua:6>
 
Last edited by a moderator:
You can't use item if it's not defined in the script or used as a parameter in the main function (Like in function onUse and onStepIn).

function onStepIn(cid, item, position, fromPosition)
As you can see here, it has the parameter item, so you can use item.uid in that function, it will be the item people step on.

function onDeath(cid, corpse, killer)
As you can see here, there is no parameter item, which is to be expected because there is no item involved when someone dies.

It should remove the teleport after a certain time?
Use addEvent for the time and getTileItemById to get the uid from the item to remove it.
http://otland.net/threads/how-to-kill-a-boss-and-make-a-teleport-appear.201231/#post-1935477
 
Thanks @Limos

but can you remake this script more structured?

Player enter = Boss Spawn => TP To enter Dissappear

Player dies = TP outside appear again

player kill boss = TP appear (alread done) => TP outside appear after 120 seconds when the TP which appear dissappear again

Code:
function onStepIn(cid, item, position, fromPosition)


--Config-->
local starting = {x = 384, y = 687, z = 7, stackpos = 253}
local ending = {x = 375, y = 657, z = 7, stackpos = 253}
local checking = {x = starting.x, y = starting.y, z = starting.z, stackpos = starting.stackpos}
local portal_in_pos = {x = 374, y = 657, z = 7, stackpos = 1}
local portal_iten_pos = getThingfromPos(portal_in_pos)
local teleportId = 1387
local player_pos_entrada = {x = 385, y = 687, z = 7}
local player_pos_saida = {x = 402, y = 686, z = 7}
local boss_pos = {x = 392, y = 685, z = 7}
local boss = "Pythius The Rotten"
local queststatus = getPlayerStorageValue(cid, 53090) --ValueID DA QUEST QUANDO VOCE JA PEGO O ITEM
--EndConfig-->

--Do not touch this--
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end

if item.actionid == 9022 then
doTeleportThing(cid, player_pos_saida)
doSendMagicEffect(player_pos_saida, 10)
doCreateItem(1387, 1, {x = 374, y = 657, z = 7})
return TRUE
end

if item.actionid == 9021 and queststatus == -1 then
players = 0
totalmonsters = 0
monster = {}
repeat
creature = getThingfromPos(checking)
if creature.itemid > 0 then

if getPlayerAccess(creature.uid) == 0 then
players = players + 1
end

if getPlayerAccess(creature.uid) ~= 0 and getPlayerAccess(creature.uid) ~= 3 then
totalmonsters = totalmonsters + 1
monster[totalmonsters] = creature.uid
end
end
checking.x = checking.x + 1

if checking.x > ending.x then
checking.x = starting.x
checking.y = checking.y + 1
end

until checking.y > ending.y

if players == 0 then

if totalmonsters ~= 0 then
current = 0
repeat
current = current + 1
doRemoveCreature(monster[current])
until current >= totalmonsters   
end

doTeleportThing(cid, player_pos_entrada)
doSendMagicEffect(player_pos_entrada, 10)
doCreateMonster("Pythius The Rotten",1, {x = 392, y = 685, z = 7})

if portal_iten_pos.itemid == teleportId then
doCreateItem(1387, 1, {x = 374, y = 660, z = 7})
end

else
doMoveCreature(cid, newdir)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'is in the room now. Wait a moment!')
end
else
doMoveCreature(cid, newdir)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Sorry you already did this quest!')
end
end
 
Back
Top