Taking objects

Anonymous
29 Apr 2004, 01:20
I can't seem to figure out how to allocate items to characters (that is, putting the character in possession of the item).

I also would like to allow the player to take items from characters.

Does anyone have any ideas?

007bond
29 Apr 2004, 06:57
The only way I know of how to do this is using Al's TypeLib library.

007bond

billchelonis
29 Apr 2004, 07:28
This is easy. The character's inventory believe it or not is actually a room called inventory. Just move the object from #quest.currentroom# to room name "inventory" to "get" an item into the player's inventory, or move it out of room "inventory" and into #quest.currentroom# to "drop" it. You do not need to actually create a room in your game called "inventory" to do this. It's a built-in room object. (Found this info basically in the help files somewhere in the QDK I think). In the QDK you probably will have to manually type in the word "inventory" as I don't think it shows up in the pulldown pick list as an actual room, even though it is a room.

Or in the QDK there is an inventory selection category for giving and taking items to/from the player.

Anonymous
29 Apr 2004, 13:45
Thanks for that. I'll try it out when I get the chance.

If I understood it correctly, that allows me to take an item from a character's inventory and drop it into the player's. This is good. But how does the player know that the item is there?

billchelonis
30 Apr 2004, 03:12
Oh, to have a non player character (NPC) with an inventory, just create a room by itself somewhere and use that to store the NPC objects. Then you can loop through the room objects to list the inventory, etc.

In the QDP the script command editor window has a section called "Game Control" and when you expand that section there is a selection to "Run a script for each object in a room." Click that and select the room name that you're calling your NPC inventory. Then you could do whatever... like a print statement with #quest.thing# to list each item in the room (i.e. inventory), or check if #quest.thing# is equal to the object you're looking for. (By the way #quest.thing# is not a made up name. It's the pointer you would always use in a room loop to reference the current object in the list).

The other way to do this of course is in a customized array, but that's kind of messy (in my opinion) when you can just use a room object and all the built in functionality that goes along with room objects.

And if you do a customized get or put command to move objects from an NPC to the player, to notify the player that you did it you just do a print statement (i.e. MSG <whatever>) like:

#(NPC_name):prefix# #@NPC_name# gave you #(quest.thing):prefix# #@quest.thing#

I think Im Dead
03 May 2004, 01:56
I was just going to post about you all being ignorant young pups but that was answered rather well, bill. It also might help to notice that in multiplayer Quest games player objects function a bit differently, acting as a room object and a player object. To give a player in an item in a multiplayer game you would MOVE the #OBJECT# TO <player%userid%> which will fill in %userid% with the players ID number, and this automatically refers to the player object they are in control of.

WORD OUT!!1