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

Request your npcs here!!

Status
Not open for further replies.

Mokerhamer

Retired Global Mod
Senator
Joined
Aug 6, 2007
Messages
1,767
Reaction score
36
What you cant request, ALready released npc's like addon npc and blesser, npc like that that are already can be founded in this forum.

Ofcourse the npc's that i make will get released on otland.net! ANd i only make npc's for The Forgotten Server!



========~~~~~~~How to request~~~~~~~========
What for npc:

What should the npc be able to do:

What advanced functions do u want:
 
Last edited:
Just a question, in the first post there said that it was going to be an addon npc here somewhere. Where? :p
/Tore
 
[REQUEST]

a npc who sell runes by change

example:
player: hi
npc: hi '..playername..', i sell .........~
player: 100 uh
npc: do you wanna buy 100 for COST ?
player: yes
npc: here is your rune

Npc selling GFB, UH, SD, HMM, ENERGY BOMB, FIRE BOMB, MAGIC WALL, DESTROY FIELD and PARALYZE
 
[REQUEST]

a npc who sell runes by change

example:
player: hi
npc: hi '..playername..', i sell .........~
player: 100 uh
npc: do you wanna buy 100 for COST ?
player: yes
npc: here is your rune

Npc selling GFB, UH, SD, HMM, ENERGY BOMB, FIRE BOMB, MAGIC WALL, DESTROY FIELD and PARALYZE

That isn't nice for an real rpg/pvp server :).

Edit sorry i thought this was the thread about the rune seller in world of tramon! :D:D!
 
[REQUEST]

a npc who sell runes by change

example:
player: hi
npc: hi '..playername..', i sell .........~
player: 100 uh
npc: do you wanna buy 100 for COST ?
player: yes
npc: here is your rune

Npc selling GFB, UH, SD, HMM, ENERGY BOMB, FIRE BOMB, MAGIC WALL, DESTROY FIELD and PARALYZE

Here you are but u need to edit the runes yourself

rune.xml
Code:
<npc name="Mike" script="data/npc/scripts/runes.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="130" head="39" body="122" legs="125" feet="57" corpse="2212"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to buy any spell runes?" />
		<parameter key="message_needmoremoney" value="You do not have enough money." />
		<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!" />
	</parameters>
</npc>

runes.lua

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



-- OTServ event handling functions start
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
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)


shopModule:addBuyableItem({'sudden death', 'sd'}, 			RUNEID, PRICE, CHARGES, 	'sudden death rune')



npcHandler:addModule(FocusModule:new())


here some Npc Examples

http://otland.net/showthread.php?t=1039
 
ERRR
i wanna a npc who sell runes by CHANGES:

if i request 77 uhs, the npc will gimme 77 uhs, if i request 22 uhs the npc will gimme a 33x uh...!

did you understand ?

for this npc needs use the GetCount function!
 
ERRR
i wanna a npc who sell runes by CHANGES:

if i request 77 uhs, the npc will gimme 77 uhs, if i request 22 uhs the npc will gimme a 33x uh...!

did you understand ?

for this npc needs use the GetCount function!

Hmm i need to make an new function for it but it wont be that hard :eek: i will make it when i'm out of school oke?


ihihi :p

With LuaSQL do I can add values in the database? or just get then? if i can add, so It would be possible to make that NPC

i never scripted on luaSql way so i'm an newbie :p but i gone learn it soon
 
ERRR
i wanna a npc who sell runes by CHANGES:

if i request 77 uhs, the npc will gimme 77 uhs, if i request 22 uhs the npc will gimme a 33x uh...!

did you understand ?

for this npc needs use the GetCount function!

no it dosen't need an get count functipn but an compleet new function:eek:

NOT TESTED but try this follow it exactly!

Modules.lua

Add
Code:
SHOPMODULE_BUY_CHARGES 	= 2

Under
Code:
SHOPMODULE_SELL_ITEM 	= 1


Add
Code:
	function ShopModule:addBuyableCharges(names, itemid, cost, charges, realname)
		for i, name in pairs(names) do
			local parameters = {
					itemid = itemid,
					cost = cost,
					eventType = SHOPMODULE_BUY_ITEM,
					module = self
				}
			if(realname ~= nil) then
				parameters.realname = realname
			end
			if(isItemRune(itemid) == TRUE or isItemFluidContainer(itemid) == TRUE) then
				parameters.charges = charges
			end
			keywords = {}
			table.insert(keywords, name)
			local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
			node:addChildKeywordNode(self.yesNode)
			node:addChildKeywordNode(self.noNode)
		end
	end

Above
Code:
	function ShopModule:addBuyableItem(names, itemid, cost, charges, realname)
		for i, name in pairs(names) do
			local parameters = {
					itemid = itemid,
					cost = cost,
					eventType = SHOPMODULE_BUY_ITEM,
					module = self
				}
			if(realname ~= nil) then
				parameters.realname = realname
			end
			if(isItemRune(itemid) == TRUE or isItemFluidContainer(itemid) == TRUE) then
				parameters.charges = charges
			end
			keywords = {}
			table.insert(keywords, name)
			local node = self.npcHandler.keywordHandler:addKeyword(keywords, ShopModule.tradeItem, parameters)
			node:addChildKeywordNode(self.yesNode)
			node:addChildKeywordNode(self.noNode)
		end
	end

Add
Code:
		elseif(parameters.eventType == SHOPMODULE_BUY_CHARGES) then
			tmpName = node:getKeywords()[1]

Under
Code:
		elseif(parameters.eventType == SHOPMODULE_BUY_ITEM) then
			tmpName = node:getKeywords()[1]

Add
Code:
		elseif(parentParameters.eventType == SHOPMODULE_BUY_CHARGES) then
			local ret = doPlayerBuyItem(cid, parentParameters.itemid, parentParameters.charges, parentParameters.cost*module.amount)
			if(ret == LUA_NO_ERROR) then
							if parentParameters.itemid == 2595 then
					doPlayerBuyItem(cid, 2599, parentParameters.amount, 0, 0)
				end
				local msg = module.npcHandler:getMessage(MESSAGE_ONBUY)
				msg = module.npcHandler:parseMessage(msg, parseInfo)
				selfSay(msg)
			else
				local msg = module.npcHandler:getMessage(MESSAGE_NEEDMOREMONEY)
				msg = module.npcHandler:parseMessage(msg, parseInfo)
				selfSay(msg)
			end

Above
Code:
		elseif(parentParameters.eventType == SHOPMODULE_BUY_ITEM) then
			local ret = doPlayerBuyItem(cid, parentParameters.itemid, parentParameters.charges, parentParameters.cost*module.amount)
			if(ret == LUA_NO_ERROR) then
							if parentParameters.itemid == 2595 then
					doPlayerBuyItem(cid, 2599, parentParameters.amount, 0, 0)
				end
				local msg = module.npcHandler:getMessage(MESSAGE_ONBUY)
				msg = module.npcHandler:parseMessage(msg, parseInfo)
				selfSay(msg)
			else
				local msg = module.npcHandler:getMessage(MESSAGE_NEEDMOREMONEY)
				msg = module.npcHandler:parseMessage(msg, parseInfo)
				selfSay(msg)
			end

Global.lua
add
Code:
function doPlayerBuyCharges(cid, itemid, count, cost, charges)
	if(doPlayerRemoveMoney(cid, cost*count) == TRUE) then
		return doPlayerGiveItem(cid, itemid, count)
	else
		return LUA_ERROR
	end
end

Above
Code:
function doPlayerBuyItem(cid, itemid, count, cost, charges)
	if(doPlayerRemoveMoney(cid, cost) == TRUE) then
		return doPlayerGiveItem(cid, itemid, count, charges)
	else
		return LUA_ERROR
	end
end

runes.lua
you should use this function like this
Code:
shopModule:addBuyableCharges({'RUNE-NAME'}, 					RUNE-ID, Price-Eatch-CHarge, 		'RUNE-NAME')
 
Lua Script Error: [Npc interface]
data/npc/scripts/runes.lua

data/npc/scripts/runes.lua:21: attempt to call method 'addBuyableCharges' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/runes.lua

:|
 
Last edited:
THHHHHHHANKSSSSSSSS
i will post the complete npc with all runes.. (only if work ;P)

but, dont have way to make it using GetCount ?! example:
shopModule:addBuyableItem({'sudden death', 'sd'}, RUNEID, PRICE*GetCount(MsG), GetCount(MsG), 'sudden death rune')

only a suggestion ;D

Awesome nice, when will that be? :D
 
Lua Script Error: [Npc interface]
data/npc/scripts/runes.lua

data/npc/scripts/runes.lua:21: attempt to call method 'addBuyableCharges' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/runes.lua

:|

Hmm i might missed somting u know what? tomorrow (20-09-2007) i will update my compleet server to 0.2.5 and i will make it/test it it wont take longer then max 30 min i think, if it works you will notice an release thread of it and a link to it in this thread =)
 
Hmm i need to make an new function for it but it wont be that hard :eek: i will make it when i'm out of school oke?




i never scripted on luaSql way so i'm an newbie :p but i gone learn it soon

it's not so hard... just need to connect to the database, it's a easy thing and then start scripting
 
Status
Not open for further replies.
Back
Top