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

Preventing bombers from one-shot ramming players

Discussion in 'Modding Help' started by Eluded, Nov 7, 2016.

  1. Eluded

    Eluded Haxor Official Server Admin

    Messages:
    132
    I'm working on a mod called Sky Battles which is essentially TDM with players flying bombers that have catapults attached to them. The server is available now if you want to try it.

    The problem I'm having is that if a bomber crashes into a player it causes an enormous amount of damage to them and kills them pretty much instantly. I am trying to reduce this damage for balance reasons but I cannot work out how to do it. I should note that I have added a hitbox to the bombers so that players can stand on them whilst they are flying - and it is this that is hitting into players from the enemy team.

    I thought that one of the scripts attached to the bomber might be causing the damage, such as HurtOnCollide.as or RunOverPeople.as, but neither of these are responsible - I tried removing all the scripts attached to the bomber except for Bomber.as which is vital to make it fly, and the damage was still present.

    I also tried to remove the damage by listening for it in the bomber's onHitBlob event. The KAG API offers these two hooks:

    f32 onHit( CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitterBlob, u8 customData )
    void onHitBlob( CBlob@ this, Vec2f worldPoint, Vec2f velocity, f32 damage, CBlob@ hitBlob, u8 customData )

    In the archer/knight's onHit hook I can see that the bomber is colliding with it, but the damage parameter is always 0. Normally the way this hook works is you return the modified damage - but if the damage is 0 then there's nothing to modify so it seems useless.
    In the bomber's onHit hook the actual damage can be seen and tends to be something like 2.1, which is more than 4 hearts and enough to insta kill a knight or archer. However this hook has no return value so there is no way to modify the damage before it happens. Healing the player after the damage is an option however they always just end up dead. I guess if a player's health falls below 0 at any point during a tick then they are marked as dead in the engine? I hope this explanation makes sense.

    Does anyone have any ideas about where this collision damage is coming from and how I can stop it? Would be very grateful for any advice :)
     
    Psiklaw likes this.
  2. HurtOnCollide.as for runners
     
    mcrifel likes this.
  3. Eluded

    Eluded Haxor Official Server Admin

    Messages:
    132
    Wow thanks, I feel stupid now - can't believe I didn't check for that script on runners too!
    --- Double Post Merged, Nov 9, 2016, Original Post Date: Nov 8, 2016 ---
    Having tried it this evening, HurtOnCollide.as is not actually responsible. I removed this script from runners as well as the bomber, and the damage remains. So again I'm not sure what's causing it.