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

TFS 1.1 Potions/Rope/Door In Training Area Not Working

jperez42

New Member
Joined
Jul 29, 2013
Messages
18
Reaction score
2
Hi Guys,

Not sure if I should open another thread here, but since it's not related to my other issue, I thought it best to.

I have a few issues on my server. Using TFS 1.1 with 10.76 client. The issues (in title) are potions, ropes, and doors in the training area.

Potions are working, but they do not disappear on use. I have an error description below:


Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/potions.lua: onUse
data/global.lua:139: attempt to call global 'getSpectators' (a nil value)
stack traceback:
                 [C]: in function 'getSpectators'
                 data/global.lua:139: in function 'doCreatureSayWithRadius'
                 data/actions/scripts/other/potions.lua:78: in function (data/actions/scripts/other/potions.lua:35)


When attempting to use the doors in the training error, I see the following error in the console:


Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/doors.lua: onUse
data/actions/scripts/other/doors.lua:15: attempt to call global 'getThingPos' (a nil value)
stack traceback:
                 [C]: in function 'getThingPos'
                 data/actions/scripts/other/doors.lua:15: in function (data/actions/scripts/other/doors.lua:1)


When attempting to use ropes I get the following error:


Code:
Lua Script Error: [Action Interface]
data/actions/scripts/tools/rope.lua: onUse
data/actions/scripts/tools/rope.lua:11: attempt to call method 'moveUpstairs' (a nil value)
stack traceback:
                 [C]: in function 'moveUpstairs'
                 data/actions/scripts/tools/rope.lua:11: in function (data/actions/scripts/tools/rope.lua:8)

Let me know if there is anything else I should show. Thanks for the help guys.
 
That's actually the rope.lua I downloaded today. I was having issues prior to downloading it, but replacing my old rope.lua with this one did not fix the issue, rather made this new issue come up. I see it as progress at least. I'm not sure why moveUpstairs is showing as a nil value. It probably doesn't help, but magic rope spell works just fine if that means anything.
 

Thanks @Limos. Updating my position.lua seems to have fixed my roping issues. I was able to fix potions and doors by updating my potions.lua, doors.lua, and some things in global.lua and player.lua.

Funnily enough, updating position.lua seems to have fixed a couple of other things as well, such as the /a command, and the gates of expertise closing when leaving the doorway.

I do have an error when I try to summon a player now though. I updated my teleport_creature_here.lua, but that doesn't seem to have helped. Here is the error I'm receiving when I do /c "playername":

Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/teleport_creature_here.lua: onSay
data/global.lua:354: attempt to call method 'getClosestFreePosition' (a nil value)
stack traceback:
[C]: in function 'getTile'
data/global.lua:354: in function 'getClosestFreePosition'
data/talkactions/scripts/teleport_creature_here.lua:13: in function (data/talkactions/scripts/teleport_creature_here.lua:1)

Is there any other file you can think I might need to update? I appreciate all of the help thus far. Thank you.
 
@Limos I can't seem to find a creature.lua file anywhere in my data directory. However, this exists in global.lua:

Code:
function Creature.getClosestFreePosition(self, position, extended)
    local usePosition = Position(position)
    local tiles = { usePosition:getTile() }
    local length = extended and 2 or 1
  
    local tile
    for y = -length, length do
        for x = -length, length do
            if x ~= 0 or y ~= 0 then
                usePosition.x = position.x + x
                usePosition.y = position.y + y
              
                tile = usePosition:getTile()
                if tile then
                    tiles[#tiles + 1] = tile
                end
            end
        end
    end
  
    for i = 1, #tiles do
        tile = tiles[i]
        if tile:getCreatureCount() == 0 and not tile:hasProperty(CONST_PROP_BLOCKINGANDNOTMOVEABLE) then
            return tile:getPosition()
        end
    end
    return Position()
end

Would I replace that with the text I find in the creature.lua you linked?

EDIT: I modified the above code with the code found in the file you linked. I changed the above to:
Code:
function Creature.getClosestFreePosition(self, position, extended)
local usePosition = Position(position)
local tiles = { Tile(usePosition) }
local length = extended and 2 or 1
local tile
for y = -length, length do
for x = -length, length do
if x ~= 0 or y ~= 0 then
usePosition.x = position.x + x
usePosition.y = position.y + y
tile = Tile(usePosition)
if tile then
tiles[#tiles + 1] = tile
end
end
end
end
for i = 1, #tiles do
tile = tiles[i]
if tile:getCreatureCount() == 0 and not tile:hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID) then
return tile:getPosition()
end
end
return Position()
end
function Creature.getPlayer(self)
return self:isPlayer() and self or nil
end
function Creature.isTile(self)
return false
end

Now /c is working as it should. Thanks a lot @Limos.
 
You can can just use the whole latest lib folder and global.lua.

@Limos I would like to, but I guess I'm not understanding why everything in that github file structure seems different than mine. My lib directory doesn't have the compat and core directories like the one in github. See below for an example.



So I'm not sure how to use the whole lib folder. And that global.lua is 54 lines long or so, whereas mine is 473. Seems like a whole revamp of code or something. I'm not really sure. Any advice helps.

One last thing I'm having issues with. Everything else seems to be working just fine with these updates you've had me make. The /r command is throwing this error in the console now:



Would this be more of the same of just updating another file?
 
@Limos Oh I see. Thank you. I replaced my global.lua with this one, and imported the new lib folder. I also replaced the compat.lua. However that same 'getTile' error still exists when I try to do a /r. I wonder why it doesn't like it. My removething.lua is below:

Code:
function onSay(cid, words, param)
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end

    local position = player:getPosition()
    position:getNextPosition(player:getDirection())

    local tile = position:getTile()
    if not tile then
        player:sendCancelMessage("Object not found.")
        return false
    end

    local thing = tile:getTopVisibleThing(player)
    if not thing then
        player:sendCancelMessage("Thing not found.")
        return false
    end

    if thing:isCreature() then
        thing:remove()
    elseif thing:isItem() then
        if thing == tile:getGround() then
            player:sendCancelMessage("You may not remove a ground tile.")
            return false
        end
        thing:remove(tonumber(param) or -1)
    end

    position:sendMagicEffect(CONST_ME_MAGIC_RED)
    return false
end

Sorry for the million questions. You've been extremely helpful to me so far and I appreciate it. It's nice to get help when asking for it.
 
@Limos That seems to have done it! Thanks! I now receive a new error when I kill any creature. I guess just a strange side effect of the tweaks we've made.


This seems completely unrelated to any changes we would have made, but it is an issue nonetheless. Does this make much sense?
 
I have resolved this by re-compiling theforgottenserver and updating to all of the newest files. This, and many other issues are now resolved. This thread can be marked as solved.
 
Back
Top