HTML [Twine] Roaming NPCs + Randomly Generated NPCs?

Iron Cunny

Newbie
May 24, 2020
91
33
124
Greetings.

What I seek to do within Twine is:

1. Figure out how to make NPCs that can move between pages and appear on any assigned tag of page.
2. How to assign traits to said NPCs and how to affect said traits.
3. How to make them follow you.
4. How I can use a randomizer to create these NPCs (I intend to do this + have some pre-generated ones. Do I need to store them somewhere?)
5. How to make it so that certain NPCs do not spawn in this manner until certain conditions are met.

If you can help with any of these points, I'll be taking notes!
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
3,357
6,447
707
Based on your questions I guess you are fairly new to programming or similar tasks. Don't let that stop you, but be aware that there's a fair bit of learning ahead of you - which includes the technical details, but more importantly *how to think like a programmer*

Programming is making a series of logical instructions that a brainless robot will execute for you one instruction after another.

The fact that you are using Twine has only very peripheral technical influence on writing instructions to achieve do those five goals you listed. Any programming language will let you do what you have described, with the differences being around how you *show* the results of those goals, and the specifics of the grammar of the language.

So, step 1:

Your game needs some concepts:

* some record to represent a NPC - their details: like name, favorite ice cream, and boobs size. You've got a set of "attributes" that together make up a NPC record.
In programming terms this would be called a data structure called a key-value hash, also known as a data object, or a name-value array or others depending on the langauige.
Twine's most common language dialect is Sugarcube, but from what I have see Sugarcube doesn't have a built in useful data structure tool. Luckily there are plugins for these things - one called "datamap" is probably helpful.


* you'll need to make a semi-random generator that will assign the details to a new NPC record. you'd probably make a series of random choices from lists of stuff that would feasibly be options for the various attributes. Would looks something like:
height = RandomNumberBetween(140,195) # centimetres of course, we aren't using magic numbers here
eyecolor = RandomChoiceFromListOfStrings( "blue", "brown", "green")
...etc

* each NPC recoprd you create will need to be remembered. so you'll assign the data structure into a big list of NPC characters, and give them index numbers so you can find them again when needed. the list would be an array.

* a "list of NPCs that are following the character right now"

Your main character probably has some attributes like Energy, Money, SexAppeal etc. You could also have an attribute that is a list (or array) of numbers. The numbers will reference the NPCs. So you could look up the NPC details using the number when needed.
----

You've got some other stuff about locations but I think we are already getting complicated.

I'd highly recommend you spend some time running through a programming basics course, like one of those at

Javascript might be a good beginners language, and potentially helpful down the line with your Twine game - because javascript is the secret sauce language underneath Twine!

Another thing to do would be to follow along someone's "let's develop" youtube series, seeing them make a Twine game from scratch.

And/or read through a series of tutorial articles. This guy seems cool:

Most of all, what you need to time to learn and the ability to keep working on the same thing for a LONG time.

Learning to think like a programmer takes time.
Learning the technical aspects of a programming language takes time
(although once you know one, the rest are much easier to pick up - if you can cook italian food well, then switching to mexican food is just details, not the basic concepts of how to chop and fry and boil).
And finally, the creative effort of making a game - writing stories, developing game code, drawing/finding/generating/editing images - takes even longer!
 
  • Heart
Reactions: Iron Cunny