• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Pomoc z NPC dam repucika

Status
Zamknięty.

janek obarzanek

Advanced User
Dołączył
Marzec 11, 2009
Posty
341
Liczba reakcji
21
Mam problem z npc! gdy do nich pisze pisz? mi na default a chcia?bym ?eby pisali mi automatycznie na NPC channel
To przk?adowy scrypt NPC na moim ots-ie
Przk?adowy NPC.xml

PHP:
<?xml version="1.0"?>
<npc name="Jubiler" script="data/npc/scripts/rings.lua">
	<mana now="800" max="800"/>
	<health now="200" max="200"/>
<look type="133" head="114" body="119" legs="132" feet="114"/>
      <parameters>
            <parameter key="module_shop" value="1"/>
		<parameter key="message_greet" value="Hello |PLAYERNAME|.Sell almulets and rings." />
		<parameter key="message_needmoremoney" value="You do not have enough money?" />
		<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you?" />
	</parameters>
</npc>

a to crypt do niego
data/npc/scripts/rings.lua

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({'sword ring'}, 2207, 200, 'sword ring')
shopModule:addBuyableItem({'club ring'}, 2209, 200, 'club ring')
shopModule:addBuyableItem({'axe ring'}, 2208, 200, 'axe ring')
shopModule:addBuyableItem({'power ring'}, 2166, 200, 'power ring')
shopModule:addBuyableItem({'energy ring'}, 2167, 500, 'energy ring')
shopModule:addBuyableItem({'life ring'}, 2168, 1500, 'life ring')
shopModule:addBuyableItem({'time ring'}, 2169, 1000, 'time ring')
shopModule:addBuyableItem({'might ring'}, 2164, 2000, 'might ring')
shopModule:addBuyableItem({'ring of healing'}, 2214, 3000, 'ring of healing')
shopModule:addBuyableItem({'stealth ring'}, 2165, 1000, 'stealth ring')
shopModule:addBuyableItem({'stone skin amulet'}, 2197, 2000, 'stone skin amulet')
shopModule:addBuyableItem({'protection amulet'}, 2200, 200, 'protection amulet')
shopModule:addBuyableItem({'elven amulet'}, 2198, 500, 'elven amulet')
shopModule:addBuyableItem({'platinum amulet'}, 2171, 2000, 'platinum amulet')
shopModule:addBuyableItem({'dragon necklace'}, 2201, 1000, 'dragon necklace')
shopModule:addBuyableItem({'garlic necklace'}, 2199, 500, 'garlic necklace')
shopModule:addBuyableItem({'dwarven ring'}, 2213, 2000, 'dwarven ring')

shopModule:addSellableItem({'Black Pearl'}, 2144, 300, 'Black Pearl')
shopModule:addSellableItem({'White Pearl'}, 2143, 200, 'White Pearl')
shopModule:addSellableItem({'Talon'}, 2151, 400, 'Talon')
shopModule:addSellableItem({'Small Topaz'}, 9970, 200, 'Small Topaz')
shopModule:addSellableItem({'Small Sapphire'}, 2146, 250, 'Small Sapphire')
shopModule:addSellableItem({'Small Ruby'}, 2147, 250, 'Small Ruby')
shopModule:addSellableItem({'Small Emerald'}, 2149, 250, 'Small Emerald')
shopModule:addSellableItem({'Small Diamond'}, 2145, 300, 'Small Diamond')
shopModule:addSellableItem({'Small Amethyst'}, 2150, 200, 'Small Amethyst')
shopModule:addSellableItem({'Scarab coin'}, 2159, 1000, 'Scarab coin')


npcHandler:addModule(FocusModule:new())

Prosz? o syzbka pomoc dam repucika
 
Odp: Pomoc z NPC dam repucika

Cze.

rings.lua
PHP:
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({'time ring'},					2169, 100, 		'time ring')
shopModule:addBuyableItem({'life ring'},					2168, 100, 		'life ring')
shopModule:addBuyableItem({'roh','ring of healing'},					2214, 100, 		'ring of healing')
shopModule:addBuyableItem({'axe ring'},					2208, 100, 		'axe ring')
shopModule:addBuyableItem({'sword ring'},					2207, 100, 		'sword ring')
shopModule:addBuyableItem({'stone skin amulet','ssa'},					2197, 100, 		'stone skin amulet')




npcHandler:addModule(FocusModule:new())

sam NPC :
HTML:
<npc name="Ringero" script="data/npc/scripts/rings.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="133" head="114" body="119" legs="132" feet="114"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I sell rings and stone skin amulets" />
		<parameter key="message_needmoremoney" value="You do not have enough money." />
		<parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you?" />
	</parameters>
</npc>

Bye.

PS : Troche inny ale dzia?a w 100% :)
 
Odp: Pomoc z NPC dam repucika

no spoko ale ja nie chcialem scryptu na npc tylko jak zrobic zeby pisa? na npc channel
 
Odp: Pomoc z NPC dam repucika

PHP:
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({'sword ring'}, 2207, 200, 'sword ring')
shopModule:addBuyableItem({'club ring'}, 2209, 200, 'club ring')
shopModule:addBuyableItem({'axe ring'}, 2208, 200, 'axe ring')
shopModule:addBuyableItem({'power ring'}, 2166, 200, 'power ring')
shopModule:addBuyableItem({'energy ring'}, 2167, 500, 'energy ring')
shopModule:addBuyableItem({'life ring'}, 2168, 1500, 'life ring')
shopModule:addBuyableItem({'time ring'}, 2169, 1000, 'time ring')
shopModule:addBuyableItem({'might ring'}, 2164, 2000, 'might ring')
shopModule:addBuyableItem({'ring of healing'}, 2214, 3000, 'ring of healing')
shopModule:addBuyableItem({'stealth ring'}, 2165, 1000, 'stealth ring')
shopModule:addBuyableItem({'stone skin amulet'}, 2197, 2000, 'stone skin amulet')
shopModule:addBuyableItem({'protection amulet'}, 2200, 200, 'protection amulet')
shopModule:addBuyableItem({'elven amulet'}, 2198, 500, 'elven amulet')
shopModule:addBuyableItem({'platinum amulet'}, 2171, 2000, 'platinum amulet')
shopModule:addBuyableItem({'dragon necklace'}, 2201, 1000, 'dragon necklace')
shopModule:addBuyableItem({'garlic necklace'}, 2199, 500, 'garlic necklace')
shopModule:addBuyableItem({'dwarven ring'}, 2213, 2000, 'dwarven ring')

shopModule:addSellableItem({'Black Pearl'}, 2144, 300, 'Black Pearl')
shopModule:addSellableItem({'White Pearl'}, 2143, 200, 'White Pearl')
shopModule:addSellableItem({'Talon'}, 2151, 400, 'Talon')
shopModule:addSellableItem({'Small Topaz'}, 9970, 200, 'Small Topaz')
shopModule:addSellableItem({'Small Sapphire'}, 2146, 250, 'Small Sapphire')
shopModule:addSellableItem({'Small Ruby'}, 2147, 250, 'Small Ruby')
shopModule:addSellableItem({'Small Emerald'}, 2149, 250, 'Small Emerald')
shopModule:addSellableItem({'Small Diamond'}, 2145, 300, 'Small Diamond')
shopModule:addSellableItem({'Small Amethyst'}, 2150, 200, 'Small Amethyst')
shopModule:addSellableItem({'Scarab coin'}, 2159, 1000, 'Scarab coin')


npcHandler:addModule(FocusModule:new())

Poprawilem twoj skrypt, dziala jak trzeba?

@down A moze wystarczy same biblioteki podmienic ; o
 
Ostatnia edycja:
Odp: Pomoc z NPC dam repucika

Kto? jego post w og?le czyta? bo mi si? wydaje ?e nie. A tak wracaj?c do tematu ?ci?gnij sobie jakiego? z nowszych TFS 0.3.5 i stamt?d podmieni sobie folder/pliki npc.


@edit
Radom rox haha :D

A to dla ?lepych.
chcia?bym ?eby pisali mi automatycznie na NPC channel
 
Ostatnia edycja:
Odp: Pomoc z NPC dam repucika

oke w?asniesie zastanawia?em przed chwil? czy ja dobrze wyjasni?em o co biega! Ale najw?zniejsze ze ktos tu czyta do konca!
Pozdrawiam mysl?cych ludzi i to jeszcze z tej samej miejscowo?ci co ja RADOM
 
Status
Zamknięty.
Do góry