Currently creating a war server, am trying to write a script that will give all players an appropriate magic level and skills for their vocation when they first log in, and not let it drop below this value. I am unsure of the syntax of the doplayeraddskill function. The script I have written does not work, but maybe it will help whoever can write it. I do not know what is wrong with the script, I am far from good at lua.
Script needs to work in CD0.3.5pl1 - my war server will be released to the public once I have completed it. It is not an especially advanced war server, but I (and the community who currently play it) believe it is good and fun.
Script needs to work in CD0.3.5pl1 - my war server will be released to the public once I have completed it. It is not an especially advanced war server, but I (and the community who currently play it) believe it is good and fun.
Code:
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local magLevel = getPlayerMagLevel(cid, true)
local playerDist = getPlayerSkillLevel(cid, distance)
local playerSword = getPlayerSkillLevel(cid, sword)
if playerVoc == 5 and magLevel < 50 then
doPlayerAddMagLevel(cid,50)
elseif playerVoc == 6 and magLevel < 50 then
doPlayerAddMagLevel(cid,50)
elseif playerVoc == 7 and magLevel < 15 and playerDist < 70 then
doPlayerAddSkill(cid, distance, 70)
doPlayerAddMagLevel(cid,15)
elseif playerVoc == 8 and magLevel < 8 and playerSword < 70 then
doPlayerAddSkill(cid, axe, 60)
doPlayerAddSkill(cid, sword, 60)
doPlayerAddSkill(cid, club, 60)
doPlayerAddSkill(cid, shielding, 60)
doPlayerAddMagLevel(cid,8)
end
return TRUE
end