Full Version : Make conditional npc dialog entries
xmlspawner >>XMLSpawner - How do I? >>Make conditional npc dialog entries
<< Prev | Next >>
ArteGordon- 12-29-2005
Using the Condition field of a dialog entry
When creating interactive npc dialog, you can make each dialog entry depend on conditions that you can specify, so that the entry wont be activated unless the conditions are met by setting the Condition field of the entry.
You can access these fields by either manually editing the .npc file with any text editor, or by using the [xmledit command and targeting an item or npc that already has an XmlDialog attachment.
Example: Make an entry depend on whether or not the triggering player was carrying a certain item.
The Condition field requires a test, so you use GETONCARRIED to get a property to be tested on a carried item.
The way it works is that the GETONCARRIED keyword will get a property from the named item that is carried by the triggering player. The way that you would use it to test to see if the person had the item would just be to test for any old property that you knew would be on the item of interest. I like to use the Visible property for this.
Just put this in the Condition field
GETONCARRIED,itemname,Visible=true
The two parts to that are [property][operator][value], where 'GETONCARRIED,itemname,Visible' is the property, '=' is the operator, and 'true' is the value.
You can use the NOT operator ~ to invert the results of any test. So to test to see if a player is NOT carrying a particular item, use this in the Condition field
~GETONCARRIED,itemname,Visible=true
Note that you can use compound property tests with the & and | operators so you could test for multiple items like
GETONCARRIED,itemname,Visible=true & GETONCARRIED,itemname2,Visible=true
If the item is not there, then the test will fail (since the Visible field cant be true on something that isnt there)
Example: Make an entry depend on a players fame or karma.
To test for properties on the triggering mob, such as fame or karma, you would use the GETONTRIGMOB keyword to get the value of a property on the triggering mob and set the Condition field like this
GETONTRIGMOB,fame > 1000
or
GETONTRIGMOB,karma > 0
load the jeweler2.npc file for an example of this by downloading the attached .npc file (if you havent already downloaded it in the xmlextras package) and placing it in either your main RunUO folder or in a folder named XmlQuestNPC in your main RunUO folder and then issuing the command
[loadnpc jeweler2
Note, you will need to be a player to test this out (use the StaffCloak in xmlextras to quickly change your accesslevel for testing).
Mage-Solitaire- 01-01-2006
Utiliser le champ de condition d'une entrée de dialogue
Lors de la création d'un dialogue interactif de npc, vous pouvez faire de chaque entrée de dialogue dépendre des conditions de votre choix, de sorte que l'entrée ne soit pas activée à moins que les conditions du champ condition ne soient réunies.
Vous pouvez accéder à ces champs en éditant manuellement le fichier .npc avec n'importe quel éditeur de texte, ou en employant la commande [xmledit puis en ciblant tout objet/mobile ayant un xmldialog attaché.?
Exemple: Faites une entrée ne réagissant que si le joueur de déclenchement porte un certain article.
Le champ de condition exige un essai, ainsi vous emploierez GETONCARRIED pour vérifier si le triggermob porte l'objet.
cela fonctionne de la manière suivante : le mot-clé GETONCARRIED obtiendra une propriété pour l'objet qui est porté par le joueur de déclenchement.
Le meilleure moyen pour vérifier si un joueur porte effectivement l'objet est de choisir un propriété dont vous etes sur de la véracité. Il vaut mieux donc utiliser une propriété evidente,à placer dans le champ conditions, genre:
GETONCARRIED,itemname,Visible=true
la séparation de la commande se fait de la sorte:[property][operator][value], où 'GETONCARRIED,itemname,Visible' est la propriété, '=' est l'opérateur, et 'true' est la valeur.
Notez que vous pouvez effectuer de la sorte plusieurs tests en meme temps, en utilisant & et |
GETONCARRIED,itemname,Visible=true & GETONCARRIED,itemname2,Visible=true
si l'un des objets n'est pas là, alors le testéchouera (puisque la propriété visible ne peut etre "true" sur un objet n'etant pas là)
Exemple: Faire une entrée dépendant de la renommée du joueurs ou du karma.
Pour tester une propriété sur le TRIGGERMOB, comme la renommée ou le karma, vous pouvez utiliser le mot-clé GETONTRIGMOB pour obtenir la valeur d'une propriété
placer le champ de condition comme ceci:
GETONTRIGMOB,fame > 1000
ou
GETONTRIGMOB,karma > 0
godfood- 08-22-2006
I'm trying to get my Smith tell player's that they have a BOD waiting for them if their NextSmithBulkOrder = 00:00:00 But I can't figure it out.
Text: *<GETONTRIGMOB,name>, I have a new bulk order for you!*
Dependson: -1
Condition: GETONTRIGMOB,NextSmithBulkOrder = 00:00:00
GETONTRIGMOB,NextSmithBulkOrder=00:00:00
GETONTRIGMOB,NextSmithBulkOrder < 00:00:01
GETONTRIGMOB,NextSmithBulkOrder<00:00:01
Am I even close Arte?
aph- 08-22-2006

QUOTE (godfood @ August 22, 2006 09:49 am)
I'm trying to get my Smith tell player's that they have a BOD waiting for them if their NextSmithBulkOrder = 00:00:00 But I can't figure it out. Text: *<GETONTRIGMOB,name>, I have a new bulk order for you!* Dependson: -1 Condition: GETONTRIGMOB,NextSmithBulkOrder = 00:00:00
GETONTRIGMOB,NextSmithBulkOrder=00:00:00
GETONTRIGMOB,NextSmithBulkOrder < 00:00:01
GETONTRIGMOB,NextSmithBulkOrder<00:00:01
Am I even close Arte?

I had same problem with making condition in quest... i figured it out with quest in spawner (just like draugquest.xml).. but the first entries will be conditions:
1 IF/GETONTRIGMOB,NextSmithBulkOrder = 00:00:00/10/20
1 GOTO/1
10 SETONSPAWN,spwn nm,1/SAY/*{GETONTRIGMOB,name}, I have a new bulk order for you!*
10 IF/RND,1,10=1/33/44
20 SETONSPAWN,spwn nm,1/SAY/*{GETONTRIGMOB,name}, you have to wait {GETONTRIGMOB,NextSmithBulkOrder} for a new bulk order!*
20 GOTO/1
33 GIVE/LargeSmithBOD
33 SETONTRIGMOB/NextSmithBulkOrder/05:00:00
33 GOTO/1
44 GIVE/SmallSmithBOD
44 SETONTRIGMOB/NextSmithBulkOrder/03:00:00
44 GOTO/1
..
..
sry my eng :
godfood- 08-22-2006
What is the 1 GOTO/1 for?
aph- 08-22-2006

QUOTE (godfood @ August 22, 2006 10:39 am)
What is the 1 GOTO/1 for?

hmm you are right.. it will maybe work without GOTO/1.. but it's better (in this case it will always meet condition)
godfood- 08-22-2006
I'm still a little confused by your answer. Are you talking about using a spawner? or XMLEdit? I'm trying to set up an NPC Dialog using XMLEdit.
aph- 08-22-2006

QUOTE (godfood @ August 22, 2006 10:54 am)
I'm still a little confused by your answer. Are you talking about using a spawner? or XMLEdit? I'm trying to set up an NPC Dialog using XMLEdit.

i'm talking about using a spawner.. i found it better as using xmledit, cause I had the same problem as you and figured it out with using spawner.. (it's even simpler I think.. and it does the same thing as npc dialog.. using xmledit)
godfood- 08-22-2006
SO, when it say's 1 before that line, are you saying that goes in subgroup1? and 10 subgroup 10?
godfood- 08-22-2006
Ok, I got it working. Thanks for the help Aph
aph- 08-22-2006

QUOTE (godfood @ August 22, 2006 11:04 am)
SO, when it say's 1 before that line, are you saying that goes in subgroup1? and 10 subgroup 10?

yes, I've just tried it.. it works proper. btw <GETONTRIGMOB,name> {GETONTRIGMOB,name}
DreadfullyDespized- 10-31-2006
Well I am using the xmlquestnpc at the moment. and if you have two items.
Using the trigoncarried to handle this.
"waterfragment1 & waterfragment2"
then the questnpc will interact with you.
if not, at the moment nothing happends.
What I would like this to do is
Walk up to the questnpc. if you don't have the two fragments. he will tell you to see Lonita. But if you have waterfragment1 at least. then he tells you to go see donner. If you have both waterfragments then he will start his portion of this 3 part quest. which tells you to go kill a monster and loot an item named wateressence from the God of Water. Once the item is gained and you go back to the guy. Then he takes and deletes the waterfragment1&waterfragment2&wateressence. Then gives you the WaterMask item.
Here is what I have so far.

CODE
ID # 10: depends=-1 text=So you have talked to my family already. ID # 20: depends=-1
text=Would you like to do the last part of the quest?
ID # 30:
depends=10,20
keywords=yes,ok,sure
GUMP=GUMP,Sterli,4/Would you like to find the Water Essence for me from the God of Water?;Yes, of course;ok;Where is the?;God of Water
ID # 40:
depends=30,50
keywords=ok
GUMP=GUMP,Sterli,3/Kill the God of Water and loo the Water Essence from him.
ID # 50:
depends=30
GUMP=GUMP,Sterli,4/He is located in the Water Temple inside Ilshenar, Region named Reg Volon.;Ok;ok
ID # 60:
depends=40
keywords=accept
ACTION=GIVE/<questholder/name/WaterQuest3/notestring/Bring back the Water Essence please./objective1/
CONDITION=GETONCARRIED,waterfragment1,Visable=true & GETONCARRIED,waterfragment2,Visable=true

and that is as far as I have got.
Vladimir- 10-31-2006
Ok, add a new line after your current dialog that depends on -1. Check the "IgnoreCar" button which will tell that entry to ignore the TriggerOnCarried and NoTriggerOnCarried fields specified at the top...
In the Condition field use this: ~GETONCARRIED,waterfragment1,waterfragment,visible=true (Where the syntax is GETONCARRIED,name,type,property)
the ~ at the front tells it to check for the opposite of that line.. so instead of checking to see whether that item is visible, it will trigger if you are not carrying the item...
then you can add a message to the text line something along the lines of "You need to collect the waterfragment1 first."
And then you can add another line similar to this one to check for your second item!
Hope that helps
DreadfullyDespized- 11-10-2006
Something I am working on for all my quests.
basically you talk to the questgiver and then they give you the quest as normal. But if you aren't strong enough str wise. lets say under 50str. He will say you are not strong enough for this quest. but if you have over 50str you will be accepted. But also. If you have over 250str he will say you are too strong for this quest. Any idea to add these multiple checks and placements into a single xmlquestnpc?
also lets say if you complete the quest with 50-150str you get nicer stuff then if you complete the quest with 160-250str.
Rocko- 12-04-2006
I am having some problem here.
I am using [xmledit to edit the dialog of an NPC. The NPC (a henchman in this case) has a public member called IsHired. This value is false when he is not hired by any player, and becomes true after he got hired.
I want him to yell "hire me! I am the best in town" when player approaches, but only when he is not hired, thus the condition IsHired=false. I have -1 in the "depends on" field (thus he says it when player approaches), and put the following in the condition field:

CODE
GETONTHIS,IsHired=false

However, he doesn't say anything at all. I changed it to

CODE
<GETONTHIS, IsHired>=false

still no success.
If I remove this condition entry, he will say the right thing.
Is GETONTHIS the right keyword here? or maybe I mistakenly refer to the xmldialog instead of the NPC himself?
Does anyone know how should I set him up? Much appreciated.
Rocko