Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Relationship eventing?

Lysen

Member

First, I'd like to apologize if there's a topic like this, but my Net has been going in and out every other minute and I wasn't able to search through every page. It also seems to not want to display certain parts of the site...  :dead:

Anyway, what I'm trying to do is make it so that while talking to party members or during certain events, what you choose can either make the person like you more, less, or doesn't affect how they think of you (depending on the options), which could be kept track of using "points" I guess. Like answering positively gets you +2 points or something? And, if possible, be able to adjust it with multiple party members at the same time?

Like, for instance, the town is burning and a little girl is trapped in a house that's on fire and you go in to save her. There also happens to be a chest in the room with the girl. If you open the chest first, everyone currently in your party will loss -5 affection points. Saving the girl first earns you +5 for everyone in your party. Or in another event, two members ask your opinion on which way to go (of course they each think their way is best). Going with one over the other will of course increase your points for one, and lower it for the other. And at the end of the game, you get an ending with the person the player has the highest points for.

I SORTA understand how to go about doing this, but I have no idea how to have the game keep track of the points.

Is there an easy way to do this, as well as a way for the player to see the affection levels for each individual member?

I DO have an "Affection" script, but someone on CA mentioned it could be done through eventing instead. Unfortunately, they didn't really explain how and the topic is months old...

So, help? I apologize for so much text, but I wanted to try and be as clear as possible.  :smile:

(Thanks in advance!)
 
Not exactly sure what else are you trying to do, but judging from what you wrote you should be able to use one variable for each party member. If you need to raise the party's affection, add to all the variables at the same time. Else, just add/subtract to indivual party members.
 
What Hev said. And to display the points, one way is to simply display the variable value in a message via \v[#] (replace # with the variable number that you are using to store it).
 
Then you can, of course, do some shinier stuff once you have the values; quests, affection bars (bit harder to event, but still doable) or even incorporate the values onto your menu. The base for it, from what you described are simple variables though.

Good luck!
 
Hevendor's right and Reives is right.  You can simply use the control variables command to add or subtract from those variables.  Those variables can then be used as the basis for conditionals later on.  Now on to what you currently want to do:

Like, for instance, the town is burning and a little girl is trapped in a house that's on fire and you go in to save her. There also happens to be a chest in the room with the girl. If you open the chest first, everyone currently in your party will loss -5 affection points. Saving the girl first earns you +5 for everyone in your party.

For this we'll need two switches for the rescue and the issue of messed up priorities and a party variable:
We'll start with the chest:

Code:
# Here's our common chest commands without the stuff to change it graphically
conditional branch:: [self switch A] == off
change item:: [treasure], +1
control switch:: [self switch A] == on
end branch
# This conditional will now check if you saved the girl
conditional branch:: [rescued girl] == off
control variables:: [affection] =- 5
control switch:: [screwed up priorities] == on
end branch
#Basically if the rescued girl switch isn't active you will lose five points on the variable.

Now onto the rescue event
Code:
#this conditional will check if you opened the chest first
conditional branch:: [screwed up priorities] == off
control variables:: [affection] =+ 5

Be sure to check for bugs.  :thumb:
 
You seem to be talking about 2 different things...

In the "girl trapped in fire" example, the entire party either gains or loses "karma", which I assume will affect the outcome of interactions with NPCs in the game. Particularly in that town.
You could get carried away, and try to have every NPC in your game have an 'opinion' of your party,
or just keep a single running tally of 'good deeds' vs 'dastardly deeds'

In the "Party members want to go different directions" example, you are talking about the relationship between the party members. IN which case, you only need 3 variables (assuming a 4 person party). Since you don't care about the relationship between the other party members, only the relationship between you (main character) and the other 3.

There are several discussions on 'karma', and I think even a Karma System. (do a search)
I haven't seen anything to date on inter-party relationships. Interesting idea though...

Be Well
 

Lysen

Member

I understand now, thanks a lot for both of your help!  :thumb:

@Brewmeister: Actually, I meant the event to affect only the points of your party members (sorry I worded it wrong), I never actually considered the whole town, but that is an excellent idea and I will definitely give it a try, so thank you as well for the inspiration!
 

SPN

Member

If you wanted to get a bit more indepth with your game, taking these ideas a step further could help reduce game linearity and get rid of that forced feeling that sticks out in a few too many games I've played in my days.  Let's look at an example.

You find yourself and your party in an abandoned mine.  There's a main, previously excavated route through the mine, but part of it has collapsed from lack of structural support or whatever.  Finding a way through the rubble would save you plenty of time and resources, as the only other visible option is a more dangerous looking, poorly lit route that you could've sworn you just heard a deep growl from.  Now, one of your party members, let's say, is blessed in the muscle area, and has rudimentary control over earth magic.  You ask him if he could help out with moving the rubble.  But wait!  Maybe you had 5 encounters previous to this where you made a choice to either gain or lose his affection, friendship, whatever you want to call it.  Let's say that each scenerio could've gained you 5 points, lost you 5 points, or left the points where they were.  Back at the mine scene, if his "affection" towards you is less than, let's say 15 points, he will tell you that it is too daunting of a task for him to accomplish, knowing full well that he could do it.  If you've maybe gone that extra mile to keep this guy on your good side, then he might offer to help you out and get the party through the easy way.

Things like this could really add to the game, and if you made your decisions impact the outcome of future events enough, the replay value will skyrocket.
 

Lysen

Member

SPN":evb642po said:
You find yourself and your party in an abandoned mine.  There's a main, previously excavated route through the mine, but part of it has collapsed from lack of structural support or whatever.  Finding a way through the rubble would save you plenty of time and resources, as the only other visible option is a more dangerous looking, poorly lit route that you could've sworn you just heard a deep growl from.  Now, one of your party members, let's say, is blessed in the muscle area, and has rudimentary control over earth magic.  You ask him if he could help out with moving the rubble.  But wait!  Maybe you had 5 encounters previous to this where you made a choice to either gain or lose his affection, friendship, whatever you want to call it.  Let's say that each scenerio could've gained you 5 points, lost you 5 points, or left the points where they were.  Back at the mine scene, if his "affection" towards you is less than, let's say 15 points, he will tell you that it is too daunting of a task for him to accomplish, knowing full well that he could do it.  If you've maybe gone that extra mile to keep this guy on your good side, then he might offer to help you out and get the party through the easy way.


Hmmm, now that I'm thinking about it, that's also a really really good idea. What I'm trying to decide on now is whether it's better to include most of the affection raising/lowering/etc events during the main plot (which would be easier), or have most of them off to the side for sidequests and whatnot that you can only do if the person's affection is at a certain point.

I'm also thinking of including "hidden" affection events with character's who are important to the plot, but don't actually fight with you
 
hmmmm...is there any event that you can give ....an item to an NPC girl? and her affection will increase... when it increases to its maximum, You can propose a marriage to her...? O_O I searching this for days !
 
ballow009":2z5ieiqw said:
hmmmm...is there any event that you can give ....an item to an NPC girl? and her affection will increase... when it increases to its maximum, You can propose a marriage to her...? O_O I searching this for days !
You wouldn't really be giving her an item, but you would just subtract the item from your inventory. Otherwise, you would just set this up the same way. You would have some coding in the girls event that checked to see if affection is 'x' number of points. If it is, then say yes. If not then say no. Wouldn't be too hard really...
 
Ok, here's a very simple example. You can expand this by adding additional items to give to her, or even choices on what to say to her.

Create an event. Select a Graphic for your girl.
Add the Following Event Commands:
Code:
@>Text: Hi, my name is Penelope. I love perfume.
@>conditional Branch: [Perfume] in inventory
    @>Text: You have some perfume. Would you like
                 to give it to Penelope?
    @>Show Choices: Yes, No
     : When [Yes]
        @>Text: Oh, it's lovely. Thank You!
        @>Control Variables: [0001: Penelope Affection] += 1
        @>Change Items: [Perfume], - 1
        @>
     : When [No]
        @>
    : Branch End
    @>
 : Else
    @>Text: You think, "Man, she's hot. I got to get me
                 some perfume!
    @>
  : Branch End
@>

Now, create a "New Event Page" (page 2)
Set the "Conditions" to:  Variable  0001: Penelope Affection  is  5  or above
Enter the commands:
Code:
@>Text: Hello again, \n[1]. I've missed you.
@>Text: Do youwant to propose to Penelope?
@>Show Choices: Yes, No
   :  When [Yes]
    @>Text: On bended knee, you ask Penelope for her
                 hand in marriage.
    @>Text: Yes, I would love to be your wife!
    @>
   :  When [No]
    @>Text: You big chicken!
    @>
   : Branch End
@>

That's it. when you bring her 5 perfumes, you can ask her to marry you.

Be Well
 
GAHH, Thanks Brewmeister, I've been looking for this kind of system too. I knew it could be done using variables and conditional branches but I just didn't know how to go about it.
 

Lysen

Member

The only thing problem I can see is this though...

Say, you have the marriage event at the very end of the game, decided by a certain number of points (let's say 100). But when it gets to that point...three people are tied. Obviously, you can't marry all three of them, so..

Is there a way to make it so that the game will set priority of one person's event over the other?
 
From just glancing over the script it looks like it gives you the option to choose who you want to marry. An easy way to fix it wo all three wouldn't marry you would be to create a common event with the parallel process as it's trigger with switch "Married" or whatever you wanted. In the coding you would just set all the variables (yes all of the ones for affection...) to a really low number so that unless you really tried to, you couldn't get married again. There are other ways of doing this, but this method is simple, and I don't really have to much time to mess with it right now. If you want a really goood way, say so, and when I get a chance I (or anyone else....) can code it for you.
Thanks!
 

Lysen

Member

Well, in my case, once you reach the end, the choosing is over and the game (should) tally up everyone's points and chose one ending based on the points for you...

I'll give an example, so it will hopefully be clearer ^^;;

In the game StarOcean 2, how you respond to your party members, as well various other stuff raises or lowers your party members affections for you. But once you reach a certain point in the game, somewhere near the end, you could no longer do this and the game would total up your score for everyone. You could give someone presents all you wanted, but it wouldn't change the score. Then, once you've beaten the boss, you'd get the ending with the person who liked you the most automatically. And if, say, Girl A and Girl B's affection for the main guy were BOTH maxed, it gave an ending based on priorities. So since Girl A has a number 1 priority and Girl B's was only 6, then you'd get the ending with Girl A

That's what I'm trying to do basically (if it can be done)
 
ok, that was my bad. Here is what you do. In your ending cut scene or whatever you want to put this in you want the variables to be checked, right? Well, you really just have to check all of the possible outcomes with conditional branches really. You want it to end up looking something like the following...

In this code, I use three different girls with a number of 100 being what you need to obtain and 150 being the max. I also used multiple pages to make it cleaner. This is a large code that checks a lot of possiblities. There are a total of three different outcomes (obviously), but 7 different ways to get one of those three. They are as follows:

Possible options (affection 100+) :
  • Girls A,B, and C
  • Girls A and B
  • Girls B and C
  • Girls A and C
  • Girl A
  • Girl B
  • Girl C
This is a lot of options that you have to check through to find out who has the most points. You could go down the line saying:
Does girl A have more than B?
Does girl A have more than C?
Does girl B have more than A?
Does girl B have more than C?
so on so forth.....

My way takes a bit more coding but it is cleaner and easier to understand. I'll post it when I finished.



Edit:

ok. I simplified it a bit. it uses 3 switches and 3 variables. If you need me to explain it let me know. It is pretty self explanitory if you really look at it.

http://img82.imageshack.us/img82/1141/part1cf7.th.png[/img]
http://img82.imageshack.us/img82/9555/part2dz2.th.png[/img]


The area that is cut off is just branch end a few times....also, the pictures go right on top one another.
I hope this is more of what you were looking for! Thanks!
 
By using nested Conditional Branches, you can do this with 0 switches & 0 extra variables...
Just check the girl with the highest priority first.
Code:
@>Conditional Branch: Variable[0001: Girl A affection] >= 100
    @> ### Do ending A
  : Else
    @>Conditional Branch: Variable[0002: Girl B affection] >= 100
        @> ### Do ending B
      : Else
        @>Conditional Branch: Variable[0003: Girl C affection] >= 100
            @> ### Do ending C
         : Else
            @> ### Do ending D (no girls qualify)
         : Branch End
      :Branch End
  :Branch End
@>

Just a thought....  :scruff:

Be Well
 
i got a problem brewmeister.... I follow the "Penelope event" but when I got some perfumes only 1 the switch in the 2nd page of the event [var:001 penelope affection] greater than equal to [5]...will be activate automatically.... but all i need is 5 to activate the second page...means 5 perfumes.. but in my situation 1 perfume = 5 affection points >.< wierd O_O

2nd problem is the variable [penelope affection]+=1 right! if i give him perfumes is should add up and activate the 2nd page...but the problem is when I give her a perfume ....I think the variable doesnt go up and remain 1, coz I still cant go to the 2nd page... I think already give her so many perfumes O_O
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top