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

Smokiee Jo

Website Scripter
Joined
Nov 8, 2012
Messages
217
Solutions
1
Reaction score
16
Location
Ireland
Hello Otland


As my title says "Trainers" i was wanting a auto tp trainers so you would get tp'd to a free training spot i have currently tried http://otland.net/f16/random-teleport-trainer-rooms-182026/ but when i go through my teleport to trainers, it just stacks everyone at the teleport destination i dont know if that is the correct way to do it i have all my UID's are correct but it dont wanna tp people to a free training spot with the UID

1uGafd.png

i also get this in my console

Lua:
[Error - moveEvents Interface]
data/moveevents/scripts/training.lua:onStepIn
Discription:
<LuaInterface::LuagetThingPosition> Thing not found


if anyone could help that would be awsome!


Repp++
 
Last edited:
Lua:
function onStepIn(cid, item, position, fromPosition)
    for i = 17000, 17122 do
        local pos = getThingPos(i)
        if not isPlayer(getTopCreature(pos).uid) then
            doTeleportThing(cid, pos)
             doCreatureSay(cid, 'Using a tool to cast spells or to keep your character online is ok.', 19, false, cid)
            doSendMagicEffect(position, CONST_ME_TELEPORT)
            doSendMagicEffect(pos, CONST_ME_TELEPORT)
            return
        end
    end
    doTeleportThing(cid, fromPosition, true)
    doCreatureSay(cid, 'All training slots are taken', 19, false, cid)
    doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
end

here is my XML also

Lua:
<movevent type="StepIn" uniqueid="1234" event="script" value="trainin.lua"/>

im using 0.4 if that helps in any way
 
Update

Your script seems to work but when i try and go through it spams my console saying "call stack overflow" like i mean spamms in xD




-- update ---

your script is only letting one person in at a time so basically its trying to stack everyone on the same position *changed the 3 tiles* also so when 1 person goes in its telling the others that the trainers are full :S
 
Last edited:
yeah we have fixed that issue just got a problem if you could help this is my LUA atm


Lua:
    function onStepIn(cid, item, position, fromPosition, toPosition)
            for i = 1000, 1159 do
                    if getTopCreature(getThingPos(i)).uid > 0 then
                            doTeleportThing(cid, fromPosition, true)
                            doCreatureSay(cid, "The training area is full. Come back later.", TALKTYPE_MONSTER)
                    else
                            doTeleportThing(cid, getThingPos(i), false)
                            doCreatureSay(cid, "Good luck! Botting is not allowed.", TALKTYPE_MONSTER, nil, nil, t[i])
                    end
            end
    end

But when you get tp'd to a training spot the msg's dont come up

Code:
 "Good luck! Botting is not allowed."
if you could help that would be awsome! :D
 
doCreatureSay(cid, "Good luck! Botting is not allowed.", TALKTYPE_MONSTER, nil, nil, t)
to:
doCreatureSay(cid, "Good luck! Botting is not allowed.", TALKTYPE_MONSTER, nil, nil, getThingPos(i))
 
We figured it out via Teamviewer. ;)

Lua:
local config = {
	{x = 100, y = 100, z = 7}, -- this is the first training spot, you add the rest
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition)
	for _, pos in pairs(config) do
		if not isPlayer(getTopCreature(pos).uid) then
			if doTeleportThing(cid, pos) then
				doCreatureSay(cid, "You have entered the training area!", TALKTYPE_MONSTER)
				return true
			end
		end
	end
	doTeleportThing(cid, fromPosition)
	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	doCreatureSay(cid, "The training area is full.", TALKTYPE_MONSTER, nil, nil, fromPosition)
	return true
end
 
Hey I need help with this.. Can anyone help me.. Please

Ok so to start i have it set up like this.. I'm using only 5 atm to test it. i used the UID 3001 for the first spot, 3002 for the next etc~

Code:
function onStepIn(cid, item, position, fromPosition)
for i = 3001, 3005 do
local pos = getThingPos(i)
if not isPlayer(getTopCreature(pos).uid) then
doTeleportThing(cid, pos)
doCreatureSay(cid, 'Using a tool to cast spells or to keep your character online is ok.', TALKTYPE_ORANGE_1, false, cid)
doSendMagicEffect(position, CONST_ME_TELEPORT)
doSendMagicEffect(pos, CONST_ME_TELEPORT)
break
end
end
doTeleportThing(cid, fromPosition, true)
doCreatureSay(cid, 'All training slots are taken', TALKTYPE_ORANGE_1, false, cid)
doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
end

Now on my Teleport that leads to these spots I set it up with UID 3000...

Now what happens is. I try to enter the portal and it says "All training slots are taken". but its only me online.
but the other thing is I get no console errors so im not sure what the problem could be?
 

Similar threads

Back
Top