maxman
Well-known member
I have some issues with how the character interacts with the bottom of the platform (or ceiling). I got that climbing script on ceiling working, but when I'm dropping myself after the jumping momentum and touching the bottom of the platform overhead, I'm able to grip while being a bit far away from the ceiling and it's weird. Also, while gripping the ceiling, I can move only right, but I cannot move left. How am I going to press left after making this keyscript for it? How can I make the character grip the ceiling overhead without gripping far away from it?
Character text file:
wolvkey.c:
wolvOnMoveA.c:
onBlockPScript.c:
I will ask about climbing on walls later. For now, my issue is the ceiling.
Character text file:
name wolvietype playerhealth 100#mpset 100 0 100 2speed 7shad - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pastebin.com
wolvkey.c:
C:
void main(){
int index = getlocalvar("player");
void self = getplayerproperty(index, "entity");
void aniID = getentityproperty(self, "animationid");
int dir = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int z = getentityproperty(self, "z");
int y = getentityproperty(self, "a");
int frame = getentityproperty(self, "animpos");
// Holds
void UpH = playerkeys(index, 0, "moveup");
void RightH = playerkeys(index, 0, "moveright");
void LeftH = playerkeys(index, 0, "moveright");
void DownH = playerkeys(index, 0, "movedown");
void JumpH = playerkeys(index, 0, "jump");
// Presses
void Up = playerkeys(index, 1, "moveup");
void Right = playerkeys(index, 1, "moveright");
void Left = playerkeys(index, 1, "moveright");
void Down = playerkeys(index, 1, "movedown");
void Jump = playerkeys(index, 1, "jump");
// Releases
void UpR = playerkeys(index, 2, "moveup");
void RightR = playerkeys(index, 2, "moveright");
void LeftR = playerkeys(index, 2, "moveright");
void DownR = playerkeys(index, 2, "movedown");
void Plat = checkplatformabove(x, z, y+1);
//void PlatSide = checkplatformbetween(x, z, y+0, y+14); // checkplatformbetween(x,z,ymin,ymax);
int Length; int Px; int Py; void PlatA; void PlatB; int Wall;
int PlatY = getentityproperty(Plat, "y");
void PlatBase = getentityproperty(Plat, "base");
/*
if(Plat){
Length = getentityproperty(Plat, "antigrab");
Px = getentityproperty(Plat, "x");
}
*/
//Grip the ceiling
if(UpH && Plat){
if(aniID == openborconstant("ANI_JUMP") ){
changeentityproperty(self, "subject_to_gravity", 0);
changeentityproperty(self, "aiflag", "jumping", 0);
Length = getentityproperty(Plat, "antigrab");
Px = getentityproperty(Plat, "x");
Py = getentityproperty(Plat, "a");
performattack(self, openborconstant("ANI_FOLLOW8"));
}
}
/*
if(Plat){
if(aniID == openborconstant("ANI_FOLLOW8")){
if(LeftR || LeftR){
if(!LeftH && !RightH){
changeentityproperty(self, "velocity", 0, 0, 0);
}
}else if(Left){
changeentityproperty(self, "velocity", -1, 0, 0);
changeplayerproperty(self, "playkeys, 0);
performattack(self, openborconstant("ANI_FOLLOW5"));
}else if(Right){
changeentityproperty(self, "velocity", 1, 0, 0);
changeplayerproperty(self, "playkeys, 0);
performattack(self, openborconstant("ANI_FOLLOW5"));
}
}
}
if(aniID == openborconstant("ANI_FOLLOW5")){
if(LeftR || LeftR){
if(!LeftH && !RightH){
changeentityproperty(self, "velocity", 0);
performattack(self, openborconstant("ANI_FOLLOW8"));
}
}
}
}
*/
// Move around the ceiling
if(aniID == openborconstant("ANI_FOLLOW8")){
if(LeftR || RightR || DownR){
if(!LeftH || !RightH || !DownH ){
changeentityproperty(self, "velocity", 0, NULL(), NULL());
//changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
}
}
if(Left){
changeentityproperty(self, "direction", 0);
changeentityproperty(self, "velocity", -1.5, NULL(), NULL());
changeplayerproperty(self, "playkeys", 0);
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
//performattack(self, openborconstant("ANI_FOLLOW5"));
}if(Right){
changeentityproperty(self, "direction", 1);
changeentityproperty(self, "velocity", 1.5, NULL(), NULL());
changeplayerproperty(self, "playkeys", 0);
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
//performattack(self, openborconstant("ANI_FOLLOW5"));
}
if(DownH && Jump){
//tossentity(self, -1, 0, 0);
performattack(self, openborconstant("ANI_FREESPECIAL4"));
changeentityproperty(self, "subject_to_gravity", 1);
changeentityproperty(self, "aiflag", "jumping", 1);
}
}
if(aniID == openborconstant("ANI_FOLLOW5")){
if(LeftR || RightR){
if(!LeftH || !RightH){
changeentityproperty(self, "velocity", 0, NULL(), NULL());
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW8"));
}
}
}
}
wolvOnMoveA.c:
C:
void main(){
void self = getlocalvar("self");
void ani = getentityproperty(self, "animationid");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "y");
int z = getentityproperty(self, "z");
int Vy = getentityproperty(self, "tossv");
void Plat = checkplatformabove(x, z, y);
if(ani == openborconstant("ANI_FOLLOW8") && Plat ){
changeentityproperty(self, "velocity", 0, 0, 0);
//changeentityproperty(self, "y", y+20);
}
}
onBlockPScript.c:
C:
void main()
{
void self = getlocalvar("self"); //Get calling entity.
//int index = getentityproperty(self, "playerindex");
//int up = playerkeys(index, 0, "moveup");
//int right = playerkeys(index, 0, "moveright");
//int left = playerkeys(index, 0, "moveleft");
//int down = playerkeys(index, 0, "movedown");
//int x = getentityproperty(self, "x);
//int z = getentityproperty(self, "z");
//int y = getentityproperty(self, "y");
void platform = getlocalvar("platform"); //Get calling entity.
//void aniID = getentityproperty(self, "animationid");
float selfH = getentityproperty(self,"y")+getentityproperty(self,"height"); //get player height
float platformH = getentityproperty(platform,"y")+getentityproperty(platform,"height"); //get platform height
float hang = platformH - getentityproperty(self,"aggression");
//float H = checkplatformbelow(x, z, y);
if(selfH > platformH && getentityproperty(self, "animationid")==openborconstant("ANI_JUMP"))
{
changeentityproperty(self, "velocity", 0, 0, 0); //Stop momentum!
changeentityproperty(self, "antigravity", 1);//stop falling
changeentityproperty(self, "y",hang); //change altitude to match platform
changeentityproperty(self, "animation", openborconstant("ANI_freespecial3"));
}
}
I will ask about climbing on walls later. For now, my issue is the ceiling.