Nostalgian
Member
- Joined
- Mar 17, 2018
- Messages
- 66
- Reaction score
- 15
Ok so I'm trying to create a new skill menu for OTclient for some custom skills.
All of my skills work great, written in lua. The skill levels are using storage values. Now comes the time when I am trying to connect and display this information on Otclient.
Holy crap I am confused. I have created a new basic menu, and I think I know how to link it to the value, but my problem is that I can't figure out how to get the storage value from tfs to otclient. I know that I need to use extended opcodes, but with all the research I have done, there seems to be some key thing missing that causes it not to work. Maybe I'm overlooking it, I have no idea.
Here is what I have, why is it not working?
A new creaturescript:
customSkill.lua
Register it creaturescripts:
Then i created a new module in otclient by copy/pasting the existing skills.lua and added this in the init function:
Then this in the terminate function:
Then added this function at the bottom of the same file:
It does absolutely nothing. No errors, does not display the storage value as intended in the OTC terminal....nothing. its like this files dont exist.
What am I doing wrong?
All of my skills work great, written in lua. The skill levels are using storage values. Now comes the time when I am trying to connect and display this information on Otclient.
Holy crap I am confused. I have created a new basic menu, and I think I know how to link it to the value, but my problem is that I can't figure out how to get the storage value from tfs to otclient. I know that I need to use extended opcodes, but with all the research I have done, there seems to be some key thing missing that causes it not to work. Maybe I'm overlooking it, I have no idea.
Here is what I have, why is it not working?
A new creaturescript:
customSkill.lua
Code:
function onExtendedOpcode(cid, opcode, buffer)
local player = Player(cid)
local skillLevel = player:getStorageValue(player, 20020)
player:sendExtendedOpcode(cid, 52, skillLevel)
return true
end
Register it creaturescripts:
Code:
<event type="extendedopcode" name="skillLevelOpcode" script="customSkill.lua" />
Then i created a new module in otclient by copy/pasting the existing skills.lua and added this in the init function:
Code:
ProtocolGame.registerExtendedOpcode(52, skillLevel)
Then this in the terminate function:
Code:
ProtocolGame.unregisterExtendedOpcode(52)
Then added this function at the bottom of the same file:
Code:
function skillLevel(protocol, opcode, buffer)
print(buffer)
end
It does absolutely nothing. No errors, does not display the storage value as intended in the OTC terminal....nothing. its like this files dont exist.
What am I doing wrong?