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

About selling weapon skills. (Shop)

Bam

Active Member
Joined
Aug 11, 2007
Messages
1,442
Reaction score
39
Location
Sweden
Okay i've been searching around the forum to find any script as my title says. But with no fortune at all.


So i'm asking anybody whos reading this thread if you could link me to any thread or provide me with a script to make it able to buy training skills.

But what do I really mean by "buying skills"

Well basically you should be able to enter the shop and buy lets say 5hour training in sword fighting for the selected character.
And same goes with axe and club ofcourse.

I know that this is possible because i've seen people with it, and since it's basically just knowing the seconds of 5hours and double the value it'll give the right numbers for how long the character is standing and training.

Appreciate any help.
 
1 minute = 60s

eg
AttackSpeed = 2000ms = 2s

each attack gives you 1 skilltry(?)
by minute add 30 skilltryes

so... 30(skilltryes) * 60(minutes - 1 hour) = 1800(skilltryes) * 5(hours) = 9000(skilltryes)

when the player comes to the npc to buy 5 hours of distance skill training time(oO?) the npc gives to her +-9000(lag? with lag cost more time to get skills on trainers) skilltryes of distance skill Oo

I think that is it, but in not sure and I haven't tested it.
 
i got this idea:
1) make 4 new voc id with same vocation names but with diferent attack speed
2)you make a scroll that temporaly change your voc(the one with alot of atack speed and send you into a room with 1 training with alot of hp for "X" time and then when the time end you get teleported back to temple

The skilltries gained will depend of time and attack speed of your new vocation

example:in 20 attack speed you gain +- 100 skilltries per second

PD: you shold do like arena quest, if some one is already in the training, you need to wait to use scroll.
 
But what is it that you need? The whole npc script or help on it?

Im not good on NPCs, but I can make you this script as an "action", like you click on a lever and you purchase 5-hour skilltries using that formula ions said.

I think the only thing you need is this function:
doPlayerAddSkillTry(cid, skillid, n)

Where "n" = 'amount' * 1800
(using ions formula)

However I didnt quite understand the full idea of the script.

You want it to purchase the skilltries and then it would teleport the character somewhere for 5 hours or just purchase the skilltries? And would it be always 5 or you want it like "hi, 3, yes" "hi, whatevernumber, yes", etc?
 
Well... anyway, follow below a talkaction to do it:
in data/talkactions/talkactions.xml add

<talkaction words="!train" event="script" value="train.lua"/>

in data/talkactions/scripts copy any file, rename it to train.lua, open, delete all the contents and paste it:

local config = {
costPerHour = 500000, --// COST PER TRAINING HOUR
minLevel = 50, --// MIN LEVEL TO TRAIN
maxHours = 12, --// MAX HOURS ALOWED TO TRAIN AT ONE TIME
skillTryesPerHour = 1800, --// SKILLTRYES PER HOUR
teleportPlayers = no, --// IF YOU WANT TO SEND THE PLAYER TO ANY PLACE SET IT TO YES AND PUT THE POS BELOW
teleportToPos = 0,0,0 --// POSITION WHERE THE PLAYER WILL BE TELEPORTED TO WHEN HE GET TRAIN SKILL TIME
}

function onSay(cid, words, param, channel)
if(getPlayerLevel(cid) < config.minLevel) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot train skills on this level. Only players above level " .. config.minLevel .. " are alowed to train.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end

if(not param) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Type \"!train help\" to get help about this command.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
elseif(string.lower(param) == "help") then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can improve your skills fast using this command.\nYou can train the following skills:\nAxe, Club, Sword, Distance and Shielding.\nIt's simple to use, type:\n!train [skill], [hours]\ne.g.:\n!train sword, 5\nCost per training hour: " .. config.costPerHour .. " gold coins.")
return TRUE
end

local cmd = string.split(param, ", ")
local skill = cmd[1]
local time = cmd[2]
local skills = {
club,
sword,
axe,
distance,
shielding,
21,
22,
23,
24,
25
}

if(skill ~= "" and isInArray(skills, string.lower(skill))) then
if(time ~= "" and time <= config.maxHours) then
for i = 1, 5 do
if(string.lower(skill) == skills) then
if(doPlayerRemoveMoney(cid, config.costPerHour * time)) then
if(config.teleportPlayers == "yes") then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doTeleportThing(cid, config.teleportToPos, TRUE)
end
doPlayerAddSkillTry(cid, skills[i+5], config.skillTryesPerHour * time)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "OK! IT'S DONE! YOU MESSAGE HERE.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enough money. " .. time .. " training skill hour" .. (time == 1 and "" or "s") .. " cost " .. config.costPerHour * time .. ".")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
end
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must specify how much hours you wish to train.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must specify the skill that you wish to train.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return TRUE
end
return TRUE
end


i hope it be useful to you...
About the script, i made it myself and finished at 02:56am... if you get any error, post here.
 
Will this one give the player instant skilltryes? Cause thats what im searching for..

Something that gives the player instantly, lets say 5 hour skilling. That would give the player 9000skilltries instantly when using an item.
 
Will this one give the player instant skilltryes? Cause thats what im searching for..

Something that gives the player instantly, lets say 5 hour skilling. That would give the player 9000skilltries instantly when using an item.
Err, that's a talkaction. Do you want me to make the NPC version?
 
I just wanted a way to sell it by donations. But I made a script myself, click on item and get the skilltries. Thanks anyways Cykotitan..

But maybe you can explain for me why addPlayerSkillTry(cid, 3, 1800) doesn't give 1h training?

It gave from skill 10>20, and should be way more.
 
I just wanted a way to sell it by donations. But I made a script myself, click on item and get the skilltries. Thanks anyways Cykotitan..

But maybe you can explain for me why addPlayerSkillTry(cid, 3, 1800) doesn't give 1h training?

It gave from skill 10>20, and should be way more.

Remember to make the script take the SkillRate of your server from config, otherwise it will be 1x, so in 1x it is 10>20 in 1hour (I guess).

To do this you must add this:
PHP:
getConfigInfo('rateSkill')

To your script, like this:

PHP:
addPlayerSkillTry(cid, 3, 1800 * getConfigInfo('rateSkill'))

Try it, it should work. Otherwise I dont know what else could be!
 
Remember to make the script take the SkillRate of your server from config, otherwise it will be 1x, so in 1x it is 10>20 in 1hour (I guess).

To do this you must add this:
PHP:
getConfigInfo('rateSkill')

To your script, like this:

PHP:
addPlayerSkillTry(cid, 3, 1800 * getConfigInfo('rateSkill'))

Try it, it should work. Otherwise I dont know what else could be!
And where are the 5 hours on it?
 
And where are the 5 hours on it?

They arent there, because if you actually see my post and the quote in it, I was talking about the "1h script" mentioned by Bam on his previous post. I was just answering his question. To do it with 5 hours it is as simple as:

PHP:
addPlayerSkillTry(cid, 3, 1800 * 5 * getConfigInfo('rateSkill'))

But you probably know that already, so I dont understand why would you post that :confused:

It was simply an answer to Bam's doubt, basically the same thing as his script but just reminding him to take the server's skill rate into consideration thats all. I say this because I sense some "angryness" in your post and I cant understand why is that :confused:

Im only trying to help out, just like you and everyone else.
So chill :peace:
 
Last edited:
Back
Top