Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Legate Damar on July 15, 2012, 10:23:49 pm
-
I don't know if this requires modifying the code or not, but could there be a way to display the percentage of shields on a ship when you target it, or the percentage of your own shield strength? This would be very useful in certain circumstances.
-
You can do this with sexps and custom hud gauges
-
or scripting for that matter (this gives you better rendering options, and less hud integration though).
-
You can do this with sexps and custom hud gauges
Is there a tutorial for this?
Also would it be possible for the SCP team to make it a standard feature that's active by default?
-
I highly doubt SCP will make this a "standard feature that's active by default" simply because it's pretty simple to do with the existing tools.
-
Well I've never seen it done in any mod I've played...
-
That only means that no one else has needed or wanted to do it. It doesn't mean it's not doable.
-
Well my point was that without an example to look at I wouldn't know where to start.
-
If you want us to make your mod for you...
-
It's probably a good time to open up FRED, explore the events and sexps, and try some things out.
With SEXPs, a little guesswork should get you in the ballpark. You want to display the shields left for the ship targeted as a percentage. So, you need to capture which ship is being targeted and you need to capture it's shield status. Capturing the shield status of a ship and saving that to a variable is super easy. Anyone moderately familiar with FRED should be able to do that. However, capturing the shield status of the ship being targeted is a bit more difficult. I'll give you a hint, though. When-Argument is probably the best way to do it. I know there are tutorials on the FREDing board or on the Wiki about when-argument sexps.
Get that figured out and you'll end up with the shield percentage of the targeted ship as a variable. Use a trigger count to set the variable every frame. To display it, simply convert the variable to a string (there's a SEXP for that), and display it with a custom HUD gauge by using HUD-set-text. There are a few mods out that use custom HUD gauges (BtA Demo, JAD 2.21).. look at one of those to figure out how that works.
Scripting will be the more universal method, but I don't know enough LUA to help you there.
-
Thank you.
-
the percentage of shields on a ship when you target it
I don't even know what it he wants here, considering that the HUD already displays information about the enemy's shields in at least 3 different ways, but apparently it's clear to everyone else. :doubt:
-
He wants to show the numerical percentage value of remaining shields. Like, with figures and stuff.
-
He wants to show the numerical percentage value of remaining shields. Like, with figures and stuff.
But that's already shown underneath the reticle, is it not?
-
Nope, that's the percentage of hull remaining. The shield info is just the 4 things around it, which is a purely visual info and not a numerical one.
-
Nope, that's the percentage of hull remaining. The shield info is just the 4 things around it, which is a purely visual info and not a numerical one.
Right. Got it. :D
-
can this modified to show the % shield left of your own ship shields per shield bank? given a ship has 4 shield banks, to know how much shields do it has left on each one of the banks? and what about absolute readouts?
-
Yes it can :
You can do this with sexps and custom hud gauges
-
I'm having a bit of trouble implementing this. Can I do it all in FRED or do I need to mess with the hud_gauges.tbl?
-
Didn't the old Freespace 1 alpha version have a percentage-based shield system display on the HUD? I seem to remember that it did. If so, I would suggest getting your hands on that mission and picking it apart to see how they did it. Might help a bit.
-
I'm having a bit of trouble implementing this. Can I do it all in FRED or do I need to mess with the hud_gauges.tbl?
You need hud_gauges.tbl
-
Didn't the old Freespace 1 alpha version have a percentage-based shield system display on the HUD? I seem to remember that it did. If so, I would suggest getting your hands on that mission and picking it apart to see how they did it. Might help a bit.
I highly doubt that was done in FS1 Alpha with sexps. It was probably a code chunk that was later removed or changed.
-
I'm having a bit of trouble implementing this. Can I do it all in FRED or do I need to mess with the hud_gauges.tbl?
You need hud_gauges.tbl
Eh... :doubt:
I'll fiddle around with it later and figure it out.
-
Just to chime in with a sort of general FREDding statement: learning how to do conditionals in FRED will be like becoming a FRED Super-Saiyan. I kid you not; the things you can do with conditionals are a helluva lot stronger and elegant than any other comparable solution. In my work for BtA, Mjn helped me learn how to use conditionals, and already the things I can do with SEXPs are much more complex than anything I previously thought possible.
Gauges, however, are still kind of arcane. Maybe try popping onto the IRC channel for some "live" help.
-
Gauges are not arcane if you just want to display a string from a variable or something, it's actually rather straightforward.
Hardest part is figuring out where to place the goddamn thing.