Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Relationship/Reputation tracking

11 years ago

I'm a poor clueless newbie when it comes to the advanced editor, so I need some of you script gurus to help me with a thing.

In my story I have five factions, and I want the game to track each of their relationship with the player character based on your actions at key points. I'll be dividing the relationships into five categories as well - hate, dislike, neutral, friendly, and allied.

Complicating things further, ideally I don't want every choice to have the same 'weight' in how reputations are calculated. (ie: if a good faction considers you kill on sight, giving a piece of bread to a beggar is not going to magically fix that; you'd have to do something more dramatic like saving a child from drowning.)

The simplest solution I can think of is to give the player a range of points with each faction, 1-10 being hated, 11-20 being disliked, etc. and have actions raise or lower that score.

The only problem being I don't have the slightest idea where to begin on doing any of this...

 

Relationship/Reputation tracking

11 years ago

Alright, Mizal, let's do this.

We first need to enable variables. We will keep scripting disabled for now. First, ensure that your storygame is made in the advanced editor. You can convert it to advanced in the Game Properties page if it isn't. In the Game Properties page of an advanced story, you will see a link called [change editor features] near the bottom. Click that fucker and set Variables to advanced.

Great, we're ready to roll.

Click the Variables link (near the top) to go to the variables overview page. Create new variable. I'm going to pretend that your factions are named red, blue, green, teal and fucker for the rest of this tutorial.

Your new variable should be called BLUEREP. Click 'display on all pages' (turn this off before publishing the storygame but it's great for testing) and then click 'Create new Variable'. Repeat this for the other four factions.

Now, go to one of your pages where a link is present where you'd like to change the reputation of a faction. Next to the link is a little blue plus sign. Let's say that you've pissed off Fucker Faction when you click this link. Next to FUCKERSREP, select the dropdown box and choose Subtraction and then type the number.

Now, what's the use in storing these values if you can't use them. If you click the stop sign next to a link, you can make it so that links are invisible or unclickable unless certain variables are within certain ranges. So, for instance, maybe the option to join the fuckers faction is unavailable if your reputation with them is lower than 10 or something. Your call.

Good luck!

Also, go read this poorly written article (and this one) and these (1, 2) better articles.

Relationship/Reputation tracking

11 years ago

Okay, wow. I actually managed to follow all that. I'm going to be using this a lot with some 'if variable equals whatever go to this page' thing I found pasted in my notepad from an older story, but being able to grey out job offers will be handy too. 

I'll test it out as soon as I can copy and paste some stuff over from Twine, but it looks pretty straightforward the way you described it, thanks! :)

Relationship/Reputation tracking

11 years ago

You're welcome!

Relationship/Reputation tracking

11 years ago

Sounds straight forward enough. Your variables need to be directly proportional to the amount of characters you have. Name the variables the name of your characters. The default values of your variables should be zero; don't change it. Your variables' range should be from -10 to 10. 

Hate: -6 to -10

Dislike: -1 to -5

Neutral: 0 

Friendly: 1 to 5

Allied: 6 to 10

Whenever you do or say something that changes the relationship of the character to you, set the value to minus 1 or plus 1, depending on what you said or do.

Now. Putting that in script language, basically, you have to put this in the link script:

%C1 := %C1 + 1

The above says increase the relationship point of character 1 by 1. 

%C1 := %C1 - 1

The above says decrease the relationship point of character 1 by 1. 

Now put this in the global link script:

IF %C1 <= -5 THEN

BEGIN

%R1 := 1

END

IF %C1 > - 5 THEN

IF %C1 <= - 10 THEN

BEGIN

%R1 := 2

END 

IF %C1 = 0 THEN

BEGIN

%R1 := 3

END

IF %C1 <= 5 THEN

IF %C1 > 0 THEN

BEGIN

%R1 := 4

END

IF %C1 > 5 THEN

IF %C1 <= 10 THEN

BEGIN

%R1 := 5

END

The above basically says, set the relationship of character 1 toward you to 1 if the character hate you. Set the relationship of character 1 toward you to 2 if the character dislike you. Set the relationship of character 1 toward you to 3 if the character is neutral toward you. Set the relationship of character 1 toward you to 4 if the character is friendly toward you. Set the relationship of character 1 toward you to 5 if the character is allied to you.

Now that is out of the way, make an item call relationships. Set the item to a page called relationships when you use the item. In the text area of that page, put this:

Character 1: %%R1%=%1%Hate%%%%R1%=%2%Dislike%%%%R1%=%3%Neutral%%%%R1%=%4%Friendly%%%%R1%=%5%Allied%%

...And you're set. 

But if you want to figure it out yourself, then please skip everything I've written above, and read this message first: Check out the Help & Info sections to find out if you really want to learn scripting, and if you're really starting to get into scripting, just p.m me. 

 

 

 

Relationship/Reputation tracking

11 years ago

This post is terrifying. (edit: blarg how do you post picture here?)

I've think I've got a good handle on the faction reputation thing from 3J's post, but I'm almost positive I'm going to need to do some scripting a little farther down the line, so you're now on the short list of people to bug about it, thanks. :)

Relationship/Reputation tracking

11 years ago
(In reply to "edit:") like this:

Relationship/Reputation tracking

11 years ago

Good job, Ford! Now how do you do it?

Relationship/Reputation tracking

11 years ago

Just copy and paste the picture. If you don't know how to do that, well I'm expecting you to, but, just in case you don't, right click, select copy, and right click again, paste. 

Relationship/Reputation tracking

11 years ago
That sure is a nice picture :3 possibly one of the best

Relationship/Reputation tracking

11 years ago

HOLY SHIT

Now I feel stupid, I was trying <img src="blah blah blah"> and everything else I could think of.

You guys have made me so happy!

Look there's my happy face. :D

Relationship/Reputation tracking

11 years ago

I used to have a little turtle like that, but it died in the winter time, when we left it in the backyard, expecting it to get to hibernating or something like that. XD

Relationship/Reputation tracking

11 years ago

Relationship/Reputation tracking

11 years ago

Yeah. If I were to be reading my own post when I was just starting out with scripting, I would be banging my head against the table going, "WTF IS HE TALKING ABOUT?!", but yes, if you need any help, feel free to give me a holla. 

Relationship/Reputation tracking

11 years ago

Okay, I'm really starting to get the hang of this now. smiley

Got the basics of variables down, and now I'm playing around with IF THEN ELSE stuff.

I'm sure I'll have to get back with you guys later about the more complex stuff, but the articles have been extremely helpful so far.

Relationship/Reputation tracking

11 years ago

Quick question:

Is there any way to set things up so that any time a specific variable is, say, a multiple of 6, something happens? Or do I have to go in there and be all, 'if variable is 6 then do this' 'if variable is 12 then do this' etc.?

I hope there's an easier way because the that variable has the potential to get HUGE depending on how long you play...

Relationship/Reputation tracking

11 years ago

Interesting. I don't think it's possible within the current scripting architecture (I think we'd need looping or int() functions), if you can elaborate on the situation, I might be able to find a different system that will work.

Relationship/Reputation tracking

11 years ago

I have a WEEK and a MONTH variable; every time the player clicks a link, WEEK increases by one. After four clicks, WEEK increases MONTH by 1 and then resets itself. When MONTH reaches 6, an event happens and when MONTH is > 6 it's supposed to reset itself too.

I thought I would work without a hitch but the problem is that it takes four more clicks for the month to increase again, so that means that same event fires four times in a row. 

I'm sure I can figure out some way to make it do what I want once I get home, I was just checking here first on the off chance there was an easier solution that would let me do away with having all these separate variables altogether.

Relationship/Reputation tracking

11 years ago

Make another variable called SWITCH. Whenever Month is incremented by 1, set SWITCH to 1. After the event fires at 6 months, set SWITCH to 0. Make SWITCH = 1 a necessity for the event at six months to fire.
 

Relationship/Reputation tracking

11 years ago

So basically, you want an event to happen every six months?

%WEEK := %WEEK + 1

IF %WEEK = 6 THEN

BEGIN

%WEEK := 0

%MONTH := %MONTH + 1

END

IF %MONTH = 6 THEN

BEGIN

%MONTH := 0

%DEST := @P100

END

There you go. Every time month hits 6, it should bring you to that page. By the way, I think you're aware of this, but I'll remind you anyway. You have to put this code in the global link script in order for it to work out.

Relationship/Reputation tracking

11 years ago

She's already got a (slightly more refined) version of that script. The problem is that she doesn't want month 6 to only last 0 weeks, as I understand it. So, she wants it to reset when Month gets to 7, not 6, but she doesn't want the event to fire 4 times. She needs a boolean variable to accomplish this.

Relationship/Reputation tracking

11 years ago

Hold on. You mean she want the event to last for four pages? I don't understand.

Relationship/Reputation tracking

11 years ago

She wants Month 6 to last for 4 pages but she only wants the event to last for 1.

Relationship/Reputation tracking

11 years ago

%WEEK := %WEEK + 1

IF %WEEK = 6 THEN

BEGIN

%WEEK := 0

%MONTH := %MONTH + 1

END

IF %MONTH = 6 THEN

IF %SWITCH = 0 THEN

BEGIN

%DEST := @P100

%SWITCH := 1

END

IF %MONTH = 7 THEN

BEGIN

%MONTH := 0

END

There. Now, it works.

Relationship/Reputation tracking

11 years ago

Yep, that's exactly what I'd reccomend! Nicely done, Nmel, you're getting very good.

Relationship/Reputation tracking

11 years ago

Oh, yeah. I forgot to set switch to 0 afterwards. And thanks. :D

%WEEK := %WEEK + 1

IF %WEEK = 6 THEN

BEGIN

%WEEK := 0

%MONTH := %MONTH + 1

END

IF %MONTH = 6 THEN

IF %SWITCH = 0 THEN

BEGIN

%DEST := @P100

%SWITCH := 1

END

IF %MONTH = 7 THEN

BEGIN

%MONTH := 0

%SWITCH := 0

END