Anim Follow20 #Idle Grab
@script
void self = getlocalvar("self");
// Включаем физику, чтобы персонаж падал, если не на земле
changeentityproperty(self, "subject_to_gravity", 1);
changeentityproperty(self, "subject_to_platform", 1);
changeentityproperty(self, "antigravity", 0);
int p_index = getentityproperty(self, "playerindex");
int keys = getplayerproperty(p_index, "keys");
int newkeys = getplayerproperty(p_index, "newkeys");
int deadline = getentityvar(self, "grab_deadline");
int now = openborvariant("elapsed_time");
if(deadline == NULL()){
setentityvar(self, "grab_deadline", now + 3000);
} else if(now > deadline){
setentityvar(self, "grab_deadline", NULL());
changeentityproperty(self, "animation", openborconstant("ANI_Follow22"), 1);
return;
}
float vx = 0;
float vz = 0;
int moving = 0;
if(keys & openborconstant("FLAG_MOVEUP")){ vz = -1.5; moving = 1; }
if(keys & openborconstant("FLAG_MOVEDOWN")){ vz = 1.5; moving = 1; }
if(keys & openborconstant("FLAG_MOVERIGHT")){ vx = 1.5; changeentityproperty(self, "direction", 1); moving = 1; }
if(keys & openborconstant("FLAG_MOVELEFT")){ vx = -1.5; changeentityproperty(self, "direction", 0); moving = 1; }
// Получаем текущую вертикальную скорость (tossv)
float vy = getentityproperty(self, "tossv");
// Устанавливаем скорость, сохраняя вертикальную составляющую
changeentityproperty(self, "velocity", vx, vz, vy);
if(moving){
setentityvar(self, "grab_deadline", now + 3000);
if(getentityproperty(self, "animationid") != openborconstant("ANI_Follow21"))
changeentityproperty(self, "animation", openborconstant("ANI_Follow21"), 1);
} else {
if(getentityproperty(self, "animationid") != openborconstant("ANI_Follow20"))
changeentityproperty(self, "animation", openborconstant("ANI_Follow20"), 1);
// Останавливаем горизонтальное движение, не трогая вертикаль
changeentityproperty(self, "velocity", 0, 0, vy);
}
if(newkeys & (openborconstant("FLAG_ATTACK") | openborconstant("FLAG_ATTACK2"))){
setentityvar(self, "grab_deadline", NULL());
changeentityproperty(self, "animation", openborconstant("ANI_Follow22"), 1);
return;
}
@end_script
Loop 1
Delay 1
Offset 57 98
Bbox 55 53 11 44
NoKill 1
@cmd depost2 0 4 30 0
@cmd position 2 5 48 1 0
Frame Data/Chars/Dragons/Grab_Walk_01.png