Login
Remember
IF Answers
Ask a Question

# How do get an NPC's mood to worsen if I give it something it dislikes?

+1 vote
63 views
asked Jun 14 in Authoring by estar23 (6 points)
retagged Jun 14 by Dannii

I'm trying to re-author the giving action. I want an NPC to have a mood that goes up or down, depending on whether you give it something it likes or dislikes, but it will only accept things that interest it.

I can't get to seem the liking/disliking relation to work with kinds of things, i.e. snacks, but I need the apples and kiwis to be kinds of snacks because the player gets them from a vending machine, which can only be coded to bring kinds of things from off-stage.

I'm guessing this is why I can't get the Instead rule to fire?

    The block giving rule is not listed in the check giving it to rulebook.

    A snack is a kind of thing. A snack is always edible.
    An apple is a kind of snack.
    A kiwi is a kind of snack.

    Mood is a kind of value. The moods are hostile, suspicious, indifferent, friendly, and adoring. A person has a mood. A person is usually indifferent.

    To improve the mood of (character - a person):
        if the mood of character is less than adoring:
            now the mood of the character is the mood after the mood of the character.

    To worsen the mood of (character - a person):
        if the mood of character is not hostile:
            now the mood of the character is the mood before the mood of the character.

    To decide whether (item - a thing) interests (character - a person):
        if the character likes the item, yes;
        if the item is edible, yes;
        no.

    Liking relates one person to various things. The verb to like means the liking relation.

    Disliking relates one person to various things. The verb to dislike means the disliking relation.

    Instead of giving something to someone:
        if the second noun dislikes the noun:
            worsen the mood of the second noun;
            say "[The second noun] appears to hate that! [The second noun] is [mood of the second noun]." instead;
        otherwise:
            continue the action.

    Check giving something to someone:
        unless the noun interests the second noun:
            say "[The second noun] disdainfully refuses [the noun]. [The second noun] is still [mood of the second noun]." instead;
        otherwise if the second noun dislikes the noun:
            worsen the mood of the second noun;
            say "[The second noun] appears to hate that! [The second noun] is [mood of the second noun]." instead;
        otherwise if the second noun likes the noun:
            improve the mood of the second noun;
            say "[The second noun] looks happy to receive that. [The second noun] is [mood of the second noun].".

    The Testing Room is A Room. The pawn broker is a person in the testing room. The player holds a rare coin  and a straw dog and an apple and a kiwi.

    The pawn broker likes the straw dog.
    The pawn broker dislikes the kiwi.

    Test me with "give dog to broker / give coin to broker / give apple to broker / give kiwi to broker".

- inform7
- relations
- npcs

## 1 Answer

+1 vote
answered Jun 14 by Joseph Geipel (207 points)
edited Jun 14 by Joseph Geipel

Since "kiwi" is the name of the kind, the phrase "The pawn broker dislikes the kiwi." creates a single generic kiwi off-stage which the pawn broker dislikes: all other kiwis are unaffected. If you want the kiwis to all be identical and all be disliked by the broker, consider:

    Every kiwi is disliked by the pawn broker.

commented Jun 15 by estar23 (6 points)
Thank you so much! I knew the difference between kind and thing had to be the reason, but I could not figure out why.

## Related questions

- How do I give an object to a character and receive something back?
- How do I get the Inanimate Listener to respond to "Computer, hello"?
- How to get rid of a rule that's blocking what I want the player to do? (Inform 7)
- Inform: How do I get the player to input a name for themselves? The name keeps changing to whatever the player typed last!
- How do I keep track of/prioritize bugs? Do I need to fix something right when I see it?

...