Target at Screen Pushing off Attacker Away

maxman

Well-known member
Before, this worked when I used one older version. But after using other later versions after that, it doesn't work like this anymore.
4-10-16 11-30-47 AM.gif

I remember forcing the fighter to be pushed back away like in the attachment after hitting one target at the corner of the screen.

painscript.c:
C:
void main(){
    forcePain();
}

void forcePain(){
    void vEnt = getlocalvar("self");
    int forcePain = getentityvar(vEnt, "forcePain");
    
    int DuckForcePain = getentityvar(vEnt, "DuckForcePain");
    int damage = getentityvar(vEnt, "damage");
    void vAniID = getentityproperty(vEnt, "animationid");
    void vTarget = getentityproperty(vEnt, "opponent");
    int hResolution = openborvariant("hResolution");
    int xPos = openborvariant("xpos");
    int x = getentityproperty(vEnt, "x");
    int Tx = getentityproperty(vTarget, "x");
    
    if(forcePain != NULL()){
        setentityvar(vEnt, "forcePain", NULL());
        changeentityproperty(vEnt, "animation", openborconstant("ANI_pain" + forcePain));
        if( x >= xPos+hResolution-1){
            changeentityproperty(vTarget, "velocity", -1.5, 0, 0);
        }else if(x <= xPos+1){
            changeentityproperty(vTarget, "velocity", 1.5, 0, 0);
        }
    }
    
    if(damage != NULL()){
        setentityvar(vEnt, "damage", NULL());
        changeentityproperty(vEnt, "attacking", openborconstant("ATK_NORMAL" + damage));
    }
    
    
    if(vAniID = openborconstant("ANI_DUCK")){
        if(DuckForcePain != NULL()){
            setentityvar(vEnt, "DuckForcePain", NULL()); //For anim pain
            updateframe(vEnt, DuckForcePain); // Change frame under the same pain animation
            if( x >= xPos+hResolution-1){
                changeentityproperty(vTarget, "velocity", -1.5, 0, 0);
            }else if(x <= xPos+1){
                changeentityproperty(vTarget, "velocity", 1.5, 0, 0);
            }
        }
    }
    
    
}

ondoattack.c:
C:
void main(){
    DuckPain();
    //DoubleHit();
}

void DuckPain(){
    
    void vEnt = getlocalvar("self"); //Calling entity
    
    if(getlocalvar("which") == 0){ // Defending
        void vAniID = getentityproperty(vEnt, "animationid"); // Calling animation ID
        int lastHitY = openborvariant("lasthity"); // Confirming or getting hit last from bottom as top (like from character's feet to head)
        
        if(vAniID == openborconstant("ANI_DUCK")){ // Is the player ducking?
            if(lastHitY >= 0){ // Detecting on the player for getting attacked last in Y
                setentityvar(vEnt, "DuckForcePain", 5); // Check the onpain script part for "DuckForcePain" that exists there and is set as entityvar. The value is a frame number for certain anim pain
            }
        }
    }
}

/*
void Parry(){
    void self = getlocalvar("self");
    void which = getlocalvar("which");
    
    if(which == 0){
        
    }
}
*/


void DoubleHit(){
    void self = getlocalvar("self");
    void vAniID = getentityproperty(self,"animationID");
    int dir = getentityproperty(self,"direction");
    int a1 = getentityproperty(self,"a");
    int attacktype1 = getlocalvar("attacktype");
    int attackid1 = getentityproperty(self,"attackid");
    int animpos1 = getentityproperty(self,"animpos");
    int damage1 = getlocalvar("damage");
    int drop1 = getlocalvar("drop");
    void other = getlocalvar("other");
    int Tdir = getentityproperty(other,"direction");
    int a2 = getentityproperty(other,"a");
    int which = getlocalvar("which");
    int attacktype2 = getlocalvar("attacktype");
    int attackid2 = getentityproperty(other,"attackid");
    int animpos2 = getentityproperty(other,"animpos");
    int damage2 = getlocalvar("damage");
    int drop2 = getlocalvar("drop");

    if ( which && getentityproperty(other,"exists") ) {
       attacktype1 = attackid1;
       attacktype2 = attackid2;
       drop1 = attackid1;
       drop2 = attackid2;
       damage1 = attackid1;
       damage2 = attackid2;
       changeentityproperty(self,"hitbyid",0);
    }

   // log("\nattacktype1" + "\nattacktype2" + "\ndrop1" + "\ndamage1" + "\nwhich" + "\nvAniID");

    if ( which && getentityproperty(other,"exists") && getentityproperty(self,"attacking") == 1 && getentityproperty(other,"attacking") == 1 && getentityproperty(self, "invincible") == 1 && getentityproperty(self, "vulnerable") != 1 && getentityproperty(other, "invincible") == 1 && getentityproperty(other, "vulnerable") != 1 && dir!=Tdir && a1==a2 && animpos1 <= 2 && animpos2 <= 2 ) {
       updateframe(other, 0);
       updateframe(self, 0);
       damageentity(other,self,damage1,drop1,attacktype1); //damageentity(entity, other, force, drop, type)
    }else if ( which && getentityproperty(other,"exists") && getentityproperty(self,"attacking") == 1 && getentityproperty(other,"attacking") == 1 && getentityproperty(self, "invincible") == 0 && getentityproperty(self, "vulnerable") != 0 && getentityproperty(other, "invincible") == 0 && getentityproperty(other, "vulnerable") != 0 && dir!=Tdir && a1==a2 && animpos1 <= 2 && animpos2 <= 2 ) {
       updateframe(other, 0);
       updateframe(self, 0);
       damageentity(self,other,damage2,drop2,attacktype2);
    }
}

Is there a way to get it working like it used to be? It's currently not working somehow.
 
Back
Top Bottom