So i’m trying to make a game where your taking care of characters, and i was wondering what the best way to do this would be and thought a mood would be a good idea, depending on the items you put in there it increases the mood and unlocks scenes. I’m pretty new but i was wondering the best way to do this would be, is there a command i’m missing or maybe an extension the massively simplifies this like a NPC tool?
There are a few different ways to handle this, and some examples for each of them.
For some ideas on how to track what items are in or not in the room and have people react to it, here’s an example where a woman gets sad about items which were taken out:
This is one for having a big list of emotional states and assigning them to people based on other’s actions:
I personally don’t like making games unless I can add a number to things and watch it go up and down. So you could assign a happiness score to a person and increase it or decrease it. Some ways to assign and change numbers to people are in this example:
But what do you personally want to do? That’s what matters the most. Have you made like a design document or flowchart in non-programming words that describes the steps you want to have happen?
Just to clarify: Do you want the NPCs to have individual moods? Your question seems to be about characters, but also a room?
To design the concept of mood, you will need to create a new kind of value. If you’re not familiar, a “kind” is like a category which objects can belong to and which you can write special rules for. e.g. an herbivore is a kind of animal. Kinds can inherit rules from each other, e.g. an elephant is a kind of herbivore.
A “kind of value” is a property like weight, strength, or mood. You can write rules for this property, and objects in your game can have it.
For more on kinds, try the chapter on them in Writing with Inform.
An example way of setting up the mood concept might go something like this:
Mood is a kind of value. The moods are miserable, listless, indifferent, attentive, ecstatic, and satisfied. A person has a mood.
The choice of mood words here was arbitrary, the point is that people can now be miserable, ecstatic, etc, and rules can be written to adjust their moods. The order I chose was less arbitrary, from most negative to most positive. Having them in this order means it’s possible to increase or decrease a character’s mood programmatically. The more you increase, the more positive the character feels. If that’s not important to you, then it doesn’t matter which order you declare the values in.
The only mood extension I know off the top of my head is Mood Variations by Emily Short(
extensions/Mood Variations.i7x at 9.3 · i7/extensions · GitHub), although it’s more for tracking the moods of NPCs during conversation. Might be worth a look, though.
thanks i’ll check these out, and no i don’t but i guess i see the benefits of making one and will look into it.
ok so could i do something like for a basic example
5 moods: depressed / sad / neutral / happy / overjoyed
and have a number from 0 - 100 an be like 0 - 19 / 20 - 39 / 40 - 59 / 60 - 79 / 80 - 100 be determining their mood to change text?
Sure. You could use, for instance:
A person has a number called mood-level. The mood-level of a person is usually 50. Definition: a person is depressed if their mood-level < 20. Definition: a person is sad if their mood-level >= 20 and their mood-level < 40. Definition: a person is neutral if their mood-level >= 40 and their mood-level < 60. Definition: a person is happy if their mood-level >= 60 and their mood-level < 80. Definition: a person is overjoyed if their mood-level >= 80.
There are some less repetitive ways to approach it, but I chose a series of definitions like that so that sad, neutral, happy, etc., are adjectives, so they can be used in descriptions, e.g.,
Definition: a thing is other if they are not the player. [...then, within a rule or phrase]: repeat with p running through neutral other people in the lab begin; say p; end repeat;