Adding Status Effects

Hi! I was wanting to add a "bleeding" effect the player can get. I want it so it wears off over time, or if you use an item. But I just can't seem to find out how to add the bleed timer. (how it wears off)

PS: If you find a way to do it, thanks a TON!


Honestly, it's not my type of stuff, but as far as I know, you may make use of turn scripts or just the rooms to create the "bleeding effect". It depends a little about how much you want the player bleeds. If you use it in a turn script, it will happen every time the player uses a command. If you attach it to rooms, it will happen every time the player moves around.

The bleeding itself is not hard to create, and there are multiple ways to do it. You may have a bleeding attribute that I suppose will start at zero. Every turn (or at room) the player's health is health - bleeding.

The other way is just flag it. player.bleed would be your flag and IF the flag is TRUE, then health is health - X, where X is a fixed value for bleeding.

As you want to wear off the bleeding through time, perhaps you'll need the attribute instead the flag. The attribute "bleeding" may be changed over time, what means your rooms or turns will need a script to make bleed - bleed - X every time. Pay attention to check if bleeding is below zero, or the player will increase health over time.

Perhaps what you will need is a function, which is a collection of scripts excecuted all together at once. At every adequate moment, the game runs the script and applies bleeding, reduces bleeding and checks if bleeding is below zero, turning it into zero if it is too low.

I never used turn scripts, but I know if you put this function on "before enetering" or "after entering" each room, it will work. But the only way I know doing it is placing the function at every single room you create, unless you use turn scripts.

If you cannot figure out how to create the scripts and the function, I may give you a hand on code limited by my scarse knowledge.


But I just can't seem to find out how to add the bleed timer. (how it wears off)

That would depend on how you want it to work. Do you want it to wear off after a number of turns? A turnscript will run after every command the player enters (unless those commands have turnscripts suppressed), so you can write a script that will keep some kind of counter, or a random chance, to determine how long its effect lasts.

The hard part of this task isn't writing the code – it's deciding how you want it to work. There are a bunch of different ways you could do it, and you need to choose which one you prefer. For example, is bleeding always the same, or are there different levels of bleeding? Does it run for a certain time and then stop, or does it have a certain % chance of stopping each turn? Does how long it lasts depend on how bad it is? Can you have more than one bleeding at the same time; and do they get combined somehow or run in parallel?

Think about how you want it to work in detail. If you can specify that, someone might be able to help you if you're still having a problem with the code.


I never used turn scripts, but I know if you put this function on "before enetering" or "after entering" each room, it will work. But the only way I know doing it is placing the function at every single room you create, unless you use turn scripts.

There's a "Script when entering a room" or something like that on the game's "Scripts" tab. Corresponds to the game.roomenter attribute, which is run immediately after showing the room description for every room entered. (Between the "before entering" and "after entering" scripts for individual rooms)


Log in to post a reply.

Support

Forums