[SCRIPT] Change branch by falling in holes

O Ilusionista

Captain 100K
This code let you force a branch jump if you fall into a specific type hole.

For memory sake, we need to use two files - one is just to import the second, to avoid the code to be compiled again each time you add on a new entity.

1- Save it as checkhole.c in your scripts folder
checkhole.c
Code:
#import "data/scripts/checkhole_actual.c"

void main()
{
    actual_main();
}


checkhole_actual.c
Code:
// Jump to a specific branch based on hole type
// Thanks Bloodbane and White Dragon for the help
// Douglas Baldan / O Ilusionista - 2018.07.28
// www.brazilmugenteam.com
void actual_main()
{
int Type = getlocalvar("type"); // Get hole type
void self = getlocalvar("self"); // Get caller
int y = getentityproperty(self,"y"); // Get Y pos
int HP = getentityproperty(self,"health"); // Get caller health
int Vy = getentityproperty(self,"tossv"); // Get Y velocity

if (Vy < 0 && y < -60 && HP > 10)
	{	
	switch(Type) 
		{ // check the hole Type
		case 1 : // Type 1
		jumptobranch("branch1", 1); // change "branch1" for the desired branch name, between quotes
		break;
		
		case 2 : // Type 2
		jumptobranch("branch2", 1); // change "branch2" for the desired branch name, between quotes
		break;
		
		//just copy and past the block above and change its value for more options
		
		default : // in case of none of above, continue with the normal behaviour  (die)
		break;
		}
	}
}

2- Call this script in your character header
inholescript data/scripts/checkhole.c

3- Set the hole TYPE. Works only in build 4287 and beyond.
hole {xpos} {zpos} {upperleft} {lowerleft} {upperright} {lowerright} {depth} {alt} {type}

For example, here is mine
hole 549 287 -180 -290 276 385 100 200 1

To add more options, just copy this part, change the values and paste before the "default" line:

Code:
case 2 : // Type 2
jumptobranch("branch2", 1); // change "branch2" for the desired branch name, between quotes
break;

The number 2 is an integer, so it should not be between quotes, ok?
 
After testing the builds one by one, I can confirm that this script works from OpenBOR v3.0 Build 4742 onwards.
 
O Ilusionista said:
Strange, because hole type was implemented only in  4287 version.

I did not know that my friend, what happens is that I tried the build before Build 4742, which is OpenBOR v3.0 Build 4701 and with this it did not work. That's why I figured that from here to there, it would not work.
Now that you clarified that point, I will continue testing the previous ones.
Thank you!
 
Well my friend, after a lot of new test I have more news.
I can confirm that the script does not work with any of these builds:

OpenBOR v3.0 Build 4701
OpenBOR_v3.0_Build_4682
OpenBOR_v3.0_Build_4665
OpenBOR_v3.0_Build_4642
OpenBOR_v3.0_Build_4626
OpenBOR_v3.0_Build_4624
OpenBOR_v3.0_Build_4596
OpenBOR_v3.0_Build_4583
OpenBOR_v3.0_Build_4580
OpenBOR_v3.0_Build_4574
OpenBor_v3.0_Build_4456
OpenBor_v3.0_Build_4453
OpenBOR_v3.0_Build_4432
OpenBOR_v3.0_Build_4287

As you can see, OpenBOR_v3.0_Build_4287 is included in the list.
With any of these builds, when the player falls into the hole it simply dies.

So I can reconfirm that this script works from OpenBOR v3.0 Build 4742 onwards.
 
Back
Top Bottom