Non-threaded

Forums » Writing Workshop » Read Thread

Find proofreaders here, useful resources, and share opinions and advice on story crafting.

Question about death in a game

9 years ago

I have the variable HEALTH, mmkay? So I have a 'Death' page, but when the character dies, it does not read the page the variable drops to zero, but goes to the death page, so the description of death is lost upon the reader.

Halp?

Question about death in a game

9 years ago

I think you set the link's script to put the variable as 0, so the script is running before the link opens and it goes directly to the Death page. Try changing the variable with a link on the description page instead. (I am talking about the right page, right? because I don't think you're trying to go to the description when the variable sets to 0, death might be different in different scenarios)

Question about death in a game

9 years ago

Death is pretty much the same... different ways to reach the zero variable. But I'm not sure how to display the damage hit before the Death page.

Question about death in a game

9 years ago

maybe don't use the value of death to go to the death page, but every time you can die make a link that has a IF THEN in the script that changes the destination to the death page if your health is low. That way you can see -5 or whatever the health is. ($DEST is how you reference destination in the script, just in case someone reads this who doesn't know. Basic Scripting in the help&info explains it)

Question about death in a game

9 years ago

So the IF THEN changes not the variable, but the next link on the page?

Question about death in a game

9 years ago

yes, the link bringing you to the hit takes your health

Question about death in a game

9 years ago

and then the link on the hit page has the IF THEN. Just wanted to clarify.

Question about death in a game

9 years ago

Can you reword the question? I am a bit confused as to what you are asking.

Question about death in a game

9 years ago

I have a Health Variable that says when it reaches zero, you die. Well, to die, I redirected the Variable reaching '0' to a page that ends the game- the Death Page.

But I want to actually display what the final injury was before the variable hits zero. Any ideas on how?

Question about death in a game

9 years ago

That's going to be tedious. But you could have a LASTINJ variable. Every time the player takes damage, the value of the LASTINJ variable is adjusted, and then you can do something like:

%%LASTINJ%=%1%His blade finally manages to pierce your ribcage. You spit up a little blood, then collapse.%%%%LASTINJ%=%2%A lucky arrow strikes you between the eyes, your face barely has time to adopt a look of shock before you fall over%%

Question about death in a game

9 years ago

Holy crap. I am not even scripting but am just inserting variables. I may need some help, as I have zero experience scripting. Just this is confusing me quite a bit, are you willing to help?

Question about death in a game

9 years ago

No, I did that wrong. You can't use on-page for what you are doing. Still, create LASTINJ, then go to your global script and insert something like:

IF %HEALTH = 0 THEN
IF %LASTINJ = 1 THEN $PAGETEXT := $PAGETEXT + "His sword finally pierces your ribcage. You cough up a bit of blood before collapsing, dead."

Question about death in a game

9 years ago

I'll mess around with it and get back to you.

Question about death in a game

9 years ago

Edit: Ignore the above post. I've gotten my shit together since then. See below.

Question about death in a game

9 years ago

If you already have a description page for each death, why not either have the end/continue links, or a link leading to the final death page on those pages?

Question about death in a game

9 years ago

I don't write deaths. I write things that do damage and lead to an eventual death.

Question about death in a game

9 years ago

It may be easier to have a death page for each battle.

Question about death in a game

9 years ago

Okay. I think I've refamiliarized myself with the CYS scripting language. What you are wanting to do is to address the player's cause of death on a certain page and then lead to a universal death page, if I understand correctly. The best (and only, as far as I know) way to do that is by using the global page script and the global link script. I assume that you already have a health variable and a variable to record damage done by an enemy (let's call these HEALTH and ENDAMDONE, respectively). We need to create another two variables, DEAD and LASTINJ, which will represent whether the character is dead and what the nature of the last injury was. LASTINJ is set when your character takes damage and corresponds to the kind of damage the character took (In this instance, a value of 1 means the last blow was dealt by a sword, while 2 indicates it was dealt by an arrow). I'll let you figure out how to set LASTINJ. The rest, however, is roughly as follows.

In your global link script, input:

IF %DEAD THEN
$DEST := @P37

IF %ENDAMDONE >= %HEALTH THEN %DEAD := 1

In your global page script, input:

IF %DEAD = 0 THEN
IF %LASTINJ = 1 THEN $PAGETEXT := $PAGETEXT = "His sword finally pierces your ribcage. You cough out a little blood before you collapse."

IF %DEAD = 0 THEN
IF %LASTINJ = 2 THEN $PAGETEXT := $PAGETEXT = "A Lucky arrow strikes you between the eyes. You barely manage a look of shock before you expire."

Edit: I know of one or two problems that exist with this approach, but they are mainly...cosmetic. Functionally, this should be exactly what you are looking for. Let me know how it works. If you need help, I would be willing to co-author, just long enough to get everything working for you.