Confusion with highest underlined relationships and highest underline Calc

So, I sort of posted this in another thread, but as it was sort of for something else, figured I would start a thread directly about this, just in case.

So, currently I have a bunch of *if’s involving highest_relationship, variable is highest_rel
Right now. When I run my game, it skips the variable, even though the relationship variable in the stats bar is correct.
I am not quite sure what’s going on, as the code seems good, some nice people on the forum had a look at it. Anyway, I’m not sure what’s going on, and since for now, the part of the book I am running through is pretty highest_relationship heavy, so, yeah.

Here is the code in the game:

"Get up!" This ${j_name} snaps, now right in my face as she grabs my left arm and starts to tug. "I don't have the time or patience to answer questions right now. Ask when we get you out of here."
I yelp, tugging my arm back out of reflex as my head automatically turns towards $!{highest_rel}, in the hope that ${t_they} can please tell me what the hell is going on now? Sometimes, like right now, I really hate being blind.



Though I am more focused on the fact that
*if (highest_rel) ="t"
	judging by the direction of ${t_their} voice, I think ${t_name} is in the group that is standing with me? "Huh, wouldn't have thought that would have that much of an affect on me, seeing as I really just met the ${t_person}." I think.
	*goto bloodwatch2
*if (highest_rel) ="l"
	that at least by the footsteps, ${l_name} appears to be in the group that's standing with me. My muscles relax slightly. After all, the ${l_person} did directly help me once, so perhaps ${l_they} will do so again if it comes to it? I hope?
	*goto bloodwatch2
*if (highest_rel) ="n"
	that judging by the footsteps, ${n_name} appears to be in the group who is standing with me. Also, should I be surprised, given how we first met that I feel relief at this fact?
	*goto bloodwatch2
*if (highest_rel) ="d"
	that by the footfalls, ${d_name} seems to be in the group currently standing with me. Well. That, and the fact that 1 side of my face is quite a bit hotter than the other, so there is that. Still though, nice to know someone cares.
	*goto bloodwatch2

When it gets to the string or the *if’s, it seems to just skip it. I can put the code for the highest_calc, and the stuff I have in startup if that’s the issue.

Not sure if this is the exact problem but the parenthesis are supposed to be like this *if (highest_rel = "t").

2 Likes

Thanks for that. Yeah, the placment of the ) matters more than you think. Still skipping, unfortunately. Here is the code for the highest_calc/ startup variable related.

*create relationship_counter 1

*label highest_relationship_calc
*label relationship_calc_loop
*if Relationship_counter <= Total_relationships
*if rel[Relationship_counter] > Highest_relationship_stat
	*set Highest_relationship_stat rel[Relationship_counter]
	*set highest_rel rel_name[Relationship_counter]
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

Before your *if statements, put this line:

${highest_rel}

And see what the value is before the statements run. Chances are that the variable isn’t set to one of the four options.

2 Likes

I put the string in, and still just blanking. Perhaps your right, though I have a *if for each of the 4 in the scene file, though not quite as sure about for the highest_calc one.

If you’re going to *create relationship_counter in the startup, then you need to reset it to 1 at the beginning of the loop. It was originally a *temp, so that it would be recreated at 1 each time. I think as it currently looks, the loop will only fire once, as after that, relationship_counter will permanently be stuck on a value of 5 and the *if statement won’t fire. Either:

*label highest_relationship_calc
*set relationship_counter 1
*label relationship_calc_loop
*if Relationship_counter <= Total_relationships
*if rel[Relationship_counter] > Highest_relationship_stat
	*set Highest_relationship_stat rel[Relationship_counter]
	*set highest_rel rel_name[Relationship_counter]
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

Or:

*label highest_relationship_calc
*temp relationship_counter 1
*label relationship_calc_loop
*if Relationship_counter <= Total_relationships
*if rel[Relationship_counter] > Highest_relationship_stat
	*set Highest_relationship_stat rel[Relationship_counter]
	*set highest_rel rel_name[Relationship_counter]
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

In any case, that shouldn’t prevent the loop firing the first time - so you should at least have a value in highest_rel.

Is this the first time you’re calling the subroutine in the game?
Does it work as expected on any times it runs before this?

Alongside the ${highest_rel} you have put in before the *if, also add these and see what they come out with:
${rel_1}
${rel_2}
${rel_3}
${rel_4}
${Highest_relationship_stat}

1 Like

I put them in, and got this, copied from Firefox:

“Julia, please explain yourself.” Alnasl says. “I would also recommend that you take several steps back, mam.” With that, I hear 4 sets of footsteps, 2
moving to flank me and 2 moving towards the woman, although she has at least let go of my arm and backed away a bit. Though I am more focused on the fact
that 0 0 0 0 0 0

Yes, this is the first time it’s been called, though that’s because I have a goto_scene to another scene file as I am checking that one for grammar and what not. I assume, that the 0 0 0 0 0 means that there is something lost in translation between the highest_calc and the game itself, or inside, the highest_calc?

Also, the next time there are a bunch of *if’s involving highest_relationships, for what ever reason the game has decided to put a “next chapter” button in, but I never put a *next or *ending. Tried looking for the reason, if that helps any in figuring the highest_calc out.

If they are all coming back as 0s, that means that you have not yet set any values into any of the variables. Which makes sense, because you say you are skipping to a specific scene.

The highest relationship calculation compares the value of each rel_x variable to the current highest. If it is higher, it sets that as the highest relationship. As everything is 0, and the initial value of the highest relationship is also 0, no relationship is deemed to be the highest, thus the calculation does nothing.

On that note. The current logic of the highest relationship calculation means that if two relationships are of equal value, only one of them is recorded as the highest relationship

1 Like

That makes sence. Though, I should have been clearer.
Right now, I have a goto_scene under a relationship choice, with a gosub_scene highest_calc just above it, so there is a value in the highest_relationship_calc. Though, the highest_rel 1/2/ ETC are all set to 0, or were till I changed them.
Here is the code in the startup file:

*create rel_name_1 "t"
*create rel_1 1
*create rel_name_2 "l"
*create rel_2 2
*create rel_name_3 "n"
*create rel_3 3
*create rel_name_4 "d"
*create rel_4 4
*create rel_name_5 ""
*create rel_5 5

Right now, as I just ran the game, the spot where the

$!{highest_rel}

outputs to this:

“Get up!” This Julia snaps, now right in my face as she grabs my left arm and starts to tug. “I don’t have the time or patience to answer questions right
now. Ask when we get you out of here.” I yelp, tugging my arm back out of reflex as my head automatically turns towards D, in the hope that she can please
tell me what the hell is going on now? Sometimes, like right now, I really hate being blind.

As well as:
“Julia, please explain yourself.” Alnasl says. “I would also recommend that you take several steps back, mam.” With that, I hear 4 sets of footsteps, 2
moving to flank me and 2 moving towards the woman, although she has at least let go of my arm and backed away a bit. Though I am more focused on the fact
that d 1 2 3 4 5 4

Currently, I picked another RO, so D, in this case Hanna, should not be coming up. Granted, it’s better then just blanking, so? Improvement.

relationship 5 isn’t coming up because the highest relationship calculation operates on a loop. It keeps increasing the counter by 1 (so that it tries rel_1, then rel_2, then rel_3 and so on).

To prevent the loop from going on infinitely, there is this *if statement in the loop:

*if Relationship_counter <= Total_relationships

Unless you have changed it since you last posted your create statements, then your total relationships is set to the value of 4. So the loop will go 4 times (for rel_1/2/3/4) and then stop.

You just need to set Total_relationships to 5.

1 Like

Hi actually only have the four relationships currently, only have the five in there because someone said put it up to five a while back, and.
For the numbers after the relationship underline name, should I keep them as is, or put them back to zero? Also, what exactly do they do? Are they to track each relationship, which is why it’s relationship on the line one, relationship underline two, etc?

Ahh. OK. I thought you were saying the issue was that relationship D was coming out as the top one, when it shouldn’t have been. Out of the four relationships, d is set to the highest (4), so it looks right to me. Unless I’ve missed something.

So, The reason for the _1/_2/_3 etc. is to allow you to loop through the variables quickly using the array function in choice script. The loop looks like this:

*label highest_relationship_calc
*temp relationship_counter 1
*label relationship_calc_loop
*if Relationship_counter <= Total_relationships
*if rel[Relationship_counter] > Highest_relationship_stat
	*set Highest_relationship_stat rel[Relationship_counter]
	*set highest_rel rel_name[Relationship_counter]
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

When you put a variable in then what it does is takes the value of that variable, puts an _ in front of it and appends it to the end of the string before it and makes a new variable name. So rel[Relationship_counter] becomes rel_1 (or 2, or 3…)

On iteration 1 of your loop (relationship_counter = 1), your code becomes like this:

*label highest_relationship_calc
*temp relationship_counter 1
*label relationship_calc_loop
*if 1 <= 4
*if rel_1 > Highest_relationship_stat
	*set Highest_relationship_stat rel_1
	*set highest_rel rel_name_1
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

Then it increases relationship_counter by 1 (to 2) and we loop again:

*label relationship_calc_loop
*if 2<= 4
*if rel_2 > Highest_relationship_stat
	*set Highest_relationship_stat rel_2
	*set highest_rel rel_name_2
	*set Relationship_counter + 1
	*goto Relationship_calc_loop
*return

And so on for 3 and 4 - then the loop stops at 5, because 5 is not <= 4.

So yes, the variable names should say like that if you want to use the simple looping method. Alternatively you could give the variables all different names, then you just need to write an *if statement for each relationship

2 Likes

That makes sense, currently D is not the relationship that I chose, but I’m pretty sure the reason it’s coming up is because in start up I set it to four, I’ll just set Rall, all of them back to zero that should hopefully solve it. Or maybe one?

The loop is only going to look at the numeric value of the rel_1/2/3/4 variables. So, with D set at 4 (and 4 being the highest number of all the variables) that is the one the loop will set at the highest relationship.

By ‘relationship that I chose’ - do you mean a choice that you are giving the player in the game? If you want a choice to set that relationship to the highest, then just have a *set command after that choice to increase the relevant relationship by an amount to make it the highest.

1 Like

In this case yes, I mean a choice that the player can choose in the game. Right now as I have it set up, there are four choices, each one raising a different relationship.
Should I put the numbers, the ones under the rel underline names, back to zero then? I think I understand what they’re doing, as there a sliding value for the relationships? But not sure how to then connect them to said relationships, I hope that makes sense?

By ‘back to 0’ do you mean, instead of this:

*create rel_name_1 "t"
*create rel_1 1
*create rel_name_2 "l"
*create rel_2 2
*create rel_name_3 "n"
*create rel_3 3
*create rel_name_4 "d"
*create rel_4 4
*create rel_name_5 ""
*create rel_5 5

You have it as:

*create rel_name_1 "t"
*create rel_1 0
*create rel_name_2 "l"
*create rel_2 0
*create rel_name_3 "n"
*create rel_3 0
*create rel_name_4 "d"
*create rel_4 0
*create rel_name_5 ""
*create rel_5 0

If so, then yeah - that makes sense.
Then, whenever a player makes a choice which you want to increase the relationship with one character, you raise the value of that value for that character. You’ll have to decide how much you raise them by (that comes down to game balance, the number of choices and so on - rather than a code question).

So, currently I have:

*create relationship_name_1 "t"
*create relationship_1 0
*create relationship_name_2 "l"
*create relationship_2 0
*create relationship_name_3 "n"
*create relationship_3 0
*create relationship_name_4 "d"
*create relationship_4 0
*create total_relationships 4

*create t_relationship 50
*create l_relationship 50
*create n_relationship 50
*create d_relationship 50


*set_relationship +5
*set l_relationship +5
*set n_relationship +5
*set d_relationship +5

The last 4 are in 4 different choices. I think what’s happening is the alterations of the relationships aren’t translating to the highest_calc? Though, I do not know how to fix this, since when I tried to change the, relationship_1, ETC to t_relationship, it threw up an arror since I had already created t_relationship previously.

This post was flagged by the community and is temporarily hidden.

With that being said, How would I aise/lower the relationships then?
I have *set relationship + and -, but it doesn’t seem to be doing anything to the highest_calc stuff.

The best advice I can give is to re-read the last bit of code you posted and the code for highest relationship calc and think through why the different variables are not being set as you expect them to be