Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: How to get the value of damage taken by a ship?  (Read 2301 times)

Princess Idle

  • Ensign
  • *
  • Posts: 9
    • View Profile
How to get the value of damage taken by a ship?
« on: October 07, 2016, 02:21:58 AM »

Hi mates,

I am currently working on a mod, which just adds a few new ships into the game.(I personally call it a ship pack)

I want to make each ship different, if not unique, by having there own build-in weapons and hullmods.

Now I am facing a problem and come here to seek for help, as my coding ability is really poor.

All I want to do is to create a hullmod which, when the hull(not the shield) is hit and damaged, the ship gains flux equal to the damage it received. The effect is quite simple, but however, I find it really hard to do because I don't know how to get the value of damage the ship is taken, and when it is taken.

Anyone has an idea for this? I'm not expecting anyone can provide me the codes for it(of course it will be a great help if one can do that), but just seek for some idea of how to get the value of damage taken by a ship.

Any discuss and help regarding for this topic is much appreciated.

UPDATE:
Spoiler
Quote
Well, actually I have achieved my object, but it's in a different way, without knowing how to get damage value.
What I did is to store the current HP of a ship for each frame. and then I can get the difference in HP between two frame, which is supposed to be the damage. This is not accurate(for example, when you have lv.10 damage control and is recovering hull, your "damage" is actually lower than it should be as some of them is recovered.), but at least it works, well, roughly.

If anyone can come up with a better idea, I would like to try it.
[close]
« Last Edit: October 07, 2016, 07:24:35 AM by Princess Idle »
Logged

Princess Idle

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: How to get the value of damage taken by a ship?
« Reply #1 on: October 07, 2016, 02:30:33 AM »

I'm apologies if this post is not in the right place. I'm new to this forum. If anyone knows a better place I can seek for help regarding for this kind of questions, please advise, Thanks.
Logged

King Alfonzo

  • Admiral
  • *****
  • Posts: 683
  • -- D O C T O R --
    • View Profile
Re: How to get the value of damage taken by a ship?
« Reply #2 on: October 07, 2016, 04:03:23 AM »

This might be a question for the Minor Questions Thread.

I believe if you also poke around in the API and see if there's anything worth looking at in CombatEngine or DamageAPI, you might find what you're looking for.

Princess Idle

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: How to get the value of damage taken by a ship?
« Reply #3 on: October 07, 2016, 06:47:24 AM »

@King Alfonzo, thanks for your reply. I'm sorry I don't know there is already a thread for this kind of minor questions.

I have checked the API given by Alex. but still, I have no idea how to do the work.

speaking of on-hit effect(increase flux on hit), there is an API for weapon. but not for ships. I still have no idea how to apply some "get-hit effect" for a particular ship.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: How to get the value of damage taken by a ship?
« Reply #4 on: October 07, 2016, 06:57:05 AM »

I think your only hope is to compare the hull/armor state to the one before each frame. Templar lattice shield offers an example.
Logged

Princess Idle

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: How to get the value of damage taken by a ship?
« Reply #5 on: October 07, 2016, 08:08:33 AM »

Quote
I think your only hope is to compare the hull/armor state to the one before each frame. Templar lattice shield offers an example.
Thank you, very helpful to me.
Logged