• 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 0.X Rooking system TFS 0.4 help please

marek12

Available for sprite works
Joined
Apr 8, 2020
Messages
398
Solutions
4
Reaction score
395
Hi, does anyone got a creaturescript rook system?(when player die on level 6, he will be rooked)
Using TFS 0.4 Znote Acc
 
It's not in my case :S I can die untill level 1 and nothing happens. vocation+level+skills still remain as it was.
Post automatically merged:

does anyone can at least explain me how do I set mysql query so it will focus only 1 character and not all of them?
for example : I set this
db.query("UPDATE players SET level = 1, maglevel = 0, experience = 0, health = 150, healthmax = 150, mana = 0, manamax = 0, conditions = NULL, soul = 100, cap = 400, posx = 0, posy = 0, posz = 0, town_id = 2, lastlogin = 0, lastip = 0, skull = 0, skulltime = 0, rank_id = 0, blessings = 0")
in my script and it will reset all characters. but how can I make it reset only player who is using it?
 
This demonstrates usage of the WHERE clause.
SQL:
UPDATE `players` SET experience = 0 WHERE id = "1";
#Query OK, 0 rows affected (0.001 sec)
#Rows matched: 1 Changed: 0 Warnings: 0

UPDATE `players` SET experience = 0 WHERE name = "Account Manager";
#Query OK, 0 rows affected (0.001 sec)
#Rows matched: 1 Changed: 0 Warnings: 0
(Changed nothing cuz exp was already 0, but you can see it did match the row)


LUA:
local target = db.getResult("SELECT `name`, `id` FROM `players` WHERE `name` = " .. db.escapeString(getPlayerName(cid)) .. ";")

And here is a simple demonstration of something using a WHERE clause in a SELECT. I believe you can figure it out from there if you are proactive enough to be doing your own db mait.

LUA:
    -- Rook system
useRookSystem = false
rookTownId = 1 
rookLevelToGetRooked = 5 
rookLevelToLeaveRook = 8

I dunno what your config looks like, but these are the default settings in my fork.
That string matches up to ROOK_LEVELTO which player.cpp uses.
 
so as I mentioned my tfs doesn't suport rook system in config. I don't have it there and also I tried just to paste rook system to config but also does not work. I still dont understand how can I specify character ID or Name so the script will focus the player who died and not all characters in database.
what should I put to WHERE name = (???)

" .. db.escapeString(getPlayerName(cid)) .. " - doesn't work.
also tried - getPlayerName(cid) - also doesnt work.

can you just edit my script so it will focus only character who died and not all of them? or explain a bit more.

how this should look like?
LUA:
db.query("UPDATE players SET level = 1, maglevel = 0, experience = 0, health = 150, healthmax = 150, mana = 0, manamax = 0, conditions = NULL, soul = 100, cap = 400, posx = 0, posy = 0, posz = 0, town_id = 2, lastlogin = 0, lastip = 0, skull = 0, skulltime = 0, rank_id = 0, blessings = 0")
(note: this is what I already got in my creaturescript script, but its reseting all players levels etc)

I will be very thankful. :3
Post automatically merged:

guys cmon. I know there is a lot of people knowing how to do it and no one will share the knowledge here?
I'm not asking for ready script, not asking for your work for free. Just asking for a bit of knowledge.
Post automatically merged:

how to make use of it in sql query?
getPlayerGUID(cid)
 
Last edited:
if your engine doesn't support it, upgrade to a better 0.3.7 era engine?

"doesn't" work isn't very helpful feedback. Why? What's the error? What function that should be there is missing?

if you are using this as a second login-type script, those function calls should work just fine
 
Back
Top