Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Saving Inventory between Different Characters

5 years ago

So I have this idea I've been playing around with for a few days and I've run into a pretty big issue

I'm going to have a storygame where it switches POV between 5 different characters, their stories intertwining every once in a while and certain choices will affect a different character's story, etc etc. However I'm not sure how to make it so that if Character A picks up an item it will not show up when the story switches POV to Character B, and then when it switches back to Character A the item is still there.

Is there a way to make this happen or is it too complex? Thanks in advance

Saving Inventory between Different Characters

5 years ago
Yeah should be possible. I'm going to assume you have a decent comprehension of scripting, but if you're not sure about $ITEMSTATE then check out this article.

The best way I can think of doing this would be creating individual variables for each item, something like %HADITEM, replacing ITEM for the actual name. When this variable is equal to 0, this means the character didn't have the item before a POV switch. If 1, it means they did- just like tracking if an event happened previously in a storygame.

Let's say the first item Character A has is bread ($ITEMSTATE1). When you're switching to the next POV, in the link script put something like:

IF $ITEMSTATE1 = 1 THEN
BEGIN
$ITEMSTATE1 := 0
%HADBREAD := 1
END

Then repeat the process for all possible items for the character to pick up. Then, on the next page, the inventory will be clear (unless you want Character B to begin with certain items, in which can you'd add that to the link script too. E.G: $ITEMSTATE7 := 1 $ITEMSTATE8 := 1 $ITEMSTATE10 := 1 to add three items with those reference numbers).

When you're switching back to a character who's inventory you've already "saved", you'd need something like this:

IF %HADBREAD = 1 THEN BEGIN
$ITEMSTATE1 := 1
%HADBREAD := 0
END

Again, repeating for all items. It's just the reverse of what we did before.

If you're planning on two or more characters being able to pick up the same item with the same effects, then you'd need two or more variables for that item so you can use the variable specific to whoever the narrative is being panned to for that item.

A storygame with this basis is something I've also actually considered and may get around to writing and scripting one day, though not with that many characters all with POV changes. 5 sounds like a big challenge, because you're not only juggling 5 different characters, you're juggling exponentially growing diverging storylines. And that's not even considering whether they interact- it will be a lot easier if these characters don't impact each other's lives, because otherwise you're going to have to have a hell of a lot of tracking variables!

Regardless, good luck with this, sounds like it could be very interesting.

Saving Inventory between Different Characters

5 years ago

Thank you so much! And yeah, this game is going to take a LOT of writing, planning and many, many variables. There will be different paths that each playable character can take and I'm trying to put emphasis on relationships and choices so there will be a lot of branching paths.

For example, you'll get a choice to kill some minor characters but if you do, those characters will be locked off from a different playable character's story and you'll lose relationship points with anyone who had connections to them which could possibly lock you out of some options down the line. Needless to say, it's a big project lol

Saving Inventory between Different Characters

5 years ago
Indeed, what Az listed is likely the way I'd do it, too. But then I'd wonder if it was really worth all that extra work, especially if the items aren't going to be shared across characters...

If the items aren't shared, I think I'd just use a single variable so that I know they have the item and use that in my options and text. Unless you really need the reader to use the item, that would make this a bit simpler. By that I mean if the items are primarily things like keys that will determine if an option appears (unlock the door), then you could just use a single simple variable when they pick it up and not have to worry about anything when they switch characters.

Saving Inventory between Different Characters

5 years ago

I was thinking about having an "implied" inventory where the player doesn't actually see the inventory and items aren't used but are instead variables that unlock different choices like what you described. I'm not entirely sure which one I'm going to go with yet considering I'm still planning my story and I don't have many items so far. The "implied" inventory would definitely be a lot easier to manage, but the scripting option would probably look a lot nicer.

Saving Inventory between Different Characters

5 years ago
Personally, the biggest thing I don't like about inventory items (and I've used them, still), is the reload of the page when you use an item. That's annoying, especially when it's a long page. I think it's just a personal choice whether to use items so people can see them or not.