Page 1 of 1

Present Reward item successful quest - give gun

Posted: Sat Apr 02, 2016 4:51 pm
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?

Re: Present Reward item successful quest - give gun

Posted: Sat Apr 02, 2016 11:06 pm
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().