+1 vote
by (950 points)
Hello again,

after I finally managed to get the player input and character choices working on my game, I now would love to include a couple of NPC's before actually beginning to write the actual story.

I believe all the NPC's I am planning on having would be listed inside a passage which would be named maybe NPC.

In there I would need to list their names and ages... I am not sure if setting them up works the same way I used to create the player input. Like if I need to add some <<set>> comand up into the StoryInit or not...

Later on I want to use <<if>> to create a situation in which the NPC reacts to certain traits listed inside the players choices. Like for instance an NPC reacts to a certain hair color he is seeing and acts according to his preferences... something like that.

I would really love if some of you guys could kindly direct me a little so I get a clue what to do in order to accomplish my goal.

I searched a lot websites to find infos about such thing... one can find a lot about how to create character input but nothing about how to create npc's and include them into a game and what exactly has to be done for it....

Thank you very much in advance for helping me out...

*waves*

Mr. Peppermint

1 Answer

+1 vote
by (8.9k points)
selected by
 
Best answer

To create an NPC called Mr Peppermint:

<<set $mrpeppermint to {}>>

To set his name, age and preferred hair colour:

<<set   $mrpeppermint.name to "Mr Peppermint",
        $mrpeppermint.age to "126",
        $mrpeppermint.preferredHair to "blonde">>

In the story, to ask Mr Peppermint if he likes the PC's hair:

You ask $mrpeppermint.name if he likes your hair.

<<if $playerHair == $mrpeppermint.preferredHair>>
  "It's your loveliest feature," he beams.
  <<else>>
  He shakes his head sadly.
<</if>>

 

by (950 points)
edited by
Hello Charlie,

thank you for your reply. :) I suppose the two first <<set>> from above go into StoryInit and only the last one you I use on different passages where I want to use it at...

Edit: Works perfect, yaay.

Now that helps a lot <3

Thanks again

Mr. Peppermint
This site has been placed in read-only mode. Please use the Interactive Fiction Community Forum instead.
...