Placing an Object in the Character's Hand

Questions about how to create your own dungeons and replacement graphics and sounds.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Placing an Object in the Character's Hand

Post by DM_Player »

In the dungeon I'm working on, I'd like to have locked chests as well as normal chests. Each locked chest could be unlocked with the correct key.

I thought you might be able to do this by cloning a normal chest, changing it's bitmaps a bit, not allowing it store anything, and call it a locked chest. This does result in an object that looks and acts like a locked chest, i.e, no inventory screen opens. Using ACTION_COMBINE, I then combined the locked chest with the key and created a normal chest in the character's hand on the combine event (or equivalently creating some other unique object in the hand and doing a global swap). All of this works, but it's not quite what I was looking for :(

Doing it this way puts an empty chest in the character's hand. I'd like the chest to contain both some valuables (which is why it's locked of course :) ) and the key used to unlock it.

So far, I haven't been able to come up with a way to do this.

Any suggestions would be appreciated.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

Not possible using COMBINE.

The only way to get items into a chest is to place one in the map and edit it to contain the items, as normal. So you'll need to find a way of getting that specific chest into the player's hand. I'm off to bed now and can't look at this now, but that clue might help you out...

By the way, I don't think you meant this line did you?:
DM_Player wrote: I'd like the chest to contain both some valuables (which is why it's locked of course :) ) and the key used to unlock it.
Not logical....! How do I get the key if it's already locked in the chest.....? ;-)
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Gambit,

Yes, I meant it.

The way I was trying puts an empty chest into the character's hand after the combine operation. I would like an unlocked chest placed in the hand and that chest would have items, including the unlocking key, in it, i.e., I don't want the key destroyed. The unlocking key could also be put back into the character's inventory rather than the chest, which might even be the better way but brings up another question -- How do you put something from the dungeon into a character's inventory?

I too thought that the only way to have a chest with specific items in it is to place a chest with the items already in it in the dungeon somewhere and then get that chest into the character's hand, but I was at a loss on how to do this either.

This would be very easy if when a chest is cloned you could put objects into it to begin with, but you can't and since GG is on indefinite hiatus it doesn't appear that you ever will be able to do this.
User avatar
Trego
Artisan
Posts: 174
Joined: Tue May 26, 2009 2:03 pm
Location: Brunei

Re: Placing an Object in the Character's Hand

Post by Trego »

DM_Player wrote: I too thought that the only way to have a chest with specific items in it is to place a chest with the items already in it in the dungeon somewhere and then get that chest into the character's hand, but I was at a loss on how to do this either.
One way would be to use a teleporter on the chest location, have the combine action activate the teleporter, the teleporter will be targeted at the 'party tile', a special tile. This will place the newly unlocked chest on the floor, orientation may also be important if you want the chest to turn up behind you. The 'move object to hand/mouse' actions could be used but may cause problems if you are already holding something in the mouse.
It's not a bug in the program, I've just gone and done something weird.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

I think it's possible to get the chest into the hand using some clever mechanics, I'll investigate it sometime this week for you. But in the mean time, I think Trego's solution is a good one: teleport a filled chest to the party tile and destroy the key and fake chest in the player hands on your COMBINE action.
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Thanks Trego,

It's an interesting suggestion,
Trego wrote:the teleporter will be targeted at the 'party tile', a special tile.
I created the 'party tile' and then teleported the chest to the 'party tile' but then how can you pick up the chest? It appears that the chest isn't really on the tile that the party is located at. The engine just displays a picture of it in that location. So, if you try the action ACTION_PICKUP_OBJECT_TILE nothing is picked up because there isn't really on object on the tile.

I was able to partially implement your suggestion giving the teleporter mechanic an x,y,l destination. However, when I picked up the teleported chest from the tile, the chest is put into the character's inventory, not a hand. I've been trying various swap actions, but so far none seem to be able to place an object into a character's hand.

Again, all suggestions are appreciated.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

Oh yeah, good point about Party Tile, you'd actually need to teleport it to one tile ahead of the party. Which is impossible as RTC can't do that, there's nothing in the dungeon creation tools that allow you to "know" where the party is.

In my work in progress game, I have chests underneath tables. You can click on them and they go in to the player's hand. The chest is actually a flooritem (like a floorgrate but with different images) and has a Click event set on it. From memory, I can't remember how I got it to work, but I recall I used swaps and teleports. I'll check out the file later this week and let you know.

EDIT: Was curious enough to have a look right now. I have the fake chest in the normal dungeon and then a real chest hidden in a 1x1 room somewhere. The hidden chest sits on a disabled trigger. My fake chest (which is a flooritem, not a normal item) has a Click event on it that activates the disabled trigger.

The disabled trigger is set to activate a relay which does the following:

1) Destroy the fake chest
2) Do action MOVE_ITEM_TO_MOUSE

I thought this was all fine, but actually I just tested it and realise it doesn't work propelry if i click on the chest with somehting else in the mouse hand. The chest just disappears. :-(

Looks like all this is problematic...
User avatar
zoom
Grand Master
Posts: 1819
Joined: Tue Sep 23, 2003 1:27 am
Location: far away but close enough

Re: Placing an Object in the Character's Hand

Post by zoom »

I do not want to sound like an ass, but maybe DSB would be something for all of you.
It is sad
you try to accomplish this or that with all kinds of tricks and turnarounds but in the end it tends to get complicated, difficult or in the worst case (this one) just does not work.(maybe you will find a way, still!)

Also sad for all the work GG put into RTC already, next to e.g. Gambit. If it were continued..
Sorry but this is only my opinion I will say no more
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

The point is that a designer chooses a tool that most suits them. RTC suits me better than DSB, that's all. True, RTC has limitations, but it's still powerful enough for all sorts of complex stuff; this particular example of a chest is perhaps harder to do, and maybe impossible, but half the fun is also working out ways of achieving the effects you want.
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Placing an Object in the Character's Hand

Post by Paul Stevens »

but half the fun is also working out ways of achieving the effects you want.
I have noticed that this is very often the case. Dungeon
Craft (A Forgotten Realms; Unlimited Adventures clone)
is another example. We have provided easy ways to do
things that were difficult in the original yet many people
keep right on using the original with its complex patches
and hacks and seem much more interested in displaying
their cleverness in getting around the limitations than
they are in producing an interesting game.

That is not a problem. But as a programmer this observation
makes me sometimes hesitant to put effort into tools
and capabilities that people demand. Often they only want
to gripe about the difficulties so that their convoluted solutions
will seem more brilliant. And they will forever resist the
new tools for some reason or other.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Placing an Object in the Character's Hand

Post by beowuuf »

The trouble also is that the more tools you get, the more you want to do. People who were building dungeons in Dm wishing for things would now be able to do them easy with the tools in CSB or RTC. However, then I suspect the imagination stretches to wish to do other things. It might be the nature of human creativity to wish for exactly what is in our minds, and also to keep wanting to go beyond perceived boundaries.
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Gambit37 wrote:...there's nothing in the dungeon creation tools that allow you to "know" where the party is.
Of course RTC does keep track of where the party is, and you can know this in string form using %LOCATION_X%, %LOCATION_Y%, %LOCATION_Z%. However, you can't use these strings as arguments in the teleporter mechanic. The mechanics arguments have to be 8-bit integers. There might be a way to convert the strings to counter values using relays, but I'm not sure this would help, as I don't know if the teleporter mechanic can accept variables for the arguments or if it has to be integers.

In my dungeon, I do sort of keep track where the party is using triggers and counters now. I always know what level the party is on and I also know what area of the level they are in (I have divided each level into areas). I do this via triggers and counters. It might be possible to actual keep track via counters of the x,y,l coordinates by using the appropriate triggers, relays and counters on the 'Party_Tile'. I may have to try it, but unless the teleporter mechanic can accept variable arguements, it won't help in the problem I'm trying to solve :cry:
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Placing an Object in the Character's Hand

Post by beowuuf »

How robust are the monster picking up/death mechanics? You could have a completely stationary /indestructable monster (that can be picked up). I wonder if you can 'kill' the chest with the key, and have it drop the opened chest?
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Beo,

Thanks for the suggestion. This is the type of thing that I would never think of or try on my own. But still, I'm not sure how this might work.

Wouldn't the fake 'monster' have to be able to be put in a character's inventory? Since a player would find the locked chest in one location and the key to unlock it in a different location, there would probably be some period of time when the locked chest is in inventory before it is unlocked. Can a 'monster' be put in inventory?

Assuming a 'monster' can be put into inventory, then when the unlock attack occurs and the monster is killed, the monster would drop the unlocked chest on a tile wouldn't it? It still wouldn't put the unlocked chest into the character's hand.
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Placing an Object in the Character's Hand

Post by beowuuf »

I remember a while back asking for a 'clickable' monster, and I think GG did that. Never quite worked out the mechnaics myself, althoguh I believe he did do the bonsai screamer in a cage in the example dungeons.

I think expliring monsters can trigger items. can't they? Can't you, know the monster dies on the party's square, use one of the commands to move an item from the floor to the party hand?

Sorry, been a while since I used RTC, I forget some of the operations.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

I just checked how I handle a special mechanic in my new dungeon. I need to be able to test what item was in the player's hand when they clicked a static monster. However, you can't click a static monster with another item as the item gets "thrown".

So I also created a flooritem, transparent, bigger than my monster and clickable -- and it's placed in the dungeon on the same square as my static monster. The player can click on the monster, and the click is intercepted by the transparent flooritem.

This flooritem has its Click event matched and uses ACTION_OBJECT_ACTIVATE to send the message to a relay that checks the Party condition using the OBJECT_IN_HAND setting. In this way I can test what item was in the player's hand when they clicked the monster/transparent flooritem.

I think some variation of this would work for what you want to do: you can test if the right key is in the player hand when they click on a chest on the floor (you won't be able to pick it up as it's not a real chest, just a flooritem) then do some other mechanics that destroy this fake chest and teleport in a new open chest full of items.

I really don't think there is a way that you can do this with a normal chest that you can put in the player's hand.
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Gambit,

I don't think this would work as I envision the game play. Within the game, the chest and the key would be in different locations. I think a player would typically pick up and put each item into inventory as they found it, and then try and unlock the chest once they have both the key and the chest. What you are describing would force the player to either find the key first, or remember where the chest was and return to it once they find the key. I guess it would be sort of like when you find a locked door and later on find the key.

lbk sent me a different idea in a PM that mostly works. The way he approached the problem was to teleport the party to the unlocked chest, rather than try and teleport the unlocked chest to the party. You can do this by:

- creating the locked chest, key and attack methods as usually done
- using the attack method to activate a relay sequence
- the sequence creates a marker where the party is, teleports the party to where the unlocked chest is, picks up the chest, teleports the party back to the marker and destroys the marker

It works, but there are still two problems with this method.

When you pick up the unlocked chest, it's put into inventory, not the character's hand. Although not quite what I would like, this would be okay, as you could generate a message saying that the chest was unlocked and put into inventory.

The potentially bigger problem is that in order for the chest to be picked up and placed into inventory, there must be a free inventory slot. Otherwise, all the teleporting happens, the key is destroyed and the player doesn't get the chest.

The method would work great, if only I can come up with a way to place the unlocked chest into the character's hand, rather than into inventory (the key and locked chest that were in the hands were destroyed, therefore the hands must be empty).

So with this method, I'm still stuck with my orignal question -- Is there a way to place an item in the dungeon into a character's hand?
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

I think you're making this way too complex for yourself. ;-) Those chests are massive and it was always pretty silly that you could put them in your backpack anyway. I'd personally prefer that chests remain on the floor and do indeed require the player to find a key: that would be pretty normal in the real world. ;-) Lands of Lore had immovable chests like this.

Anyway..., I know that's not what you want. ACTION_MOVE_ITEM_TO_MOUSE will move an item to the player hand, but only if it's already empty. I think you might be able to force the hands to be empty first by doing some kind of SWAP_HANDS to a NULL item.

ACTION_MOVE_ITEM_TO_MOUSE takes no parameters. Simply put your chest on a hidden tile with a deactivated trigger on it. Your unlocking sequence should finish by activating this trigger. The trigger should activate the ACTION_MOVE_ITEM_TO_MOUSE -- this works by moving any item on the tile where the trigger was placed, so this automatically moves the chest to the mouse (cursor).

In LBK example, how do you handle the environment changing during the teleports? Doesn't that look very strange!?
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Gambit,

Thanks. Although not exactly what I was trying to do, getting the unlocked chest into the mouse is close enough. It does need a relay to first check to see if the mouse is holding an object. If it is, then the combine event can be prevented and the player can be told to either drop the object or put it into inventory before trying to unlock the chest. It would be more elegant to have the unlocked chest simply replace the locked chest in the characters hand, but this just doesn't appear to be possible. So, as I said, this works and it's close enough.

I had tried to use the ACTION_MOVE_ITEM_TO_MOUSE but had no clue how to give it any object arguments. Is it documented somewhere that a trigger with the object on the trigger must be used? I searched this forum earlier and didn't see anything about this, and the wiki doesn't give any information on this action. It would be great to have this information on the wiki, but I know that takes time, which everyone is short of.

lbk's teleport suggestion works fine. Since there are no delays involved in anything that's happening, for all practical purposes everything happens instaneously. The player has no clue that the party is moving from location A, to location B and back to location A again and the display never has time to show any change in the party's environment.

Thanks everyone for all of the great suggestions. I think this issue can be considered pretty much solved :D (but if someone does know how to actually put a dungeon object into a character's hand, I'd still be very interested in knowing how its done).
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Placing an Object in the Character's Hand

Post by Gambit37 »

Glad you got it working. :)

Movement actions (plus a lot of other actions too) are performed based on the actual trigger that activated it, and this info isn't commonly known. So actions effectively "read" the trigger to use that as a kind of parameter: the trigger tells the action what items to affect. This doesn't apply to all actions, but you should certainly bear this in mind ;-)
User avatar
Lord_BoNes
Jack of all trades
Posts: 1064
Joined: Mon Dec 01, 2008 12:36 pm
Location: Ararat, Australia.

Re: Placing an Object in the Character's Hand

Post by Lord_BoNes »

Just put up a new tutorial about "unlockable chests"... sounds like what you wanted :P
 
Image

1 death is a tragedy,
10,000,000 deaths is a statistic.
- Joseph Stalin

Check out my Return to Chaos dungeon launcher
And my Dungeon Master Clone
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Lord_BoNes,

Interesting .... but, it really doesn't make sense to have a locked chest that just doesn't display the inventory screen. If a player happens to click in the inventory screen area of the "locked" chest (even though it is showing the food and water level graphics), then they can still get things out of the chest's inventory, or put things into the inventory for that matter. This type of illusion, although it might work, wasn't what I was looking for.

It was interesting that you were using the equip function of the key to cause some actions to occur. I hadn't considered this.

It's been awhile since I worked on this part of my dungeon. I'll have to re-aquaint myself with it and see if equiping the key might have some benefit to what I'm trying to do.

In the end, I think I'm still stuck on my original question -- Is there a way to put an object from the dungeon into a characters hand?

Thanks for taking a look at this.
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Placing an Object in the Character's Hand

Post by Sophia »

DM_Player wrote:Is there a way to put an object from the dungeon into a characters hand?
I was going to suggest ACTION_PICKUP_OBJECT_TILE, because that used to work. In fact, my dungeon Dark Portal used that very method to include a scroll that seemed to change text in your hand. However, that was made for version 0.38 or so, and it seems like you've already tried that method and it didn't work. Somewhere between that version and the current one, ACTION_PICKUP_OBJECT_TILE's behavior was changed (or it might be better to say broken, depending on how you want to look at it) so that it goes to the inventory instead of the hand. So the answer seems to be "not any more."
User avatar
Chaos-Shaman
High Lord
Posts: 2642
Joined: Wed May 03, 2006 7:26 pm
Location: The Gates of Hell

Re: Placing an Object in the Character's Hand

Post by Chaos-Shaman »

this seems solved already but....
maybe a key that is equipped in one hand (that swaps out to the key that opens the chest with a menu when equipped), then the chest is equipped in the other, when both conditions are met then use the key actions to swap out chest to correct chest with items. both key and chest must be in hands, two conditions. more the conditions the merrier.
The 'move object to hand/mouse' actions could be used but may cause problems if you are already holding something in the mouse.
I am still looking for a way to check mouse if it is empty, or hands if they are empty. if we can do that, then we can create a condition for it. I'd really love to know this one.
keep your gor coin handy
User avatar
DM_Player
Adept
Posts: 219
Joined: Sat Feb 13, 2010 2:37 pm
Location: USA

Re: Placing an Object in the Character's Hand

Post by DM_Player »

Not sure about how to check hands, but to see if the mouse is empty use a relay with parameter 1 set to PARTY - OBJECT ON MOUSE, operation EQUAL TO, and parameter 2 set to OTHER - NULL.
Maybe you could check hands by setting parameter 1 to TRIGGERING - MEMBER_OBJECT_ON_HAND_LEFT (or RIGHT) instead, but I've never tried it.
User avatar
Chaos-Shaman
High Lord
Posts: 2642
Joined: Wed May 03, 2006 7:26 pm
Location: The Gates of Hell

Re: Placing an Object in the Character's Hand

Post by Chaos-Shaman »

yes, since you told me about the null, should have know it, but since then I have made good use of it. it was a big help to me. I thank you tremendously for that helping fact. it's pretty much necessary for what I have been doing with the ai, and i have you to thank for getting rid of that block.
keep your gor coin handy
Post Reply