Hi, I'm searching a suggestion on how to use the Expression Engine in this situation!
In the game I'm building, i'm implementing a sort-of Dating Sim mechanic where the main character can decide which characters to spend time with, and increase his relationship with them.
To do this, I'm creating a variable for each character, with an hidden "score" that shows the level of friendship with the MC.
(example: Athena variable, value of 2)
Now, like Persona 5, I wanted to implement "free time" spaces, where the player can freely chose which character he should raise as a friend.
To do this, i created a variable called "FreeTime", asked a question with 4 options, and depending on the result, I stored the name of the character the player wants to spend time with in the "FreeTime" value (example: FreeTime variable, value: Athena)
Now, is there a way to tell the game to do this?
1) Check FreeTime Variable
2) Add 1 to the Variable whose name is equal to the Value of the FreeTime Variable
So, using my example, it would be:
Check FreeTime: FreeTime = Athena
Add 1 to "Athena" variable
Is this possible to do without using a bajillion of frames?
Indirect Reference (Expression Engine)
Moderator: EN - Forum Moderators
- RashFaustinho
- Posts: 16
- Joined: Fri Jun 03, 2016 11:34 pm
- Gender: Male
- Spoken languages: English
- Enthalpy
- Community Manager
- Posts: 5217
- Joined: Wed Jan 04, 2012 4:40 am
- Gender: Male
- Spoken languages: English, limited Spanish
Re: Indirect Reference (Expression Engine)
I don't think you can, but this should be an easy problem. What we'd need to add is a way to go from a string that specifies a variable name to the value of the variable named by that string...
I'll consider this to be included in the next AAO update or two.
I'll consider this to be included in the next AAO update or two.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
-
- Posts: 469
- Joined: Sat Sep 27, 2014 6:46 pm
- Gender: Male
- Spoken languages: English, français, un poco de español, עברית
- Location: USA
Re: Indirect Reference (Expression Engine)
In the meantime, it shouldn't take a bajillion frames to do this, I think you would only need two frames for each response plus the "check the value of FreeTime" frame. That frame should redirect to all of the other options based on what the response is. At each of those frames, you can increment the relevant variable and then at the next frame, redirect to where you want the dialog to continue.
- RashFaustinho
- Posts: 16
- Joined: Fri Jun 03, 2016 11:34 pm
- Gender: Male
- Spoken languages: English
Re: Indirect Reference (Expression Engine)
I noticed just now that if I use the expression check on variable's name, and set just "FreeTime" as expression, the game automatically picks the value of FreeTime as the name of Variable.
That might solve the problem about the variable's name itself, the only thing I need to understand now is how to tell him to add 1 to the score.
Isn't there a way to write "add 1" in a generic way, without writing "variable+1" in the expression engine?
Obviously, the easier is this to set-up, the more characters I would add.
That might solve the problem about the variable's name itself, the only thing I need to understand now is how to tell him to add 1 to the score.
Isn't there a way to write "add 1" in a generic way, without writing "variable+1" in the expression engine?
It could (potentially) take a lot of frames, depending on how many characters will be implemented in this dating-sim-like mechanic.In the meantime, it shouldn't take a bajillion frames to do this, I think you would only need two frames for each response plus the "check the value of FreeTime" frame.
Obviously, the easier is this to set-up, the more characters I would add.
- Enthalpy
- Community Manager
- Posts: 5217
- Joined: Wed Jan 04, 2012 4:40 am
- Gender: Male
- Spoken languages: English, limited Spanish
Re: Indirect Reference (Expression Engine)
That's what I was trying to say. It is specifically that task that I don't think AAO supports right now.
I would like to see that change, but it won't happen overnight, sadly.
I would like to see that change, but it won't happen overnight, sadly.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
- RashFaustinho
- Posts: 16
- Joined: Fri Jun 03, 2016 11:34 pm
- Gender: Male
- Spoken languages: English
Re: Indirect Reference (Expression Engine)
I see, mmmh.
I'm thinking of a workaround right now, since Indirect Reference is not possible, maybe I can use a temporary variable to "store" the character's score, and then update it at the end.
That would take 1 or 2 additional frames per character at most.
Something like
Frame 1: Pick a character (store FreeTime value)
Frame 2: Set Temporary Score (TempScore Variable = That character value) 1 additional frame per char
Frame 3: Add or reduce by 1 TempScore, depending on choices.
Frame 4: Set the character's variable equal to TempScore (using "FreeTime as expression" as the name of the variable)
I'll try this one.
EDIT: Ok, this seems to work just fine, so I'll take it.
Thanks for the answers!
I'm thinking of a workaround right now, since Indirect Reference is not possible, maybe I can use a temporary variable to "store" the character's score, and then update it at the end.
That would take 1 or 2 additional frames per character at most.
Something like
Frame 1: Pick a character (store FreeTime value)
Frame 2: Set Temporary Score (TempScore Variable = That character value) 1 additional frame per char
Frame 3: Add or reduce by 1 TempScore, depending on choices.
Frame 4: Set the character's variable equal to TempScore (using "FreeTime as expression" as the name of the variable)
I'll try this one.
EDIT: Ok, this seems to work just fine, so I'll take it.
Thanks for the answers!
- Jofe
- Posts: 14415
- Joined: Fri Jun 10, 2011 1:44 am
- Gender: Male
- Spoken languages: Français [100%], English [70%]
Re: Indirect Reference (Expression Engine)
Maybe I'm misunderstood what you want, but I think you can.
I made a quick exemple:
In the editor:
Frame 2 et 4 are only here for the exemple, to show that the calculation was successful.
I define the original variable in the frame 1.
Frame 1:
I With "Define new variables" advanced mode, I made the calculation in frame 3.
Frame 3:
Ingame, it look like that.
After the frame 3, +1 was added to the variable "athena".
Afterwards, you just have to trigger the events you want depending on the value of the variable. And avoid that the message is replayed if it is not wanted, otherwise it will add "+1" to the variable each time the message is replayed.
I made a quick exemple:
In the editor:
Frame 2 et 4 are only here for the exemple, to show that the calculation was successful.
I define the original variable in the frame 1.
Frame 1:
Spoiler : :
Frame 3:
Spoiler : :
After the frame 3, +1 was added to the variable "athena".
Afterwards, you just have to trigger the events you want depending on the value of the variable. And avoid that the message is replayed if it is not wanted, otherwise it will add "+1" to the variable each time the message is replayed.
- RashFaustinho
- Posts: 16
- Joined: Fri Jun 03, 2016 11:34 pm
- Gender: Male
- Spoken languages: English
Re: Indirect Reference (Expression Engine)
That couldn't ve been used only if I wanted to create a setup specific for each character, which I didn't want to.
The reason I cannot use "Athena" directly is because there are other characters, that variable changes with the choises of the player (that's the reason there was a "FreeTime" value to begin with), and this mini-game i'm planning is a bit complicated, it's not just adding a +1 (I know I described it like that, but still, it was to get to the point), but there will be a calendar system, a way to lose points, stuff like that.
It's not a problem anymore though, with the setup I wrote earlier I managed to find a good way to archive what I'm trying to accomplish:
The reason I cannot use "Athena" directly is because there are other characters, that variable changes with the choises of the player (that's the reason there was a "FreeTime" value to begin with), and this mini-game i'm planning is a bit complicated, it's not just adding a +1 (I know I described it like that, but still, it was to get to the point), but there will be a calendar system, a way to lose points, stuff like that.
It's not a problem anymore though, with the setup I wrote earlier I managed to find a good way to archive what I'm trying to accomplish:
RashFaustinho wrote:I see, mmmh.
I'm thinking of a workaround right now, since Indirect Reference is not possible, maybe I can use a temporary variable to "store" the character's score, and then update it at the end.
That would take 1 or 2 additional frames per character at most.
Something like
Frame 1: Pick a character (store FreeTime value)
Frame 2: Set Temporary Score (TempScore Variable = That character value) 1 additional frame per char
Frame 3: Add or reduce by 1 TempScore, depending on choices.
Frame 4: Set the character's variable equal to TempScore (using "FreeTime as expression" as the name of the variable)
I'll try this one.
EDIT: Ok, this seems to work just fine, so I'll take it.
Thanks for the answers!