• 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 Script Training Room ...

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
Code:
[25/12/2008 09:16:13] Lua Script Error: [Action Interface] 
[25/12/2008 09:16:13] data/actions/scripts/booths/training/west.lua:onUse

[25/12/2008 09:16:13] luaDoRemoveCreature(). Creature not found

Script
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    -- Define positions.
    local charPos = getCreaturePosition(cid)
    local doorPos = getThingPos(item.uid)
    local monkOne = {x = doorPos.x - 2, y = doorPos.y - 1, z = doorPos.z}
    local monkTwo = {x = doorPos.x - 2, y = doorPos.y + 1, z = doorPos.z}
    local checkPlayer = {x = doorPos.x - 1, y = doorPos.y, z = doorPos.z, stackpos = 253}
    -- Define directions.
    local newDir  = 3
    local oldDir  = 1
    
    -- Check where the player is located at.
    if ( charPos.x == doorPos.x + 1 and charPos.z == doorPos.z ) then
        -- Check if someone already uses the training booth.
        if isPlayer(getThingfromPos(checkPlayer).uid) == TRUE then
            doPlayerSendTextMessage(cid, 24, "Someone is already using this booth.")
            doSendMagicEffect(getCreaturePos(cid), 2)
        else
            -- Teleport player.
            doTeleportThing(cid, doorPos)
            doMoveCreature(cid, newDir)
            -- Summon training monks.
            doSummonCreature("Trainer", monkOne)
            doSummonCreature("Trainer", monkTwo)
        end
    else
        -- Teleport player.
        doTeleportThing(cid, doorPos)
        doMoveCreature(cid, oldDir)
        -- Remove training monks.
        doRemoveCreature(getThingfromPos({x = monkOne.x, y = monkOne.y, z = monkOne.z, stackpos = 253}).uid)
        doRemoveCreature(getThingfromPos({x = monkTwo.x, y = monkTwo.y, z = monkTwo.z, stackpos = 253}).uid)
        -- Send magic effect.
        doSendMagicEffect(monkOne, 2)
        doSendMagicEffect(monkTwo, 2)
    end
    return TRUE

end
Help plzz
 
Last edited:
Make sure that the actual training creature is called 'Trainer' and that he exists when leaving the room (best way is to make him have lots of health and heal a lot).
 
The script isn't functioning because there is no creature to remove. Therefor, PLEASE first check so the trainer exists/is alive.
 
Back
Top