I don't really have an example handy, but I can give you a description of how things work in the game.
There are several different ways to handle this, and the different aspects can be handled differently.
a. Giving out individual items.If you want the character to give a specific, individual item, the usual approach is to put that item into the character's inventory through the Items property in the
sidebar. In Story, you can then add the item and a custom flag to the
DB_GiveItemToEvent(_Item[/b], [b]_Flag[/b]) database. By setting the [b]_Flag in your dialog, you can have the item moved to the player.
This has the advantage and drawback that, because the item is in the character's inventory, the player can pickpocket it. This is an advantage because it adds options for the players, but a drawback because it isn't, generally, safe to assume the character has that item. You can, however, use a flag defined in the
DB_HasStoryEvent(_Item[/b], [b]_Flag[/b]) to check in the dialog.
There is another way to handle this, which I will discuss in the following section.
[b]b. The quest reward screen.
You have likely seen the quest rewards that appear in a pop-up screen when you finish quests. These are added as
treasure tables through the journal.
You start by putting the intended rewards into two treasure tables - one of which all items will be given to the player, and one from which the player will be able to select one or more additional objects.
It is also possible to add unique items to these treasure tables instead of the previous method for giving unique items.
These rewards are then handed by defining a specific entry in the corresponding journal, and filling in these two treasure tables in RewardTreasureTables and RewardOptionalTreasureTables. RewardTreasureOptionalCount determines how many of the optional treasure table's items the player can pick.
Then you add these to the
DB_QuestDef_QuestReward(
_QuestName,
_UpdateName,
_Flag); Story database and set the
_Flag to give the reward.
c. Giving gold.You can use the
DB_DialogMoneyTransfer helpers to transfer gold to and from NPCs, but it's also possible to just add gold to the aforementioned rewards tables.
There's also the
ProcAddGoldToMagicPockets procedure if you want to directly add gold to the players rather than use the existing helpers for some reason.
d. Giving experience.Although it is possible to add experience from Story, the usual way to give experience is to set a '
Gain' and '
Act' in the quest-completing journal update, where
Act is the expected level of the quest and
Gain is the percentage of the next level which the player should get upon getting that journal update.