Page 1 of 1

"On Variable Changed [Increased/Decreased]" Condition

PostPosted: Sun Mar 22, 2015 8:35 am
by tlbainter
Hey there,

So I'm not sure if I'm overlooking a feature, but I haven't been able to find information on a way to perform a check to see if a variable has been decreased or increased in-game. Essentially, I'm trying to simplify health-decrease events. Right now, when my player is injured, the following actions are performed:

] Subtract 1 from PlayerHP [Global Variable]
] Player flashes for 0.6 seconds
] Play sound

The issue I'm having is really one of time and bulky coding [I do my best to keep everything as concise and easily-changed as possible]. Having to add the flashing and sounds is tedious, and if I ever want to add other effects to the player's injury (I intend to add different animations and random sounds later on), I will have to go back through each instance of the player's reactions and add the new effects.

In essence, I'm trying to figure out if there's a way to create a single event which reacts to a decrease in the player's health (any number subtracted from the global variable PlayerHP). That way, I only have to add the ]Subtract 1 from PlayerHP action to the injury events, and all of the player-based reactions can be kept concisely in one, easily-altered event.

If you have any ideas or if I'm overlooking an obvious feature, let me know! Thanks.

Re: "On Variable Changed [Increased/Decreased]" Condition

PostPosted: Sun Mar 22, 2015 9:29 am
by Aphrodite
I am not sure in your case it is the best way, we never know but maybe one day you will need to reduce the player HP without doing anything, I think perhaps a function that will do those 3 things is a better way to go, as you just have to edit the function once if needed.

still think your suggestion can be useful though

Re: "On Variable Changed [Increased/Decreased]" Condition

PostPosted: Mon Mar 23, 2015 1:58 pm
by tlbainter
Hey Aphrodite -
Yeah, I've figured that that'll be the easiest way to go right now. Thanks :)