Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Post Reply
QCS
Dangerous
Dangerous
Posts: 112
Joined: Sun Feb 22, 2015 6:52 pm

Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Post by QCS »

Hi,

I am tinkering around with an equipment/mechanics idea (not decided yet). For that I ideally would need to know not only who attacked me (which ship), but also with which weapon, and on which shield (if there was a shield, that is :-D).

For this, the event handlers I found in the reference (shipTakingDamage and shipBeingAttacked) is not detailed enough. Is there a way to do that which I didn't see, or is my "idea" bound to fail?

Thanks in advance!

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2560
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Post by Norby »

These are up to you to solve in js. For example the following code in Combat MFD determine which shield of the target facing to player ship:

Code: Select all

this.$AftShieldFacing = function(ship) {
        if(ship.vectorForward.angleTo(ship.position.subtract(player.ship.position)) <= Math.PI/2)
                return(true);
        return(false);
}
If you improve this to handle 4 sides then you can assume the laser hit arrived from that side, so you can look into ship.forwardWeapon or ship.aftWeapon or port or starboard.

The inverse of the above logic is usable to determine that which shield of the player ship facing to the attacker.

QCS
Dangerous
Dangerous
Posts: 112
Joined: Sun Feb 22, 2015 6:52 pm

Re: Monitor attacks more detailed than shipTakingDamage/shipBeingAttacked

Post by QCS »

Thanks Norby,

that answer gives me the general idea how to do it, and opens my mind for a class of solutions I did not think about before.

Post Reply