EnforcedRPG
Nubwarz.no-ip.org
- Joined
- Nov 29, 2012
- Messages
- 39
- Reaction score
- 2
Heya everyone, I finally got my "Skill Reset" script working but it causes crazy lag when a new character is created and logged in (or whenever someone logs in with 10~ skills or 0~ magic level)
Here's the script:
I'm guessing it has something to do with the sources, not with the script but I have no idea :/
Thank you for any help!![Big Grin :D :D](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
------------------------------- Edit --------------------------------
The lag does not occur if the skills are close to what they are going to be reset to.. For example:
A knight has 73 sword fighting when they log in, it'll advance to 75 on login. It won't cause lag since it's only adding 2 skills but is there any way how to make it not cause any lag?
Here's the script:
Lua:
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local samount = 75 - (getPlayerSkillLevel(cid, 2))
local aamount = 75 - (getPlayerSkillLevel(cid, 3))
local camount = 75 - (getPlayerSkillLevel(cid, 1))
local damount = 80 - (getPlayerSkillLevel(cid, 4))
local shieldp = 70 - (getPlayerSkillLevel(cid, 5))
local shieldk = 75 - (getPlayerSkillLevel(cid, 5))
local shieldm = 20 - (getPlayerSkillLevel(cid, 5))
local magicm = 60 - (getPlayerMagLevel(cid))
local magicp = 15 - (getPlayerMagLevel(cid))
local magick = 6 - (getPlayerMagLevel(cid))
if playerVoc == 1 then
doPlayerAddSkill(cid, 5, shieldm)
doPlayerAddMagLevel(cid, magicm)
end
if playerVoc == 2 then
doPlayerAddSkill(cid, 5, shieldm)
doPlayerAddMagLevel(cid, magicm)
end
if playerVoc == 3 then
doPlayerAddSkill(cid, 4, damount)
doPlayerAddSkill(cid, 5, shieldp)
doPlayerAddMagLevel(cid, magicp)
end
if playerVoc == 4 then
doPlayerAddSkill(cid, 2, samount)
doPlayerAddSkill(cid, 1, camount)
doPlayerAddSkill(cid, 3, aamount)
doPlayerAddSkill(cid, 5, shieldk)
doPlayerAddMagLevel(cid, magick)
end
return TRUE
end
I'm guessing it has something to do with the sources, not with the script but I have no idea :/
Thank you for any help!
------------------------------- Edit --------------------------------
The lag does not occur if the skills are close to what they are going to be reset to.. For example:
A knight has 73 sword fighting when they log in, it'll advance to 75 on login. It won't cause lag since it's only adding 2 skills but is there any way how to make it not cause any lag?
Last edited: