Lua how to make script which check player level?

gritness

New Member
Joined
May 26, 2021
Messages
16
Reaction score
2
Hey,
Im looking for functions, which check player level, need to set storage if player gain 25lvl. Someone can help me ? :)
 
Solution
When player reach level 25 (its for update questlog for claim reward on 25lvl)
TFS 1.3
Lua:
- we need a storage to stop doing the same script each time player advance in level
local storage = 50323
if player:getLevel() >= 25 and player:getStorageValue(storage) <= 0 then
player:setStorageValue(50323, 1)
--You can add here what-ever you need even your other storage for quest ending
end

Pox

Well-Known Member
Joined
Apr 28, 2020
Messages
126
Solutions
7
Reaction score
88
Hey,
Im looking for functions, which check player level, need to set storage if player gain 25lvl. Someone can help me ? :)

When player reach level 25 or everytime a player advance 25levels? Eg 25, 50, 75, 100 etc.

And... TFS1.3 or what you using?
 

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
902
Solutions
29
Reaction score
332
what do you mean with gain 25 levels? and do you mean every 25 levels set storage? its too simple player:getLevel(), player:setStorageValue(Key, Value)

 
OP
gritness

gritness

New Member
Joined
May 26, 2021
Messages
16
Reaction score
2
When player reach level 25 or everytime a player advance 25levels? Eg 25, 50, 75, 100 etc.

And... TFS1.3 or what you using?
When player reach level 25 (its for update questlog for claim reward on 25lvl)
TFS 1.3
 

Shadow_

Veteran OT User
Joined
Jun 2, 2018
Messages
902
Solutions
29
Reaction score
332
When player reach level 25 (its for update questlog for claim reward on 25lvl)
TFS 1.3
Lua:
- we need a storage to stop doing the same script each time player advance in level
local storage = 50323
if player:getLevel() >= 25 and player:getStorageValue(storage) <= 0 then
player:setStorageValue(50323, 1)
--You can add here what-ever you need even your other storage for quest ending
end
 
Solution
OP
gritness

gritness

New Member
Joined
May 26, 2021
Messages
16
Reaction score
2
Lua:
- we need a storage to stop doing the same script each time player advance in level
local storage = 50323
if player:getLevel() >= 25 and player:getStorageValue(storage) <= 0 then
player:setStorageValue(50323, 1)
--You can add here what-ever you need even your other storage for quest ending
end
Thanks a lot. But i have 1 more question to it. where i have to put this script actions/events? (need to check players level everytime to 25lvl)
Post automatically merged:

or easier check player level on level up (but how :D ?)
 
Last edited:
OP
gritness

gritness

New Member
Joined
May 26, 2021
Messages
16
Reaction score
2
Creaturescripts, function onAdvance(player, skill, oldLevel, newLevel)
Thanks, that should be enough. You are awesome
Post automatically merged:

Got 1 more problem ( I think the last one in this thema )

I did script which work perfectly, but still have problem with run script automatically.
Now idk whats type of event and name i have to write in creaturescripts.xml

<event type="" name="" script ="new/questlog25update.lua" />
 
Last edited:
Top