O Ilusionista
Captain 100K
Wall Jump without animationscript
Author: O Ilusionista
Version: V2 - 2019.01.26
Thanks: Bloodbane and Damon Caskey.
I've made an alternative way to use Wall Jump. Following a tip by DC, I decided to use another way to make this. OpenBOR already does a great job detecting when you are blocked by walls, platform, screen edge, obstacle.
What are the benefits of this method?
- The engine already does this check (and on a better way) so there is no need to build an animationscript for that - we are making the same job twice.
- Require just one script file - it's set and go, no need to copy and paste to different animations.
- We can check (not present on this version) for the wall index, so it could be set to work in some walls and not on other ones (I will ask if WD could add the Type check support, so it will be even better).
Code:
For memory optimization, we will be using two files
Save this as wallbounce.c in your scripts folder
Now save this as wallbounce_actual.c in your scripts folder)
Usage:
Add this to your character header
onblockWscript data/scripts/wallbounce.c*
*You should call wallbounce.c and not wallbounce_actual.c ok?
Just jump against a wall (and not screenedge) and press JUMP button in the middle air. The code won't trigger if you are too close to the ground. Your character will go to the "FOLLOW40" animation. Just make sure you have this animation and that you increased the "maxfollows" parameter in your models.txt
This code use something most modders (including myself) forget about:
Want to make it work against screen edges? Use it as "onblocksscript"
Want to make it work against Obstacles? Use it as "onblockoscript "
Want to make it work against Platforms? Use it as "onblockpscript "
The same logic can be for all other "onblock" scripts.
Quite simple, huh?
Author: O Ilusionista
Version: V2 - 2019.01.26
Thanks: Bloodbane and Damon Caskey.
I've made an alternative way to use Wall Jump. Following a tip by DC, I decided to use another way to make this. OpenBOR already does a great job detecting when you are blocked by walls, platform, screen edge, obstacle.
What are the benefits of this method?
- The engine already does this check (and on a better way) so there is no need to build an animationscript for that - we are making the same job twice.
- Require just one script file - it's set and go, no need to copy and paste to different animations.
- We can check (not present on this version) for the wall index, so it could be set to work in some walls and not on other ones (I will ask if WD could add the Type check support, so it will be even better).
Code:
For memory optimization, we will be using two files
Save this as wallbounce.c in your scripts folder
Code:
#import "data/scripts/wallbounce_actual.c"
void main()
{
actual_main();
}
Now save this as wallbounce_actual.c in your scripts folder)
Code:
//Wall Jump without animationscript
//Author: O Ilusionista
//Version: V2 - 2019.01.26
//Thanks: Bloodbane and Damon Caskey.
void actual_main()
{
void vSelf = getlocalvar("self"); //Get calling player
void facing = getentityproperty(vSelf, "direction"); // Get Direction
void vAniID = getentityproperty(vSelf,"animationID"); //Get current animation ID
int iPIndex = getentityproperty(vSelf,"playerindex"); // Get player index
void iJump = playerkeys(iPIndex, 1, "jump"); //New key status of "Jump"
int y = getentityproperty(vSelf, "a"); // Get Y pos
int b = getentityproperty(vSelf, "base"); // Get Base pos
if(vAniID == openborconstant("ANI_JUMP") || vAniID == openborconstant("ANI_FORWARDJUMP") || vAniID == openborconstant("ANI_RUNJUMP"))
{ //Jumping, jumping forward or Run Jumping?
if (iJump && y > b+20)
{ //New jump key press and Y position is greater than the Base position by 20 pixels, so it won't trigger right when you start jumping?
changeentityproperty(vSelf, "aiflag", "jumping", 0); // Disable jumping aiflag, so the common jump routine won't take action
changeentityproperty(vSelf, "aiflag", "attacking", 1); // Enable attacking aiflag, so the common jumpattack routine won't take action
changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW40")); // Change to FOLLOW40 anim
}
}
}
Usage:
Add this to your character header
onblockWscript data/scripts/wallbounce.c*
*You should call wallbounce.c and not wallbounce_actual.c ok?
Just jump against a wall (and not screenedge) and press JUMP button in the middle air. The code won't trigger if you are too close to the ground. Your character will go to the "FOLLOW40" animation. Just make sure you have this animation and that you increased the "maxfollows" parameter in your models.txt
This code use something most modders (including myself) forget about:
onblockWscript {path}
~This command defines which script is run when entity is blocked by walls
==For script coding reference==
self: Caller.
plane: Plane of movement blocked.
1 = X
2 = Z
height: Height of blocking wall.
index: wall ID
Want to make it work against screen edges? Use it as "onblocksscript"
Want to make it work against Obstacles? Use it as "onblockoscript "
Want to make it work against Platforms? Use it as "onblockpscript "
The same logic can be for all other "onblock" scripts.
Quite simple, huh?