• 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:
can u make some script that give u double exp for x time like 1 hour and be a item like a scroll and when u use them give u the double exp por the hour
 
The part in elemental spheres where you throw the corpse of the monster and then it summons the boss, but before you have to put soils in a certain place so they'll transform in another item and stay there for a certain time ^^

sorry, kind of hard to explain :(
 
@thread
Do not do that man, you'll never be able to handle that much requests.
@up
Make it a currency on items.xml , then just modify the changegold script, c'mon you guys gotta learn lua.
If you keep requesting like I did, you'll get answers, but most of them were NOT tested and probably won't work. So I might be done with requesting.
 
Well im almost finished with ALL the spells in my WoW server thanks to alot of help here at otland.net however there is ONE last thing that i have made sure ive searched for EVERYWHERE just to make sure i dont get flamers...

I need a spell exahustion system that i can add to each spell...

now heres how i would like it too work....
in spells.xml i put every spell for example 1second exahust... that means that everytime i cast a spell i need to wait 1 second to cast ANY type of spell... but the exahust i will put on the spell will make the person exahusted from THAT spell ONLY for the amount of time i put it to. Im very new at scripting and i was thinking its probably gona need some storage or something if thats the case i dont mind putting a diff storage for each spell lol


/\ thats my thread i have i think its been requested alot and im sure theres ALOT of people that can use this for there servers so give it a shot! :D this can be used by everyone in a good way rather than just a spell or an npc that can only be used by 1 or 2 people :p no offense to anyone who requested a spell or npc :p anyways thanks!
 
I need a script that the guild leader uses to teleport to the guild where the leader is to wars etc ...
You can do this script for me?
 
@thread
Do not do that man, you'll never be able to handle that much requests.

Thats what I was thinking, but then I read his post correctly and realized he's only going to do 1 script, not all the requested ones..

@Topic:

Edit: nvm, while I was writing this request I realized I actually had the solution right there on the question lol
 
Hi :) Can you create some scripts for me... I made my server so people have to explore the map...and when they discovered a place I'd like them to be able to use teleports to get back there so...I want a script that when you step on a tile, you can pass trough a quest door(which will lead to my teleport) Thank You if u can!
 
god.. many good requests. but ok, i release my request anyways :)

When a player steps on a tile with a actionID(or uniqueID?) he becomes promoted with the blueshimmer effect. Also a text comes up and says "You have been promoted, in 10 seconds you will be teleport to the normal world.

As it says in the text, the player gets teleported in 10 seconds with the blushimmer effect to the teleported location :)

very simple, but yeah.
 
Can you make a phase system? When someone is level 300 he can change to level 1 again but is phase 2 and max phase is 3, and when is phase 3 the person will get like 500ccs

Is it possible to do? :)
 
Are you seriously going to make these scripts?...
If not I suggest closing this thread because you are getting peoples hopes up.
 
Are you seriously going to make these scripts?...
If not I suggest closing this thread because you are getting peoples hopes up.

@JDB
read plx! ;)

I'll only make one script, wish means that I'm going to choose very wisely between your suggestions. The script can be anything you want, and I'll choose the best and the most useful script idea I find in this thread.
 
Back
Top