• 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!

Lua 0.3.6 script/functions not working correctly

Michael Orsino

Premium User
Staff member
Premium User
Support Team
Joined
Nov 15, 2007
Messages
864
Solutions
10
Reaction score
452
Location
Western Australia
Hello, I am having some trouble with my script that gives players vocation appropriate skills on their first log-in.
For example, instead of a paladin getting 60 distance - he will only get 11 or 13.
Mages also have a similar problem, instead of getting mlvl 60 as the script would suggest, they are only getting mlvl 13 or so.
doplayereaddmaglevel works fine for knights though.
Oh yeah, and the results seem to vary from computer to computer.

LUA:
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local skillStor = 56364
local gotSkills = getPlayerStorageValue(cid, 56364)

if playerVoc == 5 and gotSkills == -1 then				--SORCERER
doPlayerAddMagLevel(cid, 60)							--MLVL
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 6 and gotSkills == -1 then				--DRUID
doPlayerAddMagLevel(cid, 60)							--MLVL	
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 7 and gotSkills == -1 then 				--PALADIN
doPlayerAddSkill(cid, 4, 60-getPlayerSkillLevel(cid, 4), true)			--DISTANCE
doPlayerAddSkill(cid, 5, 60-getPlayerSkillLevel(cid, 5), true)			--SHIELD
doPlayerAddMagLevel(cid, 20)							--MLVL
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 8 and gotSkills == -1 then				--KNIGHT
doPlayerAddSkill(cid, 1, 60-getPlayerSkillLevel(cid, 1), false)          	--CLUB
doPlayerAddSkill(cid, 2, 60-getPlayerSkillLevel(cid, 2), true)			--SWORD	
doPlayerAddSkill(cid, 3, 60-getPlayerSkillLevel(cid, 3), true)			--AXE
doPlayerAddSkill(cid, 5, 60-getPlayerSkillLevel(cid, 5), true)			--SHIELD
doPlayerAddMagLevel(cid, 8)							--MLVL
setPlayerStorageValue(cid, skillStor, 1)

end
return TRUE
end

furthermore, I have re-written the script using doplayeraddskilltries and doplayeraddspentmana however the results of this also vary from computer to computer though it works better than doplayeraddskill.

As I cannot get this script to work without using doplayeraddskilltries (which is very resource intensive and not worth using in this situation) I am looking for someone to write some c++ in iologindata.cpp for me to achieve this with the account manager at creation of character stage (instead of receiving 10 in each skill, receive vocation appropriate skills configurable in a specified file - e.g. war_config.lua)
I am offering a reward for the lua script to be fixed, or the programming to be done.

Thanks for your help,
Michael

EDIT: I threw in the false on knights club fighting just to try it myself as trial&error. It did not change the outcome.
 
Last edited:
Back
Top