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

[NPC] Skill Master

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Reaction score
38
Location
Sweden
Hello Otland!

This is a Skill Master NPC. It gives you rewards depending on what skill level you are. It's very configurable and filled with features.

Rewards Supported:
  • Items
  • Outfits
  • Money
  • Reputation (Based on storage ids)

If you wish to see more features in this NPC, just post your suggestions here.

Lua:
local config = {
	skills = {
		["fist"] = {id = 0, storage = 23001, name = "Fist Fighting",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {{6500, 20}, {5806, 1}},
					outfits = {32, 30},
					money = 1000,
					reputation = 5
				},
				{
					requirements = {storageid = 2, skill_level = 20},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["club"] = {id = 1, storage = 23002, name = "Club Fighting",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["sword"] = {id = 2, storage = 23003, name = "Sword Fighting",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["axe"] = {id = 3, storage = 23004, name = "Axe Fighting",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["distance"] = {id = 4, storage = 23005, name = "Distance Fighting",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["shielding"] = {id = 5, storage = 23006, name = "Shielding",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["fishing"] = {id = 6, storage = 23007, name = "Fishing",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["magic"] = {id = 7, storage = 23008, name = "Magic Level",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		},
		["level"] = {id = 8, storage = 23009, name = "Level",
			rewards = {
				{
					requirements = {storageid = 1, skill_level = 10},
					items = {},
					outfits = {},
					money = 0,
					reputation = 0
				}
			}
		}
	},
	
	main = {
		reputation_storage = 30000,
		rewardEffect = 40
	}
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 		npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 							npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
	if (not npcHandler:isFocused(cid)) then
		return false
	end
	
	local message = msg
	local rewardGiven = false
	
	if config.skills[message] then
		local skl = config.skills[message]
		local p_skl = getPlayerSkillLevel(cid, skl.id)
		local r_skl = skl.rewards
		
		for _, reward in ipairs(r_skl) do
			if getPlayerStorageValue(cid, skl.storage) < reward.requirements.storageid then
				if p_skl >= reward.requirements.skill_level then
					-- Items
					if reward.items[1] then
						for _, item in ipairs(reward.items) do
							doPlayerAddItem(cid, item[1], item[2])
						end
					end
					
					-- outfits
					if reward.outfits[1] then
						for i = 1, #reward.outfits do
							doPlayerAddOutfit(cid, reward.outfits[i], 0)
						end
					end
					
					-- Money
					doPlayerAddMoney(cid, reward.money)
					
					-- Reputation
					local currentRep = getPlayerStorageValue(cid, config.main.reputation_storage)
					if currentRep == -1 then
						doPlayerSetStorageValue(cid, config.main.reputation_storage, 0)
					end
					doPlayerSetStorageValue(cid, config.main.reputation_storage, currentRep + reward.reputation)
					
					-- Reward Storage Id.
					doPlayerSetStorageValue(cid, skl.storage, reward.requirements.storageid)
					doSendMagicEffect(getPlayerPosition(cid), config.main.rewardEffect)
					rewardGiven = true
				else
					break
				end
			end
		end
		if rewardGiven then
			npcHandler:say("Congratulations!", cid)
		else
			npcHandler:say("You are not experienced enough to get any rewards for ".. skl.name:lower()..".", cid)
		end
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Download: UploadHyper (For including TABs and more comfortable scripting)

Have fun! :D
 
Last edited:
Okay lets see. (please read)

What about if a new server start and the owner wants to give a reward to the first lvl 100, first skills 100(shield/axe/sword/club/fishing/distance/magic)¡automatic!?

Example:
First level 100 = xxxx(itemid-reward) with Description: This item was given to (playername) for been the first level 100 on the server.

First shielding 100 = xxxx(itemid-reward) with Decription: This item was given to (playername) for been the first player with 100 on shielding.

First axe 100 = xxxx(itemid-reward) with Decription: This item was given to (playername) for been the first player 100 on axe.

And so on..

Also if possible broadcast "(playername) has been the first player to reach level 100 on the server. And for this reason has been rewarded with (itemname)."

> and also broadcast for first players with skills 100 "(playername) has been the first player to reach level 100 on shielding on the server. And for this reason has been rewarded with (itemname)."

Idk if its possible but hope this script get realese. ;)
 
Last edited:
- I need a script that takes away your frags and redskull when you click in a hole (for example) and costing you a particular item

- I need the antibann. That when you go to people for killing ban, ban you, but as you carry that item, that item will be taken away (ring) and you get to play again without redskull frags or without the ring.
That is, you have killed 8 people in a row and you draw the game, but if you have the ring, get a little message in the game (saved!) And can play again without frags without redskull and without ring

- I want to know how to put a unique manarune to be purchased for a particular item is not spent

- I want to know how you can do, that you buy something in a hole, and give you more capacity.
I mean, you click on a hole, you remove an item and give you xxx cap

-I need a npc that sells 1 AOL to Xccs. That also can sell bless saying blessings (all bless) for Xccs
Hi, amulet of loss, yes
Hi, blessings, yes


Thx in advance!!
 
- I need a script that takes away your frags and redskull when you click in a hole (for example) and costing you a particular item

- I need the antibann. That when you go to people for killing ban, ban you, but as you carry that item, that item will be taken away (ring) and you get to play again without redskull frags or without the ring.
That is, you have killed 8 people in a row and you draw the game, but if you have the ring, get a little message in the game (saved!) And can play again without frags without redskull and without ring

- I want to know how to put a unique manarune to be purchased for a particular item is not spent

- I want to know how you can do, that you buy something in a hole, and give you more capacity.
I mean, you click on a hole, you remove an item and give you xxx cap

-I need a npc that sells 1 AOL to Xccs. That also can sell bless saying blessings (all bless) for Xccs
Hi, amulet of loss, yes
Hi, blessings, yes


Thx in advance!!

Choose one of them.
 
Well, if you want to script "ANYTHING" I need my house system scripted, but I am sure it requires a bit more than just lua.
http://otland.net/f132/request-key-operated-housing-system-60710/

But, just for an lua script, it would be very nice if you could script me an NPC, that would be a "Skill master" npc, which, would give you a reward (be it exp reward, money, an item, added reputation, an addon, or a creature outfit (using !change Orc Warlord command, and it saving that monster outfit on your character), or a combination of all the above.) based on your skills, be it magic, melee skill, or fishing. BUT the Skill Master NPC would also check your vocation, and give out rewards for your skills based on what vocation you are.

Here is an example of what I want the npc to do.

Sword Master NPC

For Knights, he would give rewards for skill gains in sword by intervals of 10, such as the following.

Swording 20 --> 100gp
Swording 30 --> 1k gp
Swording 40 --> 3k gp and firesword
Swording 50 --> 3k gp, bright sword, +20 reputation
Swording 60 --> 4k gp, BP of sword rings(20), +20 reputation
Swording 70 --> 5k gp, Epee, +20 reputation, 1st warrior addon
Swording 80 --> 6k gp, Pharaoh Sword, +20 reputation, 2nd warrior addon
Swording 90 --> 7k gp, Relic Sword, +20 reputation, Orc Warrior Outfit
Swording 100--> 10k gp, BP of Ice Rapiers(20), +20 reputation, and Orc Warlord outfit

That would be the array for the knight getting quests rewards off of the Sword Master NPC.

But for a druid, or sorc talking to Sword Master, the array would be different, based on how a druid/sorc skills up in swording, and the rewards would be different.

Swording 20--> 100gp
Swording 25--> 5k, 10 medium mana potions, +5 reputation
Swording 28--> 5k, BP of medium mana potions, +20 rep
Swording 30--> 5k, first warrior addon, +20 rep
Swording 32--> 5k second warrior addon, +20 rep
Swording 34--> 6k, 2bps of medium mana potions, +20 rep
Swording 36--> 7k, 2bps of medium mana potions, +20 rep
Swording 38--> 8k, Orc Warrior Outfit, +20 rep
Swording 40--> 10k Orc Warlord Outfit, +20 rep

As you can see, for the druids/sorcs, the requirements for rewards is lowered, based on their skill up speed, and the rewards are more suited towards a mage, putting time in an uncanny skill for a mage.

The array for a paladin would be similar to that of a knight, but again, top rewards for a paladin would require lower skills, but based on time it would take to get that much skill.

Swording 20 --> 100gp
Swording 30 --> 1k gp
Swording 40 --> 3k gp and firesword
Swording 45 --> 3k gp, bright sword, +20 reputation
Swording 50 --> 4k gp, BP medium health potions(20), +20 reputation
Swording 55 --> 5k gp, Epee, +20 reputation, 1st warrior addon
Swording 60 --> 6k gp, Pharaoh Sword, +20 reputation, 2nd warrior addon
Swording 65 --> 7k gp, Relic Sword, +20 reputation, Orc Warrior Outfit
Swording 70--> 10k gp, BP of Ice Rapiers(20), +20 reputation, and Orc Warlord outfit

I didn't change the array of rewards for a paladin, as I am getting tired of typing at the moment, but I think you are getting the point.


After the first npc, it would be easy to make "copy" scripts for other skill masters such as Axe Master, Club Master, Shield Master, Fist Master, Fishing Master, Distance Master, and Magic master. Just with different rewards, and skills required by vocation, based on difficulty of skilling up on certain skill.
 
I need a script that when a player walk in X floor, changes the outfit colors of player and tp him to a position.

And if the amount of players online is uneven go to a Y position with a Y color outfit, if amount of players online is pair go to a X position with a X color outfit.

Like an auto-balance system

Really need this for my enf, please
 
http://otland.net/f132/npc-selling-random-item-61388/ please? hope it is possible, actually I need only example how to make it

I don't know if this works, but you can try:

Add this to your npc script:
Lua:
if msgcontains(msg, 'trade') then
	local items =
	{
		{id = FIRST_RUSTYARMOR_ID, subType = 0, sell = PRICE, name = 'rusty armor'},
		{id = SECOND_RUSTYARMOR_ID, subType = 0, sell = PRICE, name = 'rusty armor'},
		{id = THIRD_RUSTYARMOR_ID, subType = 0, sell = PRICE, name = 'rusty armor'}
	}

	local rustyRandom = math.random(table.maxn(items))
	openShopWindow(cid, items[rustyRandom], onBuy, onSell)
	selfSay('Here is my offert, do you like it?', cid)
end
 
okei.. I HAVE ONE :D
a tile (with actionid) summon a monster each 60 seg (example) and if it is blocked, the tile can't summon a monster, and of course, the tile have max summon monster :).. it's used for inquisition rl.. (dreadbeast, the last room.. etc)
is not so hard.. but i don't find any in any forum :B .. and i will like have that in me server xd
 
Ok:

I want to FLY like and eagle... you know, teleport the player to the floor 0 and then he can walk to anywhere where there is NO ground/walls :O! you can do that? XD
 
Guys, this thread is only made for script suggestions, nothing else. If you want to release a script, do it somewhere else.

Thank you.
 
- I need a script that takes away your frags and redskull when you click in a hole (for example) and costing you a particular item or a premium points of your account

Thx!
 
Last edited:
is it possible to add something to the spell scripts that does a different mana cost depending on your level? example in spells.xml you set the manacost to 0 but in the mana script you put

from level 1-10 manacost is 100 mana
from level 11-20 mana cost is 150 mana

see i tried doing percent but it doesnt work that well for my server because a level 100 would than be using exura for like 1k mana (only example not real values) and it would be cool if i add this custom to all my spell scripts i just dont know the function or whatever the code i need to put in for each one

i was wondering is it possible?
 
Back
Top