1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Classic Shield Bashing?

Discussion in 'Modding Help' started by Shadowblitz16, Aug 25, 2017.

  1. Shadowblitz16

    Shadowblitz16 Ballista Bolt Thrower

    Messages:
    158
    hello I was trying to create classic shield bashing in kag by messing around with this in knight logic..

    Code:
    void onCollision(CBlob@ this, CBlob@ blob, bool solid, Vec2f normal, Vec2f point1)
    {
        //return if we didn't collide or if it's teamie
        if (blob is null || !solid || this.getTeamNum() == blob.getTeamNum())
        {
            return;
        }
    
        const bool onground = this.isOnGround();
        if (this.getShape().vellen > SHIELD_KNOCK_VELOCITY || onground)
        {
            KnightInfo@ knight;
            if (!this.get("knightInfo", @knight))
            {
                return;
            }
    
            //printf("knight.stat " + knight.state );
            if ((knight.state == KnightStates::shielddropping || knight.state == KnightStates::shielding) && (!onground) && (blob.getShape() !is null && !blob.getShape().isStatic()) && getKnocked(blob) == 0) //added KnightStates::shielding
            {
                Vec2f pos = this.getPosition();
                Vec2f vel = this.getOldVelocity();
                vel.Normalize();
    
                //printf("nor " + vel * normal );
                if (vel * normal < 0.0f && !knight_has_hit_actor(this, blob))
                {
                    ShieldVars@ shieldVars = getShieldVars(this);
                    //printf("shi " + shieldVars.direction * normal );
                    if (shieldVars.direction * normal < 0.0f)
                    {
                        knight_add_actor_limit(this, blob);
                        print("Test");
                        Vec2f force = Vec2f(shieldVars.direction.x * this.getMass(), -this.getMass()) * 3.0f; // also tried messing with this multiplier 
                       
                        this.server_Hit(blob, pos, force, 0.0f, Hitters::shield); // changed this to force to try to add more knockback
    
                        blob.AddForce(force);
                        this.AddForce(Vec2f(-force.x, force.y));
                    }
                }
            }
        }
    }
    

    but it still doesn't work still and is very buggy is collision and knockback.

    I have also come across this code in knightlogic.as
    Code:
    //a little push forward
    
    void pushForward(CBlob@ this, f32 normalForce, f32 pushingForce, f32 verticalForce)
    {
        f32 facing_sign = this.isFacingLeft() ? -1.0f : 1.0f ;
        bool pushing_in_facing_direction =
           (facing_sign < 0.0f && this.isKeyPressed(key_left)) ||
           (facing_sign > 0.0f && this.isKeyPressed(key_right));
        f32 force = normalForce;
    
        if (pushing_in_facing_direction)
        {
            force = pushingForce;
        }
    
        this.AddForce(Vec2f(force * facing_sign , verticalForce));
    }
    
    but I don't see it being called anywhere.


    can someone explain how classic shield bashing worked and how to reimplement it?
     
  2. Eluded

    Eluded Bison Rider

    Messages:
    128
    I could help but I don't know what classic shield bashing was like.

    Could you explain?
     
  3. kiaran

    kiaran Ballista Bolt Thrower
    1. Aphelion's Roleplay

    Messages:
    76
    well, if i remember correctly, you use your shield in someway to knockback people. never used it myself. this was before shield skiing or whatever.
     
  4. bunnie

    bunnie Haxor Tester

    Messages:
    1,290
    you slightly jump forward and shield forward in the direction of the enemy (if you jump right you shield right) to stun him and knockback him quite a bit away (a few blocks)
    basically the same effect as shield sliding into someone but you need to jump, shield FORWARD and it stuns and knockbacks more
     
    PussyDestroyer likes this.