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

Bed offilne trainer in 8.6

wesleyt10

Well-Known Member
Joined
Dec 15, 2012
Messages
73
Reaction score
71
hello guys I was looking for the bed training system, and I didn't find it, and I touched the sources I own and I found the bed training (part of the system) because my otx has remnants of the system, even though 8.6 it is a 9.7 - 9.6 - degrownd I think it works exactly like the last updated distribution in github's otx 8.6. so if someone who understands C ++ can help me and help with the part of the code that can be adapted for the beds, I would be very grateful!
 
Solution
Maybe something like this (You can edit or change ids/skill by yourself), As long as I know its not possible to make modal window in 8.6 but maybe someone else will be able to help you doing it.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local beds = {1754,1755,1756,1757,1758,1759,1760,1761,7815,7816,7817,1765,7787,7788,7789,7790,7791,7792,7811,7812,7813,7814}
local knight = {4, 8}
local pally = {3, 7}
local mage = {1, 2, 5, 6}

if(isInArray(beds, itemEx.itemid)) and isInArray(knight, getPlayerVocation(cid)) == TRUE then -- sword
doCreatureSetStorage(cid, 62669, SKILL_SWORD)
elseif(isInArray(beds, itemEx.itemid)) and isInArray(mage, getPlayerVocation(cid)) == TRUE then -- mlvl
doCreatureSetStorage(cid, 62669...
You should have it in data\actions\actions.xml then you add one more line with ids of the beds.
XML:
<action itemid="you bedid" event="script" value="offlinetraining.lua"/>
and inside the script itself data\actions\offlinetraining.lua you should add the bed id and the skill storage you want.
Lua:
   elseif(item.itemid == your bedid) then
     doCreatureSetStorage(cid, your offline training storage, SKILL_AXE)
 
THANK YOU ! HOWEVER, IT'S A QUESTION. WILL THIS ALLOW ME TO CHOOSE SKILL BY CLICKING THE BED?
AND THE VALUE CAN BE ANYONE? IN STORAGE?

i have make this edit :
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == your 1754) then
doCreatureSetStorage(cid, 780001, SKILL_AXE)
elseif(item.itemid == your 1754) then
doCreatureSetStorage(cid, 780001, SKILL_SWORD)
elseif(item.itemid == your 1754) then
doCreatureSetStorage(cid, 780001, SKILL_MAGLEVEL)
elseif(item.itemid == your 1754) then
doCreatureSetStorage(cid, 780001, SKILL_CLUB)
elseif(item.itemid == your 1754) then
doCreatureSetStorage(cid, 780001, SKILL_DITANCE)
end
if item.actionid == 1754 then
doRemoveCreature(cid)
end
return true
end

BUT I NEED NEED WINDOW TO CHOOSE THE SKILL !

AND I DON'T KNOW HOW TO CREATE THIS PART
 
Last edited:
No it can't be in any storage that depends on your offline training script and yes you can choose what skills it will give depending on each vocation by this function
Lua:
if (getPlayerVocation(cid) == vocationnumberhere)
 
okay, are you telling me to make the script recognize the vocation and then he select the skill id alone? before checking the van id and then selecting the skill? - my server does not have a script for offline trainer, I made it from 0 from the base folder of otx. so it is clean, it has only the systems that I have already installed. I have no idea how to edit beyond that I already did!
 
Can you post your offline training script? or if you don't know where is it link me to which server are you using.
 
my server dont have script for offline trainer, i have look my sources cod , and i check the codes and remnants of the system has implanted , this codes has register the functions base, but, i dont know make the sistem based on this codes, i can send pm to you , for u help me ok?
 
I will help here so others can benefit also, just try adding any of those scripts with the the playevocation function I posted above then if you got any errors/issues post it here and I will try to help you.
 
I appreciate your help, but for example these systems put different statues for training, I would like to put it that way in beds, you click to sleep and it appears the window to choose which skill you want to train.
Post automatically merged:

Now I added a The
Action - TFS 0.4 Offline Training (https://otland.net/threads/tfs-0-4-offline-training.232165/)

the script of actions here =
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1444) then -- sword
doCreatureSetStorage(cid, 62669, SKILL_SWORD)
elseif(item.itemid == 10349) then -- axe
doCreatureSetStorage(cid, 62669, SKILL_AXE)
elseif(item.itemid == 8834) then -- mlvl
doCreatureSetStorage(cid, 62669, SKILL__MAGLEVEL)
elseif(item.itemid == 8626) then -- club
doCreatureSetStorage(cid, 62669, SKILL_CLUB)
elseif(item.itemid == 10353) then -- distannce
doCreatureSetStorage(cid, 62669, SKILL_DISTANCE)
end
if item.actionid == 1000 then
doRemoveCreature(cid)
end
return true
end

I Dont Know where Add this line

if (getPlayerVocation(cid) == vocationnumberhere)

this =

function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1754) then -- sword
elseif(getPlayerVocation(cid) == 4)
doCreatureSetStorage(cid, 62669, SKILL_SWORD)
end
if(item.itemid == 1754) then -- axe
elseif(getPlayerVocation(cid) == 4)
doCreatureSetStorage(cid, 62669, SKILL_AXE)
end
if(item.itemid == 1754) then -- mlvl
elseif (getPlayerVocation(cid) == 1)
doCreatureSetStorage(cid, 62669, SKILL__MAGLEVEL)
end
if(item.itemid == 1754) then -- mlvl
elseif (getPlayerVocation(cid) == 2)
doCreatureSetStorage(cid, 62669, SKILL__MAGLEVEL)
end
if(item.itemid == 1754) then -- club
elseif(getPlayerVocation(cid) == 4)
doCreatureSetStorage(cid, 62669, SKILL_CLUB)
if(item.itemid == 1754) then -- distannce
elseif(getPlayerVocation(cid) == 3)
doCreatureSetStorage(cid, 62669, SKILL_DISTANCE)

end
doRemoveCreature(cid)
end
return true
end

correct??
 
Last edited:
Window? You mean modal window then you choose between (axe,club,sword etc..)? That's not available in 8.6 client.
 
yes , is not possible in 8.6? but i look this in megatibia :S

but if it works with the beds, selecting only the vocation is already great
 
Maybe something like this (You can edit or change ids/skill by yourself), As long as I know its not possible to make modal window in 8.6 but maybe someone else will be able to help you doing it.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local beds = {1754,1755,1756,1757,1758,1759,1760,1761,7815,7816,7817,1765,7787,7788,7789,7790,7791,7792,7811,7812,7813,7814}
local knight = {4, 8}
local pally = {3, 7}
local mage = {1, 2, 5, 6}

if(isInArray(beds, itemEx.itemid)) and isInArray(knight, getPlayerVocation(cid)) == TRUE then -- sword
doCreatureSetStorage(cid, 62669, SKILL_SWORD)
elseif(isInArray(beds, itemEx.itemid)) and isInArray(mage, getPlayerVocation(cid)) == TRUE then -- mlvl
doCreatureSetStorage(cid, 62669, SKILL__MAGLEVEL)
elseif(isInArray(beds, itemEx.itemid)) and isInArray(pally, getPlayerVocation(cid)) == TRUE then -- distannce
doCreatureSetStorage(cid, 62669, SKILL_DISTANCE)
end
doRemoveCreature(cid)
return true
end
 
Solution
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1754) then -- sword
        doCreatureSetStorage(cid, 62669, SKILL_SWORD)
            elseif(getPlayerVocation(cid) == 4) then
    if(item.itemid == 1754) then -- axe
        elseif(getPlayerVocation(cid) == 4) then
        doCreatureSetStorage(cid, 62669, SKILL_AXE)
        end
    if(item.itemid == 1754) then -- mlvl
    elseif (getPlayerVocation(cid) == 1) then
    end
        doCreatureSetStorage(cid, 62669, SKILL__MAGLEVEL)
    if(item.itemid == 1754) then -- mlvl
    elseif (getPlayerVocation(cid) == 2) then
    end
        doCreatureSetStorage(cid, 62669, SKILL__MAGLEVEL)
    if(item.itemid == 1754) then -- club
        elseif(getPlayerVocation(cid) == 4)then
        end
        doCreatureSetStorage(cid, 62669, SKILL_CLUB)
    if(item.itemid == 1754) then -- distannce
    elseif(getPlayerVocation(cid) == 3) then
        doCreatureSetStorage(cid, 62669, SKILL_DISTANCE)          
end
  if item.actionid == 1000 then
    doRemoveCreature(cid)
end
end
    return true
    end

my script dont works :s

BUT YOUR SCRIPT WORKS
I FORGOT TO REGISTER MY IDS, SO MY DIDN'T WORK, BUT I WILL USE YOUR SAME, THANK YOU VERY MUCH, IT HAS ONE THING, IT DOES NOT APPEAR THE TIME MESSAGE THAT TRAINED AND HOW MUCH THE SKILL WAS CHANGED AND ETC ... I WANT TO SEARCH SOMETHING ABOUT. THANKS!!! YOU'RE BEST GUY
 
Last edited:
Back
Top