A Script Where Possible Endings are Determined by "Affection Points"?

Kattriella

Veteran
Veteran
Joined
Sep 30, 2012
Messages
50
Reaction score
5
First Language
English
Primarily Uses
I apologize if what I'm asking about already exists, but I'm not entirely certain what to call what it is I'm asking for. (And I'm not sure if that sentence actually made since.)

Essentially, what I'm currently working on is a sort of visual novel/RPG . . . conglomeration? The way the game progresses is heavily based on the players answers to questions, with different endings available through different choices. However, I quickly came to realize that I couldn't quite achieve what I wanted through the functions offered by the engine by themselves. (In other words, there were too many possible choices for event triggers to do the job.)

Essentially, what I wanted is for different choices to offer a sort of "affection point" to each of the different supporting characters, and at the end of the game, depending on which supporting character you had the most points with, that's the character whose "Good End" you got. That said, I would also like to include an option for if you have equal affection with each character, to either be able to say, "Pick Character A, B, C, etc", or to reject them all in favor of a completely different ending. (If there is a way to include an option for if you have NO points with any of them, that would be nice, but as I'm not entirely familiar with how scrips are created, it's not entirely necessary.)

Uh, I hope I was clear enough . . . I had a really great, very clear explanation all thought up in my head, but then it sort of went poof . . .

Again, I apologize if there is something like this already in existence, or if I'm just being a moron and completely overlooking  ay to do this with the basic system . . . If I am, could somebody point me in the right direction? (Like to a tutorial?) Pretty please?

Well, this is the very confused Katt, going back to hunting for resources . . . Good day.
 
  • Like
Reactions: BCj

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,358
Reaction score
7,671
First Language
German
Primarily Uses
RMMV
No, such a script does not exist - because there is no need for it, such things are usually handled without scripts by eventing alone.


You need to use variables for this, and whenever the player makes a choice you add points to the variables depending on what choice was made. And at the end, you check the values of the variables by conditional branches to select which ending it should be.


All those commands are available by eventing, no need to go to the scripting level.


Without more knowledge about your game, no one can point you how to set everything up - but usually you set one or two variables for each NPC the player can meet, and then use controll variables on the show choices branch to add points to the variables.


The only thing that you might need in the script area is a script for allowing more than the four choices available in a default show choice event command - for that, you can either use Tsukihime's "large choices" or Modern Algebra's "Choice Option" scripts.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I've got to agree with Andar.  I can't think of much that such a script would do, besides provide an inefficient way to do what you already can do with event commands.  Just assign each character's "affection" to a variable, and adjust them as appropriate when the player makes a choice, right alongside all your other event processing.  For example:

Choice: Which one do you want to buy?

Cake

    Increase Variable 11 (Character A affection) by 2

    Decrease Variable 12 (Character B affection) by 1

    Obtain Item: Cake

    Lose Money: 50g

Pie

    Decrease Var 11 (Char A affection) by 1

    Increase Var 12 (Char B aff) by 2

    Obtain Item: Pie

    Lose Money: 70g

Meow Mix

    Increase Var 13 (Char C aff) by 3

    Obtain Item: Meow Mix

    Lose Money: 30g

None of them

    Decrease Var 11 (Char A aff) by 1

    Decrease Var 12 (Char B aff) by 1

End Branch

At any point, you could use a Conditional Branch to check whether a character's affection is high enough to, for example, show a bonus scene or a different line of dialogue.

The only thing that would be moderately difficult to do with events would be comparing each affection level AGAINST each other (in other words, out of all the characters, which one is the highest?) - the way to do this through scripting is to run a scripting loop that checks each variable, and if it's higher than the highest variable it's found so far, makes that the "incumbent" variable for others to check against.  The following is basically how you'd do it without checking for ties (you could have it create an array that would accommodate ties, but I'm trying to keep it simple for now:

highest_value = 0highest_char = 0for i in 11..17if $game_variables > highest_valuehighest_value = $game_variableshighest_char = iendend$game_variables[21] = highest_charHere, Variable 21 is storing a value that designates which character's Affection is the highest - so if it reads 11, for instance, Character A is the highest affection value.  You'd use that to determine which ending to show.

The reason no scripts exist for this is because it's impossible for the scripter to know exactly what you want to do with each value - and to create a big script that could perform every major function that you might want to do would be wasteful when it's easy to script it up with just a few lines, like above.
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
451
First Language
April Fools
Primarily Uses
N/A
Yea Event that!!
 

Kattriella

Veteran
Veteran
Joined
Sep 30, 2012
Messages
50
Reaction score
5
First Language
English
Primarily Uses
Oh, okay! Thanks, guys! (Now I feel like a moron, but oh well!) So I just need to figure out how to use variables . . . Meh, probably still easier than fighting with a script. :3 Thank you again!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,358
Reaction score
7,671
First Language
German
Primarily Uses
RMMV
So I just need to figure out how to use variables . . .
Follow the link in my signature, there are several tutorials linked in that topic. The one you're looking for is the "Variables Guide"
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Moving over to VX Ace Support
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top