Giving an object to a character

Brian5757
17 Mar 2020, 00:21

How do I display that a character is holding an object during game play?

Can a character be carrying objects at the start of the game?
I also tried to drag a comb object to Mary in the Quest tree (left of screen) but there is no display of the comb on Mary when playing the game. The only way I've found is to make Mary a container but then Quest says Mary is 'containing' a comb rather than 'carrying' the comb.
I have not found a way to take the comb from Mary.
Is there a test to see if the character is holding an certain object?


mrangel
17 Mar 2020, 01:35

As far as Quest is concerned, there's no difference between a character and any other object. They're just objects. To have her carrying something, make her a container. You can edit the message to say "carrying". A transparent container lets the player see what she's carrying; an open container lets them take things from her (though you'd probably want to add an addscript, to make player commands like "put key in mary" give an error)


Brian5757
18 Mar 2020, 01:02

Hi mrangel
'Give book to Mary' seems to work, rather than 'put book in Mary'


mrangel
18 Mar 2020, 02:07

Different things; the give command is designed for NPCs. But if you make her a container so that the player can take her stuff, you need to remember to stop the player putting stuff in her.


XanMag
24 Mar 2020, 13:29

Also consider another option (because I’ve had shit luck with containers):
If the NPC typically only carries a couple objects, I simply change the look at description using flags. You’d also have to change ask (for) scripts, take scripts to accommodate for the objects that NPC may or may not be holding.


Forgewright
24 Mar 2020, 23:49

I use this in the room description:

if (mary.parent = player.parent) {
  msg ("Mary is standing here. Blah Blah.")
    if  ( comb . parent = mary) {
       Msg ( " She is carrying a comb.")
   }
}

you can get the game to show she has the comb after giving it to her with a:
ShowRoomDescription
at the end of the "give" script.

Not an expert but it works for me 😉


Brian5757
25 Mar 2020, 04:30

Thanks Forgewright.

That would give a more natural message than what Quest gives.