local cfg = {
[7] = {x = 1295, y = 1689, z = 7, stackpos = 253},
[5] = {x = 1296, y = 1691, z = 5, stackpos = 253}
}
local function getNPCs(cid)
local pos = cfg[getCreaturePosition(cid).z]
local NpCid = getThingFromPos(pos.x, pos.y, pos.z, pos.stackpos)
if isNpc(NpCid) == true then
return NpCid
else
return print('[Error:Not a Npc.]'..NpCid)
end
end
local function doNPCSay(NpCid, msg, rndm)
if rndm == true then
return doCreatureSay(NpCid, math.random(#msg), TALKTYPE_SAY)
end
return doCreatureSay(NpCid, msg, TALKTYPE_SAY)
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition)
local npc = getNPCs(cid)
if getCreatureStorage(cid, 1500) == 0 then
doCreatureSetStorage(cid, 1500, 1)
doNPCSay(npc, {'Go on through I can see you are strong enough!', 'Head on '..getCreatureName(cid)..' the king awaits!'}, true)
elseif getCreatureStorage(cid, 1500) == 1 then
doTeleportThing(cid, fromPosition, true)
doNPCSay(npc, 'You have nothing else to do here!')
else
doTeleportThing(cid, fromPosition, true)
doNPCSay(npc, 'You\'re still too weak to venture forward in this path.')
end
return true
end