What's new

prosba o npc

Status
Not open for further replies.

Veni Vida Vici

Active User
Joined
Mar 21, 2010
Messages
139
Reaction score
5
Age
31
Siemano.
potrzebuje
npc na zasadzie addonera ty mu cos przyniesiesz on cos daje.
npc informaja.
drzwi na klucz .
tyle pozdro.
Notka moderatorska:
Przenosz?.
 

Arts18

Signed...
Joined
May 7, 2009
Messages
2,888
Reaction score
231
Age
33
Odp: prosba o npc

1.
Tworzymy plik addons.lua i dodajmy do data/NPC/scripts :
Code:
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 buyAddons(cid, message, keywords, parameters, node)
	--TODO: buyAddons function in modules.lua
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local addon = parameters.addon
	local cost = parameters.cost
	local premium = (parameters.premium ~= nil and parameters.premium)

	if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then
		if doPlayerRemoveMoney(cid, cost) then
			doPlayerAddAddons(cid, addon)
			npcHandler:say('There, you are now able to use all addons!', cid)
		else
			npcHandler:say('Sorry, you do not have enough money.', cid)
		end
	else
		npcHandler:say('I only serve customers with premium accounts.', cid)
	end

	keywordHandler:moveUp(1)
	return true
end

local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addons set for 5000 gold coins?'})
	node1:addChildKeyword({'yes'}, buyAddons, {addon = 1, cost = 5000, premium = true})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Would you like to buy the second addons set for 10000 gold coins?'})
	node2:addChildKeyword({'yes'}, buyAddons, {addon = 2, cost = 10000, premium = true})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addons set for 5000 gold coins and the second addons set for 10000 gold coins.'})

npcHandler:addModule(FocusModule:new())
Potem tworzymy Addon.xml :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Addon" script="addons.lua" walkinterval="0" floorchange="0">
    <health now="150" max="150"/>
    <look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|."/>
    </parameters>
</npc>

Nast?pne p??niej dopisz?.

Pozdrawiam.
 

Veni Vida Vici

Active User
Joined
Mar 21, 2010
Messages
139
Reaction score
5
Age
31
Odp: prosba o npc

ale to co trzeba zmienic naprzyklad podchodze do npc pisze bla bla bla on pisze masz 500 demonic esse ja pisze ta on daje klucz ;P
i pozniej zas ja daje mu 1000d esse on zas daje klucz :p

i jeszcze jeden npc ;p jak mu cos przyniose naprzyklad zas 100 d esse daje tp :p
 

Kopek14

Advanced User
Joined
May 19, 2008
Messages
226
Reaction score
10
Odp: prosba o npc

Z tym tp mo?na inanczej zrobi?... tu masz skrypt dzi?ki kt?remu jak gracz ma xxx storage b?dzie przeniesiony tam gdzie chcesz:
To wklejasz do folderu movements
PHP:
function onStepIn(cid, item, frompos, item2, topos)
local playerpos = getPlayerPosition(cid)
local novapos = {x=32041,y=32759,z=6}
local storage = 1012 -- jakie storage musi posiadac
  if getPlayerStorageValue(cid, storage) > 0 then
    getThingfromPos(playerpos)
    doTeleportThing(cid,novapos)
    doSendMagicEffect(novapos,15)
  else
    doPlayerSendTextMessage(cid, 19, "Nie wykonales misji!")
  end
return TRUE
end

A to do pliku movements.xml
PHP:
<movevent type="StepIn" actionid="9995" event="script" value="teleport.lua"/>
 
Status
Not open for further replies.
Top