Hermes
dziwki kola gramy w lola
Hi there!
After updating TFS from 0.3beta2 to 0.3.2 suddenly half of mine scripts stopped working or started causing errors.
1.
No idea why it reads item as nil.
(note. item.actionid blah blah is a tile with AID set, so when player steps on it goblet is created)
2. I have movement script.
It's totally unoptimised (so if someone can, please do this, ew. to make my scripting better ;s), but that's not a problem. Trainers aren't removed when player steps out. It's like there is not function onStepOut :/, but it worked in 0.3b2.
3. SOLVED
4. SOLVED
After updating TFS from 0.3beta2 to 0.3.2 suddenly half of mine scripts stopped working or started causing errors.
1.
Code:
[19/03/2009 13:51:39] data/movements/scripts/arenagoblet.lua:3: attempt to index local 'item' (a nil value)
Code:
function onStepIn(cid, item, position, fromPosition)
local gobletPos = getCreaturePosition(cid)
if item.actionid == 42360 then
if getPlayerStorageValue(cid, 42360) ~= 1 then
setPlayerStorageValue(cid, 42360, 1)
local goblet = doCreateItemEx(5807, 1)
doSetItemSpecialDescription(goblet, "It is given to the courageous victor of the devil arena, minion difficulty.\nAwarded to " .. getCreatureName(cid) .. ".")
doTileAddItemEx({x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}, goblet)
end
elseif item.actionid == 42370 then
if getPlayerStorageValue(cid, 42370) ~= 1 then
setPlayerStorageValue(cid, 42370, 1)
local goblet = doCreateItemEx(5806, 1)
doSetItemSpecialDescription(goblet, "It is given to the courageous victor of the devil arena, slayer difficulty.\nAwarded to " .. getCreatureName(cid) .. ".")
doTileAddItemEx({x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}, goblet)
end
elseif item.actionid == 42380 then
if getPlayerStorageValue(cid, 42380) ~= 1 then
setPlayerStorageValue(cid, 42380, 1)
local goblet = doCreateItemEx(5805, 1)
doSetItemSpecialDescription(goblet, "It is given to the courageous victor of the devil arena, evil difficulty.\nAwarded to " .. getCreatureName(cid) .. ".")
doTileAddItemEx({x=gobletPos.x,y=gobletPos.y-1,z=gobletPos.z}, goblet)
end
end
doTransformItem(item.uid, item.itemid - 1)
return TRUE
end
function onStepOut(cid, item, pos)
doTransformItem(item.uid, item.itemid + 1)
return TRUE
end
(note. item.actionid blah blah is a tile with AID set, so when player steps on it goblet is created)
2. I have movement script.
Code:
function onStepIn(cid, item, toPosition, fromPosition)
local trainers = {
["Crater"] = 'Sorcerer',
["Fungus"] = 'Druid',
["Target"] = 'Paladin',
["Dummy"] = 'Knight'
}
local ptrainers = {
["Crater"] = 'Master Sorcerer',
["Fungus"] = 'Elder Druid',
["Target"] = 'Royal Paladin',
["Dummy"] = 'Elite Knight'
}
local positions = {
[4000] = { {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z, stackpos = 253}, {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z, stackpos = 253} }, -- North
[4001] = { {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z, stackpos = 253}, {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z, stackpos = 253} }, -- South
[4002] = { {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z, stackpos = 253}, {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z, stackpos = 253} }, -- East
[4003] = { {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z, stackpos = 253}, {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z, stackpos = 253} } -- West
}
if getPlayerPromotionLevel(cid) == 0 then
for trainer, vocation in pairs(trainers) do
if getPlayerVocationName(cid) == vocation then
for action, position in pairs(positions) do
if isPlayer(getThingfromPos(getCreaturePosition(cid)).uid) == TRUE then
if item.actionid == action then
doSummonCreature(trainer, position[1])
doSummonCreature(trainer, position[2])
break
end
end
end
end
end
elseif getPlayerPromotionLevel(cid) == 1 then
for trainer, vocation in pairs(ptrainers) do
if getPlayerVocationName(cid) == vocation then
for action, position in pairs(positions) do
if isPlayer(getThingfromPos(getCreaturePosition(cid)).uid) == TRUE then
if item.actionid == action then
doSummonCreature(trainer, position[1])
doSummonCreature(trainer, position[2])
break
end
end
end
end
end
end
return TRUE
end
function onStepOut(cid, item, toPosition, fromPosition)
local trainers = {
["Crater"] = 'Sorcerer',
["Fungus"] = 'Druid',
["Target"] = 'Paladin',
["Dummy"] = 'Knight'
}
local ptrainers = {
["Crater"] = 'Master Sorcerer',
["Fungus"] = 'Elder Druid',
["Target"] = 'Royal Paladin',
["Dummy"] = 'Elite Knight'
}
local positions = {
[4000] = { {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z, stackpos = 253}, {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z, stackpos = 253} }, -- North
[4001] = { {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z, stackpos = 253}, {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z, stackpos = 253} }, -- South
[4002] = { {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z, stackpos = 253}, {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z, stackpos = 253} }, -- East
[4003] = { {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z, stackpos = 253}, {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z, stackpos = 253} } -- West
}
if getPlayerPromotionLevel(cid) == 0 then
for trainer, vocation in pairs(trainers) do
if getPlayerVocation(cid) == vocation then
for action, position in pairs(positions) do
if isPlayer(getThingfromPos(getCreaturePosition(cid)).uid) == TRUE then
if item.actionid == action then
rem = getThingfromPos(position[1])
rem2 = getThingfromPos(position[2])
doRemoveCreature(rem.uid)
doRemoveCreature(rem2.uid)
break
end
end
end
end
end
elseif getPlayerPromotionLevel(cid) == 1 then
for trainer, vocation in pairs(ptrainers) do
if getPlayerVocation(cid) == vocation then
for action, position in pairs(positions) do
if isPlayer(getThingfromPos(getCreaturePosition(cid)).uid) == TRUE then
if item.actionid == action then
rem = getThingfromPos(position[1])
rem2 = getThingfromPos(position[2])
doRemoveCreature(rem.uid)
doRemoveCreature(rem2.uid)
break
end
end
end
end
end
end
return TRUE
end
3. SOLVED
4. SOLVED
Last edited: