Hi everyone!
I’m writing my very first (hopefully) hosted game based on Monkey Island and Pirates of the Caribbean.
I have a question: is there a way to “make something happen” whenever in the story a chosen stat reaches 0?
Or should I check the stat EVERY time I modify it?
My ideal goal is finding a way, so WHENEVER in the story the chosen stat reaches 0, you go to a (bad) ending.
I hope I clearly explained myself, and I sincerely hope there is a way to accomplish what I’d like to do.
Thank you in advance for all your kind advice, your time, and your patience.
Yes, you have to check the stat every time you modify it. ChoiceScript isn’t an event-driven language, there’s no way to automatically “fire” events like that.
*set variable_1 +1
*gosub_scene check_variables variable_1
...
(in scene check_variables)
*label variable_1
*if variable_1 >= 1
*some sort of command here
*other stuff if you need it
*even more stuff if you need it
*return
This was basically the entire engine for my “increase the character’s age” subroutine in A Kiss from Death which checked if a character’s age was beyond a certain threshold in which case a scene would trigger to further the plot.
And yeah I had to gosub for each and every age increase in the entire game.
For example the weapon choice in unnatural is only written once in a single scene which I used *gosub_scene weapon_choice whenever I want players to pick a gun.
I still have to send the player to the scene each time they have to choose a gun but using *gosub_scene allows me to only have to write out the gun code once but can send players to it every time I want.
Sorry I thought I already answered your previous question @Nocturnal_Stillness
If the stat reaches 0 the ending is the same. Thank you for your time and your advice