TFS 0.3 problem z npc

Status
Zamknięty.

boomx

User
Zarejestrowany
Dołączył
Lipiec 10, 2009
Posty
48
Liczba reakcji
0
Wiek
34
Pomocy!!
Nieda sie nic kupic u npc mozna tylko sell,
mam kase a nic niemoge kupic ;( Help


/temat wyczerpany, zamykam
 
Odp: Pomocy

Odp: Pomocy

Zr?b skrypt:

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

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

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

shopModule:addBuyableItem({'mace'}, 2398, 40, 'mace')
shopModule:addBuyableItem({'spike sword'}, 2383, 1500, 'spike sword')
shopModule:addBuyableItem({'battle axe'}, 2378, 500, 'serpent sword')

shopModule:addSellableItem({'mace'}, 2398, 30, 'mace')
shopModule:addSellableItem({'katana'}, 2412, 45, 'katana')
shopModule:addSellableItem({'scimitar'}, 2419, 120, 'scmitar')

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Pozmieniaj Itemy. na jakie chcesz.

P??niej tylko dorabiasz do tego NPC. ;)
 
Odp: Pomocy

Odp: Pomocy

Poka? sw?j skrypt na tego npc :p
 
Odp: Pomocy

Odp: Pomocy

Zrobi?em tak jak kaza?es i
sbin1z.jpg

a to kod tego npc co by? wczesniej:
HTML:
-- Made by Coltain13 // Coltain --
-- If you use or edit, please give credit to me --

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

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

local node1 = keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I have Fish, Brown Mushrooms, White Mushrooms, Bread, Rolls, Cherries, Bananas, Dragon Ham, Meat, and Ham.'})

shopModule:addBuyableItem({'fish', 'fish'},2667,82,'fish')
shopModule:addBuyableItem({'brown mushroom', 'brown mushrooms'},2789, 100,'brown mushroom')
shopModule:addBuyableItem({'white mushroom', 'white mushrooms'},2787, 80,'white mushroom')
shopModule:addBuyableItem({'bread', 'breads'},2689, 50,'bread')
shopModule:addBuyableItem({'roll', 'rolls'},2690, 25,'roll')
shopModule:addBuyableItem({'cherry', 'cherries'},2679, 10,'cherry')
shopModule:addBuyableItem({'banana', 'bananas'},2676, 25,'banana')
shopModule:addBuyableItem({'dragon ham', 'dragon hams'},2672, 150,'dragon ham')
shopModule:addBuyableItem({'meat', 'meat'},2666, 60,'meat')
shopModule:addBuyableItem({'ham', 'hams'},2671, 80,'ham')


npcHandler:addModule(FocusModule:new())
 
Odp: Pomocy

Odp: Pomocy

A spr?buj zrobi? spacje po "," np. :
Kod:
shopModule:addBuyableItem({'fish'}, 2667, 8, 'fish')
 
Odp: Pomocy

Odp: Pomocy

nic nie da?o jest dale to samo co
@
up
@
up
na ss ;(

Musi by? gdzie? b??d w kodzie ;/
 
Ostatnia edycja:
Odp: Pomocy

Odp: Pomocy

Zaraz zrobi? Ci ca?ego NPC...
W folderze npc stw?rz plik nazwa_npc.xml (zamiast nazwa_npc wymy?l jak?? nazw?:p) i wklej tam:
Kod:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="[COLOR="Red"]nazwa_npc[/COLOR]" script="data/npc/scripts/food.lua" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="325" head="0" body="114" legs="114" feet="114" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="shop_buyable" value="fish,2667,82;brown mushroom,2789,100;white mushroom,2787,80;bread,2689,50;roll,2690,25;cherry,2679,10;banana,2676,25;dragon ham,2672,150;meat,2666,60;ham,2671,80" />
	</parameters>
</npc>

Zamiast nazwa_npc wpisz nazw?, kt?r? wybra?e?.

Potem do npc/scripts zr?b plik food.lua i wpisz w nim:
Kod:
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

npcHandler:addModule(FocusModule:new())

Je?li ju? go masz to zamie? zawarto??. Wszystko powinno ju? dzia?a? :p
A je?li nie to masz co? z npc systemem :p

Mam nadziej?, ?e pomog?em:p
 
Ostatnia edycja:
Odp: Pomocy

Odp: Pomocy

ehh... ale to nie chodzi o 1 npc :(
All! u ktorych mozna cos kupic... ;(
 
Odp: Pomocy

Odp: Pomocy

To musisz zmieni? npc system :p a jaki masz silnik :p??
 
Odp: Pomocy

Odp: Pomocy

Przyk?ad ;)

Amuletseller:
Kod:
<npc name="Amuletseller" script="data/npc/scripts/[B]amulet.lua[/B]" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="134" head="114" body="113" legs="113" feet="113" addons="3" corpse="2212"/>
	<parameters>
		<parameter key="module_shop" value="1" />
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell amulet of loss,dwarven ring,might ring,key ring,time ring,energy ring,stealth ring,life ring, ring of healing, club ring ,sword ring and axe ring." />
		<parameter key="shop_buyable" value="vial,2006,10;flask,2006,10" />
		<parameter key="shop_buyable" value="amulet of loss,2173,50000;dwarven ring,2213,2000;might ring,2164,5000,20;key ring,5801,10000;time ring,2169,2000;energy ring,2167,2000;stealth ring,2165,2000;life ring,2168,1000;ring of healing,2214,2000;axe ring,2208,200;club ring,2209,200;sword ring,2207,200;stone skin,2197,5000,5" />
	</parameters>
</npc>

Plik do niego(amulet.lua):
Kod:
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'amulet of loss', 'amulet of loss'}, 2173, 50000, 'amulet of loss')
shopModule:addBuyableItem({'stone skin amulet', 'stone skin amulet'}, 2197, 2500, 'stone skin amulet')
shopModule:addBuyableItem({'might ring', 'might ring'}, 2164, 10000, 'might ring')
shopModule:addBuyableItem({'stealth ring', 'stealth ring'}, 2165, 10000, 'stealth ring')
shopModule:addBuyableItem({'power ring', 'power ring'}, 2166, 10000, 'power ring')
shopModule:addBuyableItem({'energy ring', 'energy ring'}, 2167, 10000, 'energy ring')
shopModule:addBuyableItem({'life ring', 'life ring'}, 2168, 5000, 'life ring')
shopModule:addBuyableItem({'time ring', 'time ring'}, 2169, 10000, 'time ring')
shopModule:addBuyableItem({'sword ring', 'sword ring'}, 2207, 10000, 'sword ring')
shopModule:addBuyableItem({'axe ring', 'axe ring'}, 2208, 10000, 'axe ring')
shopModule:addBuyableItem({'club ring', 'club ring'}, 2209, 1000, 'club ring')
shopModule:addBuyableItem({'dwarven ring', 'dwarven ring'}, 2213, 1000, 'dwarven ring')
shopModule:addBuyableItem({'crystal ring', 'crystal ring'}, 2124, 500, 'crystal ring')
npcHandler:addModule(FocusModule:new())
 
Status
Zamknięty.
Back
Do góry