What's new

Skrypty & Kody Interakcja NPC

Status
Not open for further replies.

Wirox

User
Joined
Apr 29, 2009
Messages
31
Reaction score
0
Witam.
Ot?? mam problem z pewnym NPC. Problem polega na tym, ?e gdy wpisz? podan? fraz?, na kt?r? NPC powinien reagowa?, nic si? nie dzieje. M?g?by kto? mi powiedzie? co ?le napisa?em w skrypcie?
Z g?ry dzi?kuj? i uprzedzam, ?e jestem nowicjuszem, tote? prosz? o wyrozumia?o??.

Oto skrypt:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hegar" script="default.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="134" head="116" body="20" legs="59" feet="115" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. We have already reached in place. Unfortunately, you have to reach the city alone. Along the way, you shouldn't find anything dangerous, but you better take {equipment} from the chest."/>
	</parameters>
	[color=darkblue]<interaction range="3" idletime="0" defaultpublic="0">
		<interact keywords="equipment">
			<response text="Do you see the chest on the front of ship? There you should find basic equipment."/>
		</interact>
		<interact keywords="name">
			<response text="My name is |NPCNAME|."/>
		</interact>
	</interaction>[/color]
</npc>
 

Atlas

Advanced User
Joined
May 29, 2008
Messages
340
Reaction score
19
Odp: Interakcja NPC

nie wiem jakiego distro u?ywasz ale to nie tak :p
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hegar" script="default.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="134" head="116" body="20" legs="59" feet="115" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. We have already reached in place. Unfortunately, you have to reach the city alone. Along the way, you shouldn't find anything dangerous, but you better take {equipment} from the chest."/>
<parameter key="keywords" value="equipment;name" />
<parameter key="keyword_reply1" value="Do you see the chest on the front of ship? There you should find basic equipment." />	
<parameter key="keyword_reply2" value="My name is |NPCNAME|." />	
</parameters>
</npc>

prosz? :)
 

Wirox

User
Joined
Apr 29, 2009
Messages
31
Reaction score
0
Odp: Interakcja NPC

Niestety przy tej wersji skryptu NPC wci?? nie reaguje na te dwie frazy. Odpowiada na powitanie i po?egnanie, ale na wyrazy 'equipment' i 'name' ju? nie. Mog? pokaza? innego, dzia?aj?cego NPC z dzia?aj?c? interakcj?, kt?ry by? ju? w danych. W?a?nie bazowa?em si? na interakcji tego NPC, jednak co? musia?em zrobi? ?le.
I mam pytanie, mo?e nieco g?upie: czym jest distro?

Podam fragment skryptu tego NPC'a, ca?ego nie daj?, poniewa? plik wa?y a? 6KB i zaj??oby to zbyt du?o miejsca.
Code:
<?xml version="1.0"?>
<npc name="Merchant Glut" floorchange="0" walkinterval="4000" speed="220">
	<health now="150" max="150"/>
	<look type="100" head="0" body="0" legs="0" feet="0"/>
  <interaction range="3" idletime="0" defaultpublic="0">
    <!--This will include the merchant interaction, in this way several npc can use the same interaction-->
    <include file="merchant.xml"/>
    <interact keywords="hi" focus="1">
      <!--These are the alternative keywords-->
      <keywords>hello</keywords>
      <response text="Hello. How may I help you |NAME|?"/>
    </interact>
    <interact keywords="bye" focus="0">
      <!--These are the alternative keywords-->
      <keywords>farewell</keywords>
      <response text="It was a pleasure to help you."/>
    </interact>
    <!--
    <interact event="onBusy">
      <response text="One moment please, |NAME|.">
        <action name="addqueue" value="|PLAYER|"/>
      </response>
    </interact>
    -->
    <interact event="onPlayerLeave" focus="0">
      <response text="It was a pleasure to help you |NAME|."/>
    </interact>
    <interact keywords="name">
      <response text="My name is |NPCNAME|."/>
    </interact>
    <interact keywords="job">
      <response text="I am a merchant, my job is to serve you!"/>
    </interact>
 

Wirox

User
Joined
Apr 29, 2009
Messages
31
Reaction score
0
Odp: Interakcja NPC

Zrobi?em!
Zauwa?y?em, ?e tamten NPC ca?? rozmow? ma w interakcji, a nie cz??? tu, a cz??? w parametrach. Poszed?em tym tropem i 'hi', oraz 'bye' da?em do interakcji, a tamto usun??em. Zobaczy?em, ?e na 'hi' odpowiada podw?jnie. Zorientowa?em si?, ?e linijka script="default.lua" powoduje, ?e NPC m?wi teksty, kt?re mu napisa?em i te bazowe napisane w default.lua, wi?c wyrzuci?em t? linijk?. Dzi?ki za pr?b? pomocy i mobilizacj? do dalszej pracy ;)

Poka?? teraz skrypt mojego NPC, aby inni u?ytkownicy z tym samym problemem wiedzieli co trzeba zrobi?.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hegar" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="134" head="116" body="20" legs="59" feet="115" addons="0"/>
	<interaction range="3" idletime="0" defaultpublic="0">
		<interact keywords="hi" focus="1">
			<!--These are the alternative keywords-->
			<keywords>hello</keywords>
			<response text="Hello, |NAME|. We have already reached in place. Unfortunately, you have to reach the city alone. Along the way, you shouldn't find anything dangerous, but you better take {equipment} from the chest."/>
		</interact>
		<interact keywords="equipment">
			<response text="Do you see the chest on the front of ship? There you should find basic equipment."/>
		</interact>
		<interact keywords="name">
			<response text="My name is |NPCNAME|."/>
		</interact>
		<interact keywords="bye" focus="0">
			<!--These are the alternative keywords-->
			<keywords>farewell</keywords>
			<response text="Good bye, |NAME|."/>
		</interact>
		<interact event="onPlayerLeave" focus="0">
			<response text="How rude!"/>
		</interact>
	</interaction>
</npc>
 
Last edited:
Status
Not open for further replies.
Top