Togu
Advanced OT User
This is my project: The Forgotten Tibia
1) How do I change attack speed permanently?
I've seen in the sources that there is no lua function that changes the attack speed of a player, there is no "setAttackSpeed" function. How do I make that? What's the step by step? I know I could study and learn already done source codes like "setCapacity" and "setMaxHealth" but I've tried and seems too difficult for me. I'm not a C++ expert but I want to learn it the right way. Do I have to make a setAttackSpeed function in player.cpp and then call it in luascript.cpp? What's the system execution flow in this case?
2) How do I insert/update values in database?
I know how to get values:
local rows = db.getResult("SELECT `" .. skill .. "` FROM `players` WHERE `id` = " .. player .. ";")
local newSkillValue = rows:getDataInt(skill)
Edit: /\ /\ /\ /\
db.getResult is giving me error:
But I don't know how to update them (I cant use a sql query with UPDATE cause this will happen with the character online, then when he logout it will go back to the older value).
I wanna make that so player can remove their skills from database.
(for now I'll try make this with the skillLost function that is called when player dies - I already have a function that update skill percent to 0%)
1) How do I change attack speed permanently?
I've seen in the sources that there is no lua function that changes the attack speed of a player, there is no "setAttackSpeed" function. How do I make that? What's the step by step? I know I could study and learn already done source codes like "setCapacity" and "setMaxHealth" but I've tried and seems too difficult for me. I'm not a C++ expert but I want to learn it the right way. Do I have to make a setAttackSpeed function in player.cpp and then call it in luascript.cpp? What's the system execution flow in this case?
2) How do I insert/update values in database?
I know how to get values:
local rows = db.getResult("SELECT `" .. skill .. "` FROM `players` WHERE `id` = " .. player .. ";")
local newSkillValue = rows:getDataInt(skill)
Edit: /\ /\ /\ /\
db.getResult is giving me error:
Code:
attempt to call field 'getResult' (a nil value)
But I don't know how to update them (I cant use a sql query with UPDATE cause this will happen with the character online, then when he logout it will go back to the older value).
I wanna make that so player can remove their skills from database.
(for now I'll try make this with the skillLost function that is called when player dies - I already have a function that update skill percent to 0%)
Last edited: