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

Problem npc (nie odpowiada)

Tom

New Member
Joined
Nov 5, 2008
Messages
40
Reaction score
0
Cześć wszystkim.
Mam problem z npc, nie odpisuje mi.
Tutaj skrypt:
Code:
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
function onPlayerEndTrade(cid)          npcHandler:onPlayerEndTrade(cid)            end
function onPlayerCloseChannel(cid)      npcHandler:onPlayerCloseChannel(cid)        end

function creatureSayCallback(cid, type, msg)

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
		
if msgcontains(msg, 'no') and getPlayerStorageValue(cid, 60300) == -1 and getPlayerStorageValue(cid, 60300) == -1 then
                npcHandler:say('Well... as you wish.', cid)
                talk_state = 0
        elseif msgcontains(msg, 'yes') and getPlayerStorageValue(cid, 60300) == -1 and getPlayerStorageValue(cid, 60300) == -1 then
                npcHandler:say('My roof is broken. I need some {nails} to repair it... 30 of them will be nice. I will really apreciate Your help!', cid)
                talk_state = 5
        elseif msgcontains(msg, 'nails') and talk_state == 5 then
                
npcHandler:say('Yes, metal, strong nail! I think War Golems may have some nails, You can find them south to my home.', cid)
		doPlayerSetStorageValue(cid,60300, 1)	
talk_state = 0

              elseif (msgcontains(msg, 'nail') or msgcontains(msg, 'nails') or msgcontains(msg, 'yes') or msgcontains(msg, 'done') or msgcontains(msg, 'reward')) and getPlayerItemCount(cid,8309) < 30 and getPlayerStorageValue(cid, 60301) == -1 then
npcHandler:say('Please hurry up! I really need them.', cid) 
            elseif getPlayerStorageValue(cid, 60300) == 1 and getPlayerStorageValue(cid, 60301) == -1 and (msgcontains(msg, 'reward') or msgcontains(msg, 'yes') or msgcontains(msg, 'nail') or msgcontains(msg, 'nails') or msgcontains(msg, 'done')) then 
if getPlayerItemCount(cid,8309) >= 30 then
        if doPlayerRemoveItem(cid,8309,30) then
                npcHandler:say('Thank You so much! I really apreciate it. If You want You can explore my basement. Go past the door on the left.', cid)
doPlayerSetStorageValue(cid,60301, 1) 


                talk_state = 0
            end
end
        ------------------------------------------------ confirm no ------------------------------------------------
       
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end
end

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

Bardzo proszę o pomoc.
Pozdrawiam
 
on z rl? jesli tak to jak sie nazywa
bo straszny syf w nim :p i szybciej dojde do tego co ma robic jak oblukam na wikia

a jesli nie z rl to powiedz co on ma robic
 
Nie, on nie jest z RL :p heh :D

Hm jeśli chodzi co on robi, to w jego pokoju znajdują się drzwi, przez które można przejść jak z nim porozmawiamy :D
 
no to chyba nie czytales tego skryptu :p
wstaw mi tu dialog do niego, to co ma zabierac i dawac przy tym(storage, itemy)
 
Ja nawet nie wiem co on zabiera/daje :D Po prostu dałem swojej postaci storage żebym mógł przejść przez drzwi i tyle, quest na firewolkery.
 
taaa :D
czyli niewazne teraz co jest w tym skrypcie o..
i powiedz co potrzebujesz :) bedzie najprosciej
 
No to dobra, myślę myślę......

Idziemy do NPC, on nas prosi o pomoc, zgadzamy się mu pomóc i dostajemy storageid żeby móc przejść przez drzwi. Następnie przechodzimy przez drzwi i szukamy jakiegoś przedmiotu dla Niego. Bierzemy i zwracamy przedmiot NPC. On dam daje w nagrodę dostęp do tych drzwi i jakiś item.
 
Ja pierdole >.<

Download & Run
i tak się to kończy
po co tak robisz? po co chcesz na siłę ściągnąć czyiś pomysł zamiast zrobić coś samemu?
 
sorry :p za pozno, zrobilem
wystarczy pogadac to nam da przejscie
Lua:
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
function onPlayerEndTrade(cid)          npcHandler:onPlayerEndTrade(cid)            end
function onPlayerCloseChannel(cid)      npcHandler:onPlayerCloseChannel(cid)        end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then return false end
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid

	local storage = 60300 -- storage aid do drzwi
	local getStor = getCreatureStorage(cid, storage)

	if doMessageCheck(msg, 'drzwi') then
		if getStor == -1 then
			selfSay('Ze niby chcesz tam wejsc, jakim prawem tego zadasz?', cid)
			talkState[talkUser] = 1
		else
			selfSay('Przciez juz wykrzyczales sobie tam wejscie.. idz juz, idz!', cid)
			talkState[talkUser] = 0
		end

	elseif doMessageCheck(msg, 'poniewaz') and talkState[talkUser] == 1 then
		selfSay('My roof is broken. I need some {nails} to repair it... 30 of them will be nice. I will really apreciate Your help!', cid)
		talkState[talkUser] = 2

	elseif doMessageCheck(msg, 'co') and talkState[talkUser] == 2 then
		selfSay('No dobra dobra.. idz juz. Drzwi sa otwarte.', cid)
		doCreatureSetStorage(cid, storage, 1)
		talkState[talkUser] = 0


	elseif doMessageCheck(msg, 'no') and isInArray({1,2}, talkState[talkUser])  then
		selfSay('Well... as you wish.', cid)
		talkState[talkUser] = 0
	end

	return true
end

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

dialogu chyba dojdziesz ;)

no i tu kliknij

@up seminari, a nich sie chlopak bawi.. ja na poczatku tez zielony bylem. to sie bralo co dawali.. az sie nauczylem .. troche ;)
 
Last edited:
Ja pierdole >.<

Download & Run
i tak się to kończy
po co tak robisz? po co chcesz na siłę ściągnąć czyiś pomysł zamiast zrobić coś samemu?

Pajacu dostałem od znajomego projekt i po prostu przy kompilacji z linuxa na windows połowa npc i questów nie działała.
 
Wyskakuje błąd:
[Error - LuaInterface::loadFile] data/npc/scripts/bron.lua:28: 'end' excepted <to close ble ble ble>
i w lini 21 coś jeszcze jest.
 
byc nie moze.. podepne u siebie na probe zaraz.
npc chat z nim wogole otwiera sie? czyli na hi reaguje?
 
Na hi reaguje.

+ oto jego xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Bron" script="bron.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150"/>
<look type="148" head="119" body="102" legs="122" feet="115" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. Will You help me? {yes} or {no}."/>
	</parameters>
</npc>
 
u mnie smiga pieknie
23:45 Test: Welcome, Andy, wanderer between the worlds.
23:45 Andy [210]: drzwi
23:45 Test: Ze niby chcesz tam wejsc, jakim prawem tego zadasz?
23:45 Andy [210]: poniewaz
23:45 Test: My roof is broken. I need some nails to repair it... 30 of them will be nice. I will really apreciate Your help!
23:45 Andy [210]: co?
23:45 Test: No dobra dobra.. idz juz. Drzwi sa otwarte.
 
gg masz? bo tu do jutra bedziemy gadac.. a to juz niedlugo :D 12min

pisz mi na prv
-- edit
moze ten plik zle wstawiles
ma byc w katalogu
data/npc/scripts/bron.lua
 
Last edited:
Leon Zawodowiec naprawił. andypsylon Tobie również dziękuje za pomoc. Reputa dostałeś.
Proszę o zamknięcie tematu.
 
Back
Top