Full Version : Problem with setting a condtion on a NPC
xmlspawner >>Q&A >>Problem with setting a condtion on a NPC


<< Prev | Next >>

Xerrox- 08-21-2006
Heya i am new to all this but learning fast
I am making a quest where a xmlquestnpc is selling a appel to a player for 50 gold coins, but i can't get the npc to check if the player actualy have 50 gold coins to buy the appel for.
I have no problem cheking for items if they are named [get name and the name ain't -null- but as soon it's null as gold by default is, i get no response what so ever.
I am using a line in the Condition box that looks like this to test it on a named apple
GETONCARRIED,apple,Visible=true
This works
with the cold coins i imagine something along the line of
GETONCARRIED,gold>50,Visible=true
But with no luck so far

Any help is more than welcome

ArteGordon- 08-21-2006
You could use a condition test something like this

GETONCARRIED,,gold,amount>50

that would check for a stack of gold with an amount over 50, but it would not properly handle the condition where they had multiple stacks of gold with different amounts.

To get around that you can use the AMOUNTCARRIED keyword like this

QUOTE

- added the new "AMOUNTCARRIED,itemtype" keyword that will return the total amount of the specified type of item being carried in the backpack of the triggering mob.  You can use this to test for carried items like

IF/AMOUNTCARRIED,gold < 100/33

or add it to a Condition field in xmldialogs or in a triggering condition test on spawners

AMOUNTCARRIED,bandage>100


You could also try to TAKE what you want, and then test to see if you got it.

QUOTE

- added the new "TAKEN" keyword, which can be used wherever an item keyword like ARMOR could be used.  It will refer to the most recent item obtained via the TAKE or TAKEBYTYPE keyword.  This allows you to take items and then test properties on them, manipulate them, give them back, or even spawn them.
For example, to take some gold and then test to see if you actually got the proper amount, you can do

1 TAKEBYTYPE,1,100,false/Gold
1 IF/GETONTAKEN,Amount < 100/33/44
2 GOTO/1
33 SAY/Sorry, you do not have enough gold
33 GIVE/TAKEN
44 SAY/Very good. Here is your armor
44 TAKEN/DELETE
44 GIVE/ARMOR,1,2

ArteGordon- 08-21-2006
and the reason this didnt do anything

QUOTE

GETONCARRIED,gold>50,Visible=true


is that the syntax of the GETONCARRIED keyword is

GETONCARRIED,itemname[,itemtype],property

so you were referencing the Visible property on an item named "gold>50" and checking to see if it was true.

This line

GETONCARRIED,,gold,amount>50

checks the amount property on an item with a null name and a 'gold' itemtype and checks to see if it is greater than 50

Xerrox- 08-21-2006
Thanks alot that worked except i have to check for 49 gold coins instead of 50, minor detail, man i have been trying evrything
Thank you so much

Allmight- 08-21-2006
No, you dont have to check for 49 to see if they have 50 gold. Just do the following...

CODE

GETONCARRIED,,gold,amount>=50


That will check if it is larger or equal to 50.