• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS Starting Health and Mana

Arn

Member
Joined
Mar 8, 2010
Messages
282
Reaction score
18
Hello and thank you for reading,

I'm trying to figure out how to set the starting health and mana for new players, and no matter what I try, it won't work. I tried this:

firstitems.lua

Code:
if getPlayerStorageValue(cid, 30001) == -1 then

setCreatureMaxMana(cid, 100)


The only thing that happens, is the player isn't allowed to log in, and my server generates an error.

Code:
data/creaturescripts/scripts/firstitems.lua:onLogin
[18/06/2012 18:00:55] data/creaturescripts/scripts/firstitems.lua:10: attempt to call global 'setCreatureMaxMana' (a nil value)
[18/06/2012 18:00:55] stack traceback:
[18/06/2012 18:00:55] 	[C]: in function 'setCreatureMaxMana'
[18/06/2012 18:00:55] 	data/creaturescripts/scripts/firstitems.lua:10: in function <data/creaturescripts/scripts/firstitems.lua:7>

There has to be a simpler, easier way to do this. Maybe, I'm missing a tag in vocations.xml or something.

Please help, thank you!

-Arn
 
Last edited:
you want to edit start hp and start mana?

go in database / edit samples.

Which database? I use mysql and have sqlite disabled. I've looked through my mysql database extensively, and have not found anything called samples. Can you be more specific please?
 
localhost/phpmyadmin

I asked you to be more specific. Instead, you give me the address to what my browser displays, thats stored on my computer. I'm fully aware of phpmyadmin. I don't need that. What I need is, the exact location where these "samples" are stored. In a last effort, to gain the knoweledge I'm seeking, I'm posting a screenshot of my database structure. If you see where samples might be stored, please show me.

BE MORE SPECIFIC.

2cxeywo.png
 
Try doPlayerSetMaxMana or doCreatureSetMaxMana. It's better to use doPlayerAddLevel instead if you're trying to set max health/mana of starting level as doPlayerAddLevel calculates these stuff. NB: samples are located in `accounts` table but in the screenshot it doesn't look like you're using a website. What TFS version are you using?
 
Try doPlayerSetMaxMana or doCreatureSetMaxMana. It's better to use doPlayerAddLevel instead if you're trying to set max health/mana of starting level as doPlayerAddLevel calculates these stuff. NB: samples are located in `accounts` table but in the screenshot it doesn't look like you're using a website. What TFS version are you using?

Both of those functions generate the same error.

I'm using this version.

http://otland.net/f18/9-46-forgotten-server-v0-2-12-mystic-spirit-155313/
 
There's no Lua function in 0.2 to set creature max mana/health as far as I see from reading luascript.cpp, you have 2 options:
1. Use 0.3.7 (Not recommended since it's still under development but it's featurefull)
2. Make the function in C++ yourself, if you don't don't know how to, try looking at the luascript.cpp and see how the other functions are made. If you failed to do so, post what you've what done, and we'll try to help you.

EDIT: This should be moved to support.
 
here is script im using:

LUA:
local storage = 32948 --firsy login storage (spirit outfit)

function onLogin(cid)
	if(getPlayerGroupId(cid)<3)and(getPlayerStorageValue(cid, storage) == -1)and(getPlayerLevel(cid) == 1)and(getCreatureName(cid) ~= ("Account Manager")) then
		
		local outfit = getCreatureOutfit(cid)
			outfit.lookType = 319 -- Here put the outfit id		
		doCreatureChangeOutfit(cid, outfit)
		doPlayerSetVocation(cid,40)
		setPlayerStorageValue(cid, storage, 1)
		setCreatureMaxHealth(cid, 10)
		doCreatureAddHealth(cid, -140)
	end
return true
end

add it to ur creaturescripts.xml
LUA:
	<event type="login" name="FirstLogin" script="firstlogin.lua"/>


anyway, still maths wins
 
Last edited:
Back
Top