Forums

[REQUEST] Astral Ship Damage Report

Share your addons for the game here.

[REQUEST] Astral Ship Damage Report

Postby gonionknight » Mon Feb 21, 2011 12:25 pm

It's very difficult locating weapons these days with multiple decks since the damage listings aren't arranged in a specific order listing deck and gun position, meaning it's usually confusing for players to find the 4th cannon at the back with the semi-obscured HP bar on the second deck.

I propose the following Damage Assessment and will provide graphics for the interface if someone knows if the coding is possible and reasonable:

Image

Shield Indicators - 5 = 100%, 4 = 80%, bars vanish as shields are hit on the associated sides.

Weapon Indicators for Equipment
Blue 100%
Green 75-99%
Yellow 51-75%
Orange 25-50%
Red 1-25%
Black 0% or Missing

Reactor - Blue = Normal, Green = Moderate Use (<50%), Yellow = Heavy Use (up to 90%, Orange = Above 90%, Red = Burst, Black = Shut Down

An HP bar for the ship's help would be available down the centerline of the ship interface.

Discuss!
Image
(yes, these buttons actually take you places)
ImageImageImageImageImageImage
User avatar
gonionknight
Demon Hunter
 
Posts: 3620
Joined: Thu Sep 02, 2010 3:24 pm

Re: [REQUEST] Astral Ship Damage Report

Postby ciuine » Mon Feb 21, 2011 2:06 pm

Astral ships are denoted as "Transport"s in the API. So any commands relating to Transports returns information about an astral ship. IE, transport.GetHealth(transportId) returns a table of all the devices' health values and transport.GetShieldStrength(transportId) a table of the shield strengths health values.

Using this information you could collect the current and max health of all shields as your transport receives damage via the more likely EVENT_SHIP_DAMAGE_RECEIVED or EVENT_TRANSPORT_SHIELD_CHANGED and EVENT_TRANSPORT_HEALTH_CHANGED, and a comparison to the binded transport of the avatar via avatar.GetBindedTransport() which will get the transportId of the avatar's owned ship or unit.GetTransport(avatar.GetId()) which will get the transportId of the ship the player is currently on.

There's a whole lot of information in these fields events and functions. But 90% of it is numerical current and maximum values.

Great layout by the way, if it were say standard around 200x350 or something, that'd be swell and possibly an expand on hover or a resize drag panel.

You could even fetch all this information about other ships you can see possibly as well.

Edit: For devices, it might be necessary to get the transport.GetDevices(transportId) table and then run device.GetHealth(deviceId) after finding out the specific device you want to display information on. This would be necessary because transport.GetHealth() passes a table of health without identifications. These could be updated through EVENT_DEVICE_HEALTH_CHANGED.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: [REQUEST] Astral Ship Damage Report

Postby gonionknight » Mon Feb 21, 2011 3:10 pm

The Format is in vector right now so it can be up or downscaled. I can make a retro 8-bit pixel theme as well.

Edit - Here's a sprite sheet of everything.

Image
Image
(yes, these buttons actually take you places)
ImageImageImageImageImageImage
User avatar
gonionknight
Demon Hunter
 
Posts: 3620
Joined: Thu Sep 02, 2010 3:24 pm

Re: [REQUEST] Astral Ship Damage Report

Postby ciuine » Mon Feb 21, 2011 5:08 pm

Code: Select all
local trans = unit.GetTransport(avatar.GetId())
   local tHealthPer = math.ceil(transport.GetHealth(trans).value / transport.GetHealth(trans).limit * 100)
   common.LogInfo( "Blah", userMods.FromWString(object.GetName(trans)).." Health % = "..userMods.FromWString(common.FormatInt(tHealthPer, "%d")))
   for i = 2, 5 do
      common.LogInfo( "Blah", userMods.FromWString(object.GetName(trans)).." Shields % = "..userMods.FromWString(common.FormatInt(math.ceil(transport.GetShieldStrength(trans, i).value / transport.GetShieldStrength(trans, i).maxValue * 100), "%d")))
   end
   local devs = transport.GetDevices(trans)
   for i, v in devs do
      local name = object.GetName(v)
      common.LogInfo( "Blah", "Name = "..userMods.FromWString(name))
      common.LogInfo( "Blah", "Health % = "..userMods.FromWString(common.FormatInt(math.ceil(device.GetHealth(v).value / device.GetHealth(v).limit * 100) , "%d")))
      if common.IsSubstring(name, userMods.ToWString("Shield")) then
         common.LogInfo( "Blah", "Shields % = "..userMods.FromWString(common.FormatInt(math.ceil(device.GetShieldStrength(v).value / device.GetShieldStrength(v).maxValue * 100), "%d")))
      end
   end


This was a test that I ran on my ship. Produced these results;
Code: Select all
Info: addon NNRS: Skippy Health % = 100
Info: addon NNRS: Skippy Shields % = 100
Info: addon NNRS: Skippy Shields % = 100
Info: addon NNRS: Skippy Shields % = 100
Info: addon NNRS: Skippy Shields % = 100
Info: addon NNRS: Name = Astral Shield
Info: addon NNRS: Health % = 100
Info: addon NNRS: Shields % = 100
Info: addon NNRS: Name = Astral Shield
Info: addon NNRS: Health % = 100
Info: addon NNRS: Shields % = 100
Info: addon NNRS: Name = Astral Shield
Info: addon NNRS: Health % = 100
Info: addon NNRS: Shields % = 100
Info: addon NNRS: Name = Motor
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Helm
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Motor
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Turbine
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Turbine
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Helm
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Reactor
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Visor
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Elongated Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Elongated Cannon
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Artillery
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Artillery
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Sick Bay
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Goblin Tinkerer
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Goblin Mechanic
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Goblin Repairman
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Scanner
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Treasure Room
Info: addon NNRS: Health % = 100
Info: addon NNRS: Name = Astral Shield
Info: addon NNRS: Health % = 100
Info: addon NNRS: Shields % = 100


This means that the coder would have to figure out the standard locational positions based on load order in the table and store and label the deviceIDs. That way when EVENT_DEVICE_HEALTH_CHANGED occurs, the deviceID that received the change can be bounced against the stored deviceIDs and perform the necessary display changes.

Note, that while running this test, I discovered that the device shield strength only applies to the astral shields and that this is unnecessary information due to the transport.GetShieldStrength(transportId, SIDE) being able to perform the same function.

From your drawing, I see six shields, is this an upgrade to the ship? As my ship only has four, Front, Left, Right, Back and the ENUMs only show four as well, 2 through 5 where 0 and 1 are none and all..
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: [REQUEST] Astral Ship Damage Report

Postby gonionknight » Mon Feb 21, 2011 5:40 pm

I was under the impression that the side shields (2 per side) were calculated separately. They may be combined, in which case making the shields is much simpler.
Image
(yes, these buttons actually take you places)
ImageImageImageImageImageImage
User avatar
gonionknight
Demon Hunter
 
Posts: 3620
Joined: Thu Sep 02, 2010 3:24 pm

Re: [REQUEST] Astral Ship Damage Report

Postby ciuine » Mon Feb 21, 2011 6:10 pm

My ship only has four shields, so if the maximum number of shields is six on a ship; that means there would need to be a lot more code then there already needs to be. I'd stick with the ship side mechanics.

I'm writing up a basic concept LUA for this add-on, right now. I'm already running into problems due to the fact my ship only has eight cannons while your diagram has sixteen. Which means the way information on your ship is passed might be different than how it is on my ship.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: [REQUEST] Astral Ship Damage Report

Postby ciuine » Mon Feb 21, 2011 7:38 pm

LUA done and mildly tested in the hangar.

First draft;
Image
No shields yet, I'll get to that tomorrow (all the code is done, just need to rip the four arced textures); a majority of my spacing needs to be redone. If you could, please provide me a nice ship outline that encompasses somewhat similarly the range shown, obviously central spacing will be increased in both directions in the next draft due to the cannons and reactor not leaving room for the second rows.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: [REQUEST] Astral Ship Damage Report

Postby ciuine » Tue Feb 22, 2011 1:13 pm

Guinea pig test this for me; (cause I don't have any desires to go solo blow up my ship)
MediaFire File - ShipHUD_v1.zip

Image

Drag and drop panel accessible via /shuddnd.
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Re: [REQUEST] Astral Ship Damage Report

Postby gonionknight » Tue Feb 22, 2011 1:21 pm

Are you coding for RU server or NA server? I have yet to be able to make any /commands work for add-ons so I wouldn't know if the DND code works <_<
Image
(yes, these buttons actually take you places)
ImageImageImageImageImageImage
User avatar
gonionknight
Demon Hunter
 
Posts: 3620
Joined: Thu Sep 02, 2010 3:24 pm

Re: [REQUEST] Astral Ship Damage Report

Postby ciuine » Tue Feb 22, 2011 1:28 pm

The slash commands work fine. I've already tested the DND. I've actually already tested every bit of the code except for the two updating events, which shouldn't pass errors; I just wanted someone to do an actual play test.. Rather than my condition tests.

And I coded for all clients, it shouldn't pass an error for the NA/BR/EU/CHN/JPN/RU clients. Unless an API function was drastically changed; which I'm pretty sure I only used like four to make this add-on. :P
Image
User avatar
ciuine
Free Trader
 
Posts: 1779
Joined: Sat Jan 02, 2010 9:50 pm

Next

Return to Addons