Full Version : GIVENAMED
xmlspawner >>Q&A >>GIVENAMED
<< Prev | Next >>
oak- 01-30-2006
Simple fetch/delivery quests.
Suppose I want give a player a "delivery" quest. QuestNPC asks if the player wants the quest, then gives the item to him and tells the player the name/town of the NPC.
Could you should an example of that?
I have played around a bit with this but to no avail. The NPC I'm trying to give an item TO is a regular NPC, not a QuestNPC...but I did try with a QuestNPC as well.
ArteGordon- 01-30-2006
the syntax for the GIVE quest objective is
GIVE,mobname,itemtype[,count][,proptest]
or
GIVENAMED,mobname,itemname[,type][,count][,proptest]
just specify the name of the npc as well as the name or type of item to be given.
Take a look at the Katar quest example in xmlextras. It uses the GIVENAMED objective.
oak- 01-30-2006
Here is a very simple quest...it seems to me it should work. I am able to accept the quest but I cannot "give" the item to the NPC blacksmith named "Arley". It just returns to my backpack. I"m doing something wrong...

CODE
<?xml version="1.0" standalone="yes"?> <XmlQuestNPC> <NPC> <Name>Bente</Name> <Running>True</Running>
<ProximityRange>3</ProximityRange>
<AllowGhost>False</AllowGhost>
<SpeechPace>10</SpeechPace>
<ResetTime>1</ResetTime>
<ConfigFile>givename1</ConfigFile>
<SpeechEntries>4</SpeechEntries>
</NPC>
<SpeechEntry>
<EntryNumber>0</EntryNumber>
<ID>0</ID>
<Pause>1</Pause>
<PrePause>-1</PrePause>
<LockConversation>True</LockConversation>
<AllowNPCTrigger>False</AllowNPCTrigger>
<SpeechStyle>Regular</SpeechStyle>
<SpeechHue>-1</SpeechHue>
</SpeechEntry>
<SpeechEntry>
<EntryNumber>10</EntryNumber>
<ID>10</ID>
<Text>Hello</Text>
<DependsOn>-1</DependsOn>
<Pause>1</Pause>
<PrePause>-1</PrePause>
<LockConversation>True</LockConversation>
<AllowNPCTrigger>False</AllowNPCTrigger>
<SpeechStyle>Regular</SpeechStyle>
<SpeechHue>-1</SpeechHue>
</SpeechEntry>
<SpeechEntry>
<EntryNumber>20</EntryNumber>
<ID>20</ID>
<Keywords>hello</Keywords>
<DependsOn>10</DependsOn>
<Pause>1</Pause>
<PrePause>-1</PrePause>
<LockConversation>True</LockConversation>
<AllowNPCTrigger>False</AllowNPCTrigger>
<SpeechStyle>Regular</SpeechStyle>
<SpeechHue>-1</SpeechHue>
<Gump>GUMP,Bente,3/Will you deliver a smith hammer to Arley?</Gump>
</SpeechEntry>
<SpeechEntry>
<EntryNumber>30</EntryNumber>
<ID>30</ID>
<Action>GIVENAMED/Arley/smithhammer</Action>
<Condition>accept</Condition>
<DependsOn>20</DependsOn>
<Pause>1</Pause>
<PrePause>-1</PrePause>
<LockConversation>True</LockConversation>
<AllowNPCTrigger>False</AllowNPCTrigger>
<SpeechStyle>Regular</SpeechStyle>
<SpeechHue>-1</SpeechHue>
</SpeechEntry>
</XmlQuestNPC>

ArteGordon- 01-30-2006
your quest npc that receives the item has to be derived from either the TalkingBaseVendor, TalkingBaseCreature, or TalkingBaseEscortable classes (like the XmlQuestNPC). The XmlQuestNPC is a generic npc that is typically what is used as a quest npc in these cases, but if you really want a specific vendor type as a quest npc, you can define one like the TalkingJeweler.cs example that is included in the XmlMobiles folder.
oak- 01-31-2006
Ok, that is what I was wondering. I imagine it would be possible to modify the BaseVendor class to suit as well.
ArteGordon- 01-31-2006
that is basically what the TalkingBaseVendor class is, just the standard BaseVendor with the additional quest npc support added.
oak- 01-31-2006
Thanks Arte, I was "guessing" that was the case but hadn't got around yet to comparing the two.
There should be a way for me to do an "upgrade" on existing ones...if not, it isn't a big deal since this is just in "pre-alpha" dev/brainstorming phase and a clean shard. Oh, my basic plan is to offer a lot of "vendor quests" that could be gradiated in complexity depending on skills/fame-karma levels/etc. I could do the same sort of thing with Guard NPCs probably...just adjust the baseguard script so it also has the talkingbasevendor capabilities. Of course, I want my guards to be able to follow patrol patterns and such as well so I have a lot of fun work to do!
I just need to get past this initial learning curve of how the xmlquests work. I still can't get a talkingbasevendor type to accept the smithhammer from that simple quest I posted earlier.
ArteGordon- 01-31-2006

QUOTE
<SpeechEntry> <EntryNumber>20</EntryNumber> <ID>20</ID> <Keywords>hello</Keywords> <DependsOn>10</DependsOn>
<Pause>1</Pause>
<PrePause>-1</PrePause>
<LockConversation>True</LockConversation>
<AllowNPCTrigger>False</AllowNPCTrigger>
<SpeechStyle>Regular</SpeechStyle>
<SpeechHue>-1</SpeechHue>
<Gump>GUMP,Bente,3/Will you deliver a smith hammer to Arley?</Gump>
</SpeechEntry>
<SpeechEntry>
<EntryNumber>30</EntryNumber>
<ID>30</ID>
<Action>GIVENAMED/Arley/smithhammer</Action>
<Condition>accept</Condition>
<DependsOn>20</DependsOn>
<Pause>1</Pause>
<PrePause>-1</PrePause>
<LockConversation>True</LockConversation>
<AllowNPCTrigger>False</AllowNPCTrigger>
<SpeechStyle>Regular</SpeechStyle>
<SpeechHue>-1</SpeechHue>
</SpeechEntry>

you need to change a few things here
<Condition>accept</Condition>
you want to enter the string "accept" into the Keyword field, not the Condition field. The Condition field will always look like a test of some sort
property=value
or
property>value
etc.
In your entry #20, when you pop up the gump, when the player presses the Accept button it will generate the speech keyword "accept", so that is what you want to test for in entry #30
Then, for the Action, what you want to do is to give out a questholder with the objective1 property set to
GIVE,Arley,smithhammer
if you wanted to give a named item to the mob, then you would use the GIVENAMED objective like
GIVENAMED,Arley,Hammer of Doom
You would do this with an action string like
GIVE/<questholder/objective1/GIVE,Arley,smithhammer>
Notice that the GIVE keyword at the beginning is used to give the item to the player. This is not related to the GIVE quest objective.
oak- 02-01-2006
Ahh, ok, I was soooo confused! (imitates Vinnie from Welcome Back Kotter)
This works nicely then as an action. Adds the questholder in a hue, named, a title string and notestring, automatic reward of a couple items in a bag that is placed in players pack and it can only be done once.

CODE
<Action>GIVE/&lt;questholder/autoreward/true/canseereward/false/repeatable/false/name/Delivery/hue/1151/titlestring/Can You Dig It?/notestring/Deliver a shovel to Arley/objective1/GIVE,Arley,shovel/rewardstring/@bag/ADD/&lt;gold,2000&gt;/ADD/smithhammer&gt;</Action>

Thanks!
ArteGordon- 02-01-2006
yep, looks good.