Script for one stage only

Mardion

New member
Hi all. After reading up on the manuals, I'm still unsure on how to create a script that will be active for the entirety of a stage, and that stage only. Can someone please tell me if that is possible?

Context (probably unneeded) : I've created submission-type grabs from which the player has to hit certain buttons to escape ; even if their health becomes zero they still cannot escape until they hit those buttons (and then they can die in peace). But there's one specific stage in which I want to surprise the player ; in that one when their health reaches zero, they lose a life and their health shoots back to 100% *while they're still trapped in this grab*. It's easy enough to create script that sets lives to lives-1 and health equal to maxhealth, but how do I make that script valid just in that one specific stage?
 
Welcome to the community @Mardion. There are several ways you could do this. It would help if we knew how you are handling your submission script in all the other stages.

DC
 
Thanks for replying. And here I thought my context was useless :P Well, if it helps : For the duration of the submission grab, damage is dealt via a "subdamage" script (in escript.c) which makes sure that the grabbed entity's health never drops below 1 :

void subdamage(int Damage){
void TargetHealth = getentityproperty(target,"health");
if(TargetHealth > Damage)
{
changeentityproperty(target, "health", TargetHealth - Damage);
} else {
changeentityproperty(target, "health", 1);
}}

When the player escapes the submission, I insert a separate instance of 2 damage , which is enough to kill them if they were at 1.

So, can you think of a way in which this behavior could change for one specific stage, and for that stage only?
 
It's doable, what you need to declare something to mark the stage, either with global variable or branch name. Then acquire those mark in the script to allow/disallow something.
To acquire current branch name with script, here's how to do it:
C:
void Stage = openborvariant("current_branch");

Here's example on how to use it:
C:
  if(Stage == "Ex"){
// run special script
  } else {
// run regular script
  }

If current branch name is Ex, it will run special script instead of regular script.
This script could crash if current level/stage doesn't have branch name declared though.
 
Back
Top Bottom