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

Event onStepIn not found in movements

visum454

New Member
Joined
Apr 3, 2016
Messages
12
Reaction score
2
Hello.

I'm trying to create a complete working server with latest content possible. I'm total rookie in terms of coding, so I'm basically learning while working on this project. If you want to contribute PM me. I'm not making server for money, actually I'm not gonna set up server for players, just share it for free on github etc.

However, let's go to the topic.
I'm getting this error:
Code:
Event onStepIn not found
while trying to make movevent.
This is the script:
Lua:
function onUse(cid, item, frompos, item2, topos)
    local player = Player(cid)
    local failPos = Position(32068, 31887, 6)
    local failPos2 = Position(32068, 31884, 6)
    if player:getLevel() < 8 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to reach at least 8 level to proceed.")
        player:teleportTo(failPos)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    elseif player:getVocation():getId() ~= 4 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be Knight to proceed.")
        player:teleportTo(failPos)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    elseif player:getStorageValue(263267 == -1) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Talk to Oressa first.")
        player:teleportTo(failPos)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    elseif player:getStorageValue(2632637 == 2) then
        player:teleportTo(failPos2)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can't go back now.")
    else
        player:setStorageValue(263267, 2)
    end
end

I know it's total disaster, but this should at least work properly. Basically, it's script for Dawnport vocation rooms. After you get level 8, you talk to Oressa and get your vocation, you can proceed to the one of the room depending on you voc (this is actually script for knight). So there is one tile that should tp you back if you don't meet the requirements: getting 8 lvl, talking to Oressa (storage 263267 should have 1 value then), and you can't go back once you went into the room (storage 263267 should have value 2 then).

Sorry for the mess, but I really count on you, if you can help me.
I will tell you anything you need to know.
Thanks.

Also if you know how to make it simplier (maybe using storages for it is not the best idea) share your proposition!
 
Solution
Nevermind, I have found an mistake. Stupid one.
I have used onUse function in movements, instead onStepIn. I think I just copied inproper function from some other file.
Anyway, I will wait for some opinions about this code now.
This is assuming you are using TFS 1.X:
  • No need to check for players position since you already have the fail pos declared.
  • Looks like you made a typo with storage key 2632637
  • Player userdata is already in the function parameters, cid is used in older distros.
  • Both fail positions can be declared outside of function since they are static and don't need to be declared every time.
  • Make sure to return true or false
Lua:
local fail_pos = {[1] = Position(32068, 31887, 6), [2] =...
Nevermind, I have found an mistake. Stupid one.
I have used onUse function in movements, instead onStepIn. I think I just copied inproper function from some other file.
Anyway, I will wait for some opinions about this code now.
 
Nevermind, I have found an mistake. Stupid one.
I have used onUse function in movements, instead onStepIn. I think I just copied inproper function from some other file.
Anyway, I will wait for some opinions about this code now.
This is assuming you are using TFS 1.X:
  • No need to check for players position since you already have the fail pos declared.
  • Looks like you made a typo with storage key 2632637
  • Player userdata is already in the function parameters, cid is used in older distros.
  • Both fail positions can be declared outside of function since they are static and don't need to be declared every time.
  • Make sure to return true or false
Lua:
local fail_pos = {[1] = Position(32068, 31887, 6), [2] = Position(32068, 31884, 6)}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() < 8 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to reach at least 8 level to proceed.")
        player:teleportTo(fail_pos[1])
        fail_pos[1]:sendMagicEffect(CONST_ME_TELEPORT)
    elseif player:getVocation():getId():getBase() ~= 4 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be Knight to proceed.")
        player:teleportTo(fail_pos[1])
        fail_pos[1]:sendMagicEffect(CONST_ME_TELEPORT)
    elseif player:getStorageValue(263267 == -1) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Talk to Oressa first.")
        player:teleportTo(fail_pos[1])
        fail_pos[1]:sendMagicEffect(CONST_ME_TELEPORT)
    elseif player:getStorageValue(263267 == 2) then
        player:teleportTo(fail_pos[2])
        fail_pos[2]:sendMagicEffect(CONST_ME_TELEPORT)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can't go back now.")
    else
        player:setStorageValue(263267, 2)
    end
    return true
end

NOTE: If you do not have getBase then check current tfs github in lib/core/vocation.lua and get it from there.
 
Solution
Thank you for your help. I will try your code.
Also I managed to fix the typo after I tried to pass the Dawnport. I just didn't edit the post :)

I have last question, is there any place in this forum where I can create my thread about whole project?

edit:
Also, is there possiblity to make whole function as onUse action for doors? I mean having doors instead just scripted tile. Just the same thing but with onUse action. I tried it before, but every type of door I have used acted like there wasn't action assigned to them.
 
Last edited:
Discussion if you just wanna talk about your project. Advertising if you want to show releases. There isn't anything for support of a project besides individual threads.

For doors there is already an action for doors, it's doors.lua.
 
Yes, I tried to analyze this file, but I don't understand how to use it. It's like group of functions in one file, but any of them is not what I want to do.
The first function for quests is the best I have found, but problem is that I don't want to let the door open, just working like some type of lever. This lever will teleport player to the location (without changing it original properties) and after that will never let pass him through door anymore sending him a message.

I think I will just stay with movements then :)

I can't understand why I need to make thread everytime I need something to not break rules. That's quite bad.
I will open discussion then, maybe someone will contribute too.

Thanks for helping :)
 
Yes, I tried to analyze this file, but I don't understand how to use it. It's like group of functions in one file, but any of them is not what I want to do.
The first function for quests is the best I have found, but problem is that I don't want to let the door open, just working like some type of lever. This lever will teleport player to the location (without changing it original properties) and after that will never let pass him through door anymore sending him a message.

I think I will just stay with movements then :)

I can't understand why I need to make thread everytime I need something to not break rules. That's quite bad.
I will open discussion then, maybe someone will contribute too.

Thanks for helping :)
The reason they want you to use multiple threads is because they cater to everyone on otland instead of only the individual. If you solve an issue about doors at the bottom of this thread, later down the road when others are searching for the same solution, they will never come across this thread because it's tagged and titled for your previous question.
 
Back
Top