Object conditions.

I’d like to have certain objects be only obtainable by talking to a person about a certain topic, or giving them another certain object.
For example:
A person in the game starts off as wild, but when you bring her the package of chicken she ‘becomes’ tame and you can have her in your inventory and use her as a weapon.
This is the way I’ve coded it, but you can still take the tamed woman even if you haven’t given the wild one the chicken. I am well aware that I have set it up a bit weird. You give the wild woman the chicken, but a completely new ‘object’ comes into your inventory. This is because I needed to code the woman you get as a weapon you can use without the computer getting mad at me.

So, in short, how do you make an item accessible only when ask someone/give someone something particular?

[code]A woman called wild woman is here.
Instead of taking wild woman:
say “[one of]Best not to approach this strange creature, it looks hungry.[or]You should really think about every decision before you make it.[or]Come back later, when you are appropriately equipped.[at random]”.
Before giving package of chicken to wild woman:
move package of chicken to wild woman;
now the player has tamed woman;
say “You hand over the chicken, keeping it a sensible distance from the rest of your body. As soon as the creature has hold of the chicken, you let go. The wild woman swallows it in one go. ‘Ah, very nice. Right on, ta,’ says the wild woman. ‘I might as well come with you.’ You allow the creature to accompany you, but are unconvinced that it has bonded to you because of your kindness.”.

[the player acquired the chicken from another room, comes back, and can give it to the wild woman. stated below in different section of my game are the specifications for the tamed woman, as well as all the descriptions and definitions for damage and health and all that:[/code]
The tamed woman is a woman in Grassy Field. The damage of tamed woman is 20.

The same way that we handled the note in our previous discussion. The item is defined to be nowhere (think of it as offstage) and is moved to the appropriate location once the asking or giving action happens.

You’re headed in the right direction, but there are a few issues with your code:

  • You say “now the player has tamed woman” without ever defining a tamed woman object. You need a statement that defines the tamed woman and places her nowhere. “A woman called a tamed woman is nowhere.” or simply “The tamed woman is a woman.” would do the trick. Edit: after posting this, I see that you have “The tamed woman is a woman in Grassy Field” outside of the code tags in your post, so, it’s not that she’s undefined, but that she’s in the same location as the wild woman instead of being offstage. Another problem is that I7’s type system won’t allow the woman to be both a woman and a weapon (if we define weapon as its own kind). You could circumvent this by including some I6 code, but I think that the whole approach of companion as inventory item is broken – see below.
  • You say “now the player has tamed woman”, but “has” can only be used for testing the current state of the world, not changing the state of the world. “has” means “carries or wears”, so you want to say “now the player carries the tamed woman” instead. See §13.4 of the manual.
  • The wild woman is called “wild woman” rather than “a wild woman”, which may not be what you want, because Inform is more literal about what follows “called” in the definition of an object. See §3.18.
  • Since the wild woman and the tamed woman are meant to represent the same woman, you don’t want both of them in the same place at the same time, so you want to remove the wild woman when bringing the tamed woman into play.
  • Moving the package of chicken to the wild woman is fine, but, since you’re going to remove the wild woman anyway, you can just remove the chicken also.
  • The default behavior after completing a before rule is to continue with the action (in this case, giving the chicken to the woman). As written, once your rule runs, the action processing will go on to try to give the chicken to the woman, but it will fail, because either the woman now holds the chicken (as you originally wrote it) or the chicken and the wild woman have been removed (as I suggested). Since you’re handling everything here in your before rule, you need to stop the action processing, either by saying “stop the action” or by modifying your “say” to be an “instead say”. Another option would be to change the before rule to an instead rule, where the default behavior is not to continue with the action.
  • If you acquire the tamed woman and drop her, you can’t pick her up again, because people can’t be taken by default.

Putting that all together:

The tamed woman is a woman.

The player carries a package of chicken.

Grassy Field is a room.

A woman called a wild woman is here.

Instead of taking wild woman:
	say "[one of]Best not to approach this strange creature, it looks hungry.[or]You should really think about every decision before you make it.[or]Come back later, when you are appropriately equipped.[at random]".
	
Before giving package of chicken to wild woman:
	now the package of chicken is nowhere;
	now the wild woman is nowhere;
	now the player carries the tamed woman;
	instead say "You hand over the chicken, keeping it a sensible distance from the rest of your body. As soon as the creature has hold of the chicken, you let go. The wild woman swallows it in one go. 'Ah, very nice. Right on, ta,' says the wild woman. 'I might as well come with you.' You allow the creature to accompany you, but are unconvinced that it has bonded to you because of your kindness."

Instead of dropping tamed woman:
	say "The tamed woman refuses to leave."

I think that this is a broken way of modeling the situation. It would be better to let her be an NPC that follows and fights alongside the PC. See exercise 39 (Van Helsing) for an example of a character that follows the player around the map.

Thank you, I’ll look into those things :3 It does sound a bit sexist, doesn’t it? The character is actually a person’s name, I just took it out for the sake of discretion. It sounds a bit bad when I read through the example I posted…
(I because the way the rest of thee game was set up I used only part of your code to make the whole thing work without needed a whole ton of changes. Thank you thought :3)

Okay, now the game won’t let me give things to people. The code specifically says that when you give a character the hat, he’s supposed to give you another object.
I am never doing this as a project ever again XD

Grassy Field is a room.

The player wears a tricorne. Understand "hat" as the tricorne.

Euler is a man in the Grassy Field. He carries a curvy dagger. The description of the dagger is "It looks quite functional."

Instead of giving the tricorne to Euler:
	now Euler wears the tricorne;
	now the player carries the dagger;
	say "Euler gratefully accepts the tricorne and hands you a curvy dagger."
	
Test me with "i / give hat to euler / i / x dagger".

If this doesn’t solve your problem, post your code (ideally in the form of a small program that shows the problem) and we’ll figure it out.

That’s not why you’re being discouraged from doing it this way. Inform has a lot of preconceptions about what a person is and what an object is, and what sort of things a person/object can/can’t do. For instance, you can’t put people in your inventory.

Similarly, player’s expectations have similar preconceptions, and taking people would seem to be clunky and hard to get my head around.

It’s generally best to use the best tools for the job, let people be people and let objects be objects. That’s the big issue. Sexism thankfully doesn’t come into it at all.

The day after I posted that advice, I played Pacian’s Superluminal Vagrant Twin and saw that it allows the player to take and drop ship’s crew and passengers. This works, because the world model is coarser-grained and more abstract than usual:

>take aurea
Aurea climbs aboard and slides into the co-pilot's seat. "Okay, let's launch. Unless you want to check your ship's status first."
 
>status
Credit balance: 0k (That is to say: you're broke.)
Equipment: spacesuit (don't need air)
 
Crew:
Yourself, Aurea and Szymon
 
Installed systems:
jump drive (superluminal travel)
 
Fuel:
2/5 fusion cells charged
 
Readable Data:
debt note, flight manual, ship's log and trading log
 
Cargo:
nothing

>drop aurea
Aurea slouches into the co-pilot's seat. "Yeah, you're kinda stuck with me now."

So, I stand by my recommendation in this case (“You are carrying: a tamed woman”), but it’s clear that it can work in the right circumstances.