• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[lua] npc - travelnode~

Status
Not open for further replies.

iDELTI

C++
Joined
Jan 15, 2010
Messages
2,033
Reaction score
69
Location
Zimbabwe
Krótko opiszę swój problem, którego nie potrafię rozwikłać w żaden sposób.
Pytałem już wiele osób, które mają styczność z LUA. Niestety nie potrafią pomóc.
Nie chce mi się pisać swojego NPC TRAVELLER w LUA, gdyż wolę wykorzystać te Otservowskie.
Może i są trudniejsze, ale myślę, że ktoś da sobie z tym radę.


Opis problemu...

Oto NPC Holothr, jest odpowiedzialny za wysłanie podróznika, za bramę koło której obaj stoją.

XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Holothr" script="data/npc/scripts/quest/gladiator/holothr_agree.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="289" head="58" body="68" legs="101" feet="95" addons="0" mount="4"/>
    <parameters>
        <parameter key="message_greet" value="Are you kidding me ? You are to slow to damaged {Spartacus} !"/>
        <parameter key="message_farewell" value="Get the fuck out, |PLAYERNAME|!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="spartacus;pay;fanatics;arena" />
        <parameter key="keyword_reply1" value="You want to fight with Spartacus ? Now You must {pay}." />
        <parameter key="keyword_reply2" value="You must give me 250k GP. When You give me 250k GP, I set You battle mode with Spartacus and {Fanatics} on the {arena}." />
		<parameter key="keyword_reply3" value="Fanatics is warriors who fight to glory Spartacus!" />
		<parameter key="keyword_reply4" value="You want to {fight} now ?" />
    </parameters>
</npc>

*LUA*

LUA:
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
        
        
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
        local travelNode = keywordHandler:addKeyword({'fight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Are You sure ?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 120, cost = 250000, destination = {x=1103, y=1006, z=4} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'So, die!!!'})
           
            -- Makes sure the npc reacts when you say hi, bye etc.
        npcHandler:addModule(FocusModule:new())

Problem to innymi słowy nie przepuszczenie przez bramę, mając "X" gotówki potrzebnej do przeniesienia na "X" pozycję(w momencie rozmowy posiadam 500 CC).
Należę do ludzi, którzy w momencie poszukiwania pomocy, starają się jak najjaśniej opisać swoje wątpliwości(niewiedzę).
Tak więc dołączam screena z rozmowy.
Prosze o pomoc, gdyż aktualnie stoję w miejscu z napisaniem skryptu. Bez tego NPC ani rusz.

0fqciRFvBH.png


Podejrzewam błąd w libie...
 
Próbowałem już, odpada.
Z resztą w npc.cpp jest coś takiego jak count~ i to skanuje wszystkie sloty w poszukiwaniu danego "items".

ale ten npc system jest napisany w lua, to co npc.cpp ma tutaj do rzeczy? =)=)=)
 
Fixed.
Zamieszczam Wam tutaj przydatną funkcję, jeżeli będziecie robić systemy, questy z użyciem travelNode.

LUA:
  if(getPlayerMoneyCount(cid) >= 250000) then
doTeleportThing(cid, x="pos" y="pos" z="pos")
Dedykacja dla Samme~
Gdzie ja zamieścić, to już zależy od Was.

Można zamknąć temat...
 
Status
Not open for further replies.
Back
Top