Giving NPC items?

Started by Lazarus, Tue 26/07/2005 18:08:34

Previous topic - Next topic

Lazarus

Hi ...

I hope I am posting this in the right place as I can't find any help on this question ..

I am at the point in my game where my character has several items collected in their inventory to give to a NPC.  These items can be obtained/given to the NPC in any order and at any point during the game.

The problem I have is where to start!

Sorry if this is a stupid question but I am lost with what I guess I need to do, which is ..

Add under the NPC a "conditional" command for each item saying to "display a message" telling the player it is an item required etc.

I don't know how to script the game so that the NPC is aware when he has all of the items to trigger a "final congratulations you have it all dialog"?

I would also like to count down how many items to go when the playing character gives the NPC an item he is after ... for instance saying "3 items to go ...", "2 items to go ..." etc.

I apologise if someone has already covered this but after trawling the forums for what seems like days I have not found the solution ..

With much hope and thanks ...
*Currently using AGS Editor 2.70 (Build 2.70.601)*

Bernie

#1
There's many ways. You could use a global integer and add 1 to it when you hand over an item. You can run a check if it's 3 and make him say something when it is.

You could as well use a global variable, or add the items you handed over to the NPC's inventory and check which ones he has.

Check SetGlobalInt() and GetGlobalInt() in the manual, and alsoÃ, Character.AddInventory(), Character.LoseInventory() and Character.InventoryQuantity[] in the manual for details.

Pumaman

This sort of thing is probably too complicated to do with the interaction editor -- you'll need to write a script instead.

Have a read of the scripting tutorial and look up the commands Bernie suggests in the manual, and then feel free to post if you have any specific questions.

Lazarus

I would like to thank you both for your replies.

I will have another look at the scripting editor and post if I have further problems.

Alternatively, I will also take on board the global integer.

Thanks again
*Currently using AGS Editor 2.70 (Build 2.70.601)*

SMF spam blocked by CleanTalk