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

TFS 0.4 remove level till 20 item

Noxshakx

New Member
Joined
Jun 30, 2017
Messages
7
Reaction score
0
Hello guys I would like a script (action id function onuse)
that removes a level until you are level 20 at any given level, for example you are level 150 use the item then you go back to level 20 but now you have the same health and mana as level 20 thanks in advance!
 
Solution
You can put this into any script, really.
As the player de-levels, from the removal of experience, their health/mana/capacity will all change, based on their current vocation.
Lua:
if getPlayerExperience(cid) > 98800 then
   local experience = getPlayerExperience(cid) - 98800
   doPlayerAddExperience(cid, -experience)
end

If you wanted someone to change vocation as well as de-level to level 20, you could do something like this.
Lua:
if getPlayerExperience(cid) > 98800 then
   local vocation = 2
   experience = getPlayerExperience(cid)
   doPlayerAddExperience(cid, -experience)
   doPlayerSetVocation(cid, vocation)
   doPlayerAddExperience(cid, 98800)
   doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid)...
You can put this into any script, really.
As the player de-levels, from the removal of experience, their health/mana/capacity will all change, based on their current vocation.
Lua:
if getPlayerExperience(cid) > 98800 then
   local experience = getPlayerExperience(cid) - 98800
   doPlayerAddExperience(cid, -experience)
end

If you wanted someone to change vocation as well as de-level to level 20, you could do something like this.
Lua:
if getPlayerExperience(cid) > 98800 then
   local vocation = 2
   experience = getPlayerExperience(cid)
   doPlayerAddExperience(cid, -experience)
   doPlayerSetVocation(cid, vocation)
   doPlayerAddExperience(cid, 98800)
   doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid) .."!", TALKTYPE_ORANGE_1, cid)
   doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
end

note: I haven't tested any of the above, but it should work.
 
Solution
Since we are on the vocation topic would making like a gui similar to a character list but instead saying the 4 vocations to pick from and going back to lvl 20?
 
Since we are on the vocation topic would making like a gui similar to a character list but instead saying the 4 vocations to pick from and going back to lvl 20?
In 0.4, we don't have the option for interactable gui's.
The best you could do, is an npc who only sells 4 items in the trade window.
You might be able to alter the trade window to have additional functionality, such as working with storage values or something.
But honestly I haven't worked with the trade window at all, so without playing around with it, I have no idea.
 
You can put this into any script, really.
As the player de-levels, from the removal of experience, their health/mana/capacity will all change, based on their current vocation.
Lua:
if getPlayerExperience(cid) > 98800 then
   local experience = getPlayerExperience(cid) - 98800
   doPlayerAddExperience(cid, -experience)
end

If you wanted someone to change vocation as well as de-level to level 20, you could do something like this.
Lua:
if getPlayerExperience(cid) > 98800 then
   local vocation = 2
   experience = getPlayerExperience(cid)
   doPlayerAddExperience(cid, -experience)
   doPlayerSetVocation(cid, vocation)
   doPlayerAddExperience(cid, 98800)
   doCreatureSay(cid, "Vocation changed! You are now a ".. getPlayerVocationName(cid) .."!", TALKTYPE_ORANGE_1, cid)
   doSendMagicEffect(getThingPos(cid), CONST_ME_GIFT_WRAPS)
end

note: I haven't tested any of the above, but it should work.
Just one bug tho, if you do a unique id for all 4 vocations and then try all 4 at once you will get stuck and cant move or anything, but the way to fix it is to use a vocation then die,repeat to test thanks btw :D
 
Back
Top