Present Reward item successful quest - give gun

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Present Reward item successful quest - give gun

Post by supadupa64 »

I want the NPC to give the player an item for completing a quest. How can I set this up? Is there a tutorial on this?

Does this need to be connected with my third person controller inventory? I assume it would.

But maybe I need to set up some sort of inventory system first?
Last edited by supadupa64 on Sat Apr 02, 2016 11:10 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Present Reward item successful quest - give gun

Post by Tony Li »

Hi,

First make sure you've followed the Third Person Controller Support Player Character Setup.

When the player completes a quest during a conversation -- for example, when the NPC says something like: "Thanks! Here's a pistol." -- use the tpcPickupItem() Lua function in the dialogue entry node's Script field. The TPC Lua functions are defined here.

Unfortunately you can't use the Lua wizard ("..." button) for this. You'll have to type in the command manually into the Script field, such as:

Code: Select all

tpcPickupItem("", "Pistol", true)
The first argument is the character name. If you leave it blank, the player will get the item.

The second argument is the name of the item as defined in TPC's inventory system.

The third argument can be true or false. If it's true, the character (player) switches to the item immediately without playing an equip animation. If it's false, the character plays a complete equip animation before equipping the weapon.

If the player completes a quest outside of a conversation, you can use a Lua Trigger to call tpcPickupItem().
Post Reply