Alright, I'm here out of desperation.
Here's my problem. I have a HEALTH variable that starts at 100 but can go down to 0. Now, I have a 'Game Over' page, and I set the HEALTH variable page so that when it goes below 1 it automatically travels to the Game Over page. Only it doesn't work.
Next, I try to run the following script as a global link on the Scripting 'tab':
IF %HEALTH := 0
THEN $DEST := @P163
There's nothing reportedly wrong with the script, but it still doesn't work. When previewing, I never transport to the Game Over page when my health is zero, no matter how many links I click.
I've read comments about this happening in people's storygames, so it's possible that it's a bug - but I doubt something so basic could be bugged like this: at least, I really hope so.
Is there a way to script this? Am I doing something wrong? I'm just searching for any answer besides me pasting the same exact script into over 200 different links.
IF %HEALTH = 0
:= is only for assignment.
Sorry, the := between %HEALTH and 0 was a mistake on my part. In the actual script, I did only use =.
As for BEGIN/END, I tried it out and strangely it still doesn't work.
My script was:
IF %HEALTH = 0
THEN $DEST := @P163
It seems that no matter what value I compare the variable to, it just doesn't register.
The exact same code, however, works fine if I put it in a specific link script. It's just when I try to put it as a global link it somehow stops.
It's possible for me to brute-force this by copying and pasting the same lines of code, but I'd like to avoid that if necessary.
Does the variable being 0 have an adverse affect sometimes?
Is it possible that I could add you as a co-author instead, at least temporarily- so you could see the scripts instead of just the game? Looking over everything I have related to that variable, I don't see any other errors, but it might just be my incompetence.
(Also, I went to sleep for 8 hours which is why I'm so late in responding)
Ah, I didn't realize. Sorry for the misunderstanding.
The title is 'Discretion of a Sleuth': cringey, I know.
The minimum value for the variable is 0: I tried setting it lower but it doesn't help.
Still doesn't work, oddly.
The 'Editor Features' on the 'Story Properties' tab lists Scripting as Advanced, but there's still no sign of change.
I think I'll probably just copy and paste the same script into each link script. I won't need to put it into every single link, and although the task will be boring it won't be painful.
I'm very thankful that a lot of people tried to help, though. If you have any other suggestions, I'll certainly try them out, but I don't have high hopes.
I have tried changing = to <. For example:
IF %HEALTH < 1
THEN $DEST := @P163
I've also tried having it be less than 0 (when I changed the variable so that it could go below 0) and I also tried having it being less than 5 (since in my game you can only lose 5 or 10 health at a time), and neither of them work.
Oh yeah, since you guys are viewing my game right now, I should point out that the variable is %INFLUENCE, not %HEALTH (although you probably figured that out already). They serve the same purpose, however- it functions exactly like a health meter.
The problem might be that I didn't add these variable specifications in the beginning: I created the variable and wrote all the pages in the game, but added the 'Game Over' page last and only made the variable go to that page when it goes under a certain value afterwards. Meaning I wrote the whole story first before adding the global link.
The weirdest part for me, though, is that it's only a problem with the global link script: I tried putting it in a single link script and it worked fine providing I clicked on that specific link.
Alright, I'll explain it more thoroughly. I realize now I glossed over a lot of the stuff I thought was self-explanatory when it really wasn't. Sorry about that.
In the game, you play as a Detective. During the bulk of the game you are part of a large debate, in which you are trying to guide a bunch of people to the correct conclusion in a case. At a lot of points in the debate, you'll be asked to choose a person who meets certain criteria, select a piece of evidence you gathered, etc, which is done through links. Choosing the wrong option takes away some of your %INFLUENCE, which functions like a health bar. Influence starts at 100 and can go down to 0 by getting enough things incorrect. Links that lead the Detective to the incorrect conclusion have variable commands assigned to them to subtract a certain amount of Influence. After I created the Influence variable and assigned these variable commands to the links after writing out the debate, I created the "Game Over" page. Then, I added the parameter to %INFLUENCE stating that if the value went below 1, it would take the player to this "Game Over" page.
However, this did not work after I play-tested it. I got my Influence down to 0, the minimum value, after selecting enough links that subtracted my Influence. However, the value stayed at 0 without ever taking me to the Game Over page. Thinking this was strange, I then tried to put that command into the Global Link Script. However, that also did not work. I played around with the variable and script a little but nothing yielded a proper result- I was never taken to the "Game Over" page.
I thought the basic content of my storygame was necessary to understand this. Sorry if this made things a little confusing, and if there's anything needing clarification just ask.
Sorry if everything before this was really confusing. I'm just an idiot.
Don't worry, the Influence variable is displayed on every page.
The "debate" section only starts with the Trial section.
Here are the first few points where you can lose influence:
I'll stop here b/c there's a lot more but it'll take forever to spell out.
I'm probably just going to brute-force this.
Ah, those I actually added recently. By 'brute-forcing' the problem, I just put the proper link script in every link you click after taking damage to check if you've reached zero. Those weren't there when I originally posted this.
Speaking of which, I should probably just straight up announce that the problem here is 'solved'. While I'd gladly take suggestions for a way to properly fix this problem, I've successfully brute-forced it and the game should be publishing in a day or two.
Sorry, I really should have updated this the moment I added everything.
Well, that's embarrassing. I didn't realize everyone could see when I unpublished something ...
Sorry about that. I won't do that so often.