Page 1 of 2
Quick HUD question
Posted: Sun May 17, 2015 7:46 pm
by ClassicPCGames101
Just a quick question about the Heads Up Display:
Is there a HUD that gives a visual signal if your lasers hit the target? - I often play in the living room and the missus and the kids are fed up with the noise, but also the missus gets annoyed if I wear headphones (on account of the fact that I will be unable to hear her continuous intelligent stream of thoughts).
Re: Quick HUD question
Posted: Sun May 17, 2015 8:00 pm
by another_commander
It is not exactly a HUD, but Custom Shields OXP does give a very visible indication of lasers hitting. Like in the screenie below:
Re: Quick HUD question
Posted: Sun May 17, 2015 8:31 pm
by Smivs
ClassicPCGames101 wrote:...the missus...I will be unable to hear her continuous intelligent stream of thoughts).
You know, I completely understand.
Re: Quick HUD question
Posted: Mon May 18, 2015 1:12 am
by Wildeblood
ClassicPCGames101 wrote:Is there a HUD that gives a visual signal if your lasers hit the target?
Is there a JS event for that?
Re: Quick HUD question
Posted: Mon May 18, 2015 5:48 am
by phkb
Wouldn't shipTakingDamage handle that?
Code: Select all
this.shipTakingDamage = function(amount, whom, type)
{
// Your code here
}
Re: Quick HUD question
Posted: Mon May 18, 2015 7:25 am
by Norby
The
shipTakingDamage handler is not called for all ships, in worldScript for the player ship only, in ship scripts for the ship which use the script.
You can insert a custom code into the ship's script in
shipSpawned worldScript event (as the mentioned customshields do this also) but you must save the original shipTakingDamage and call at the end of your new function.
There is an example of using code insertion in the [wiki]Scanner Alerting Enhancement[/wiki] OXP by jh145:
Code: Select all
var pss = player.ship.script;
this._oldSTA = pss.shipTargetAcquired;
if (this._oldSTA === undefined) this._oldSTA = function(target) { return; }
pss.shipTargetAcquired = function(target) {
var ws = worldScripts['jh145_04_world'];
if (ws._entityToWatch(target)) ws._updateScannerDisplayColour(target,ws._TARGETED);
ws._oldSTA(target);
}
Re: Quick HUD question
Posted: Mon May 18, 2015 7:38 am
by Wildeblood
Okay, I'm a bit more awake now... shipAttackedOther surely. But that also gets called for missiles and such, so there's at least one conditional involved... then you want to display the, let's call it "beep" for now, for a moment that is longer than a single frame so a timer or frame callback is needed. There are your first
two three design decisions:-
How long should beep appear? 1/2 second? 1/4 second?
Use JS timer or frame callback?
If another hit occurs during beep, do you reset timer to extend beep?
Hmm,
this reference only mentions laser hits for triggering shipAttckedOther, but that is not my recollection from my previous attempt to use it years ago...?
Re: Quick HUD question
Posted: Mon May 18, 2015 8:03 am
by Smivs
No idea if this would work, but possibly a script to detect when 'laserhits.ogg' (the sound you get when you do hit a target) is triggered using the 'isPlaying' property, and then the script could trigger a HUD feature.
Re: Quick HUD question
Posted: Mon May 18, 2015 8:08 am
by Wildeblood
Smivs wrote:...the script could trigger a HUD feature.
Changing the cross-hairs seems appropriate to me. I can add this into Auto Crosshairs OXZ if it can be done without being more trouble than it's worth.
P.S. I've found my previous experiment with shipAttackedOther:
https://bb.oolite.space/viewtopic.php?f=3&t=12491
Re: Quick HUD question
Posted: Mon May 18, 2015 4:01 pm
by ClassicPCGames101
Wildeblood wrote:Smivs wrote:...the script could trigger a HUD feature.
Changing the cross-hairs seems appropriate to me. I can add this into Auto Crosshairs OXZ if it can be done without being more trouble than it's worth.
P.S. I've found my previous experiment with shipAttackedOther:
https://bb.oolite.space/viewtopic.php?f=3&t=12491
I'm going to give the custom shields a go but a flash or colour change to the crosshairs when you hit (even better if you're on target) would be great in my silent ooniverse.
Re: Quick HUD question
Posted: Mon May 18, 2015 4:16 pm
by Cody
ClassicPCGames101 wrote:... or colour change to the crosshairs when you hit (even better if you're on target) would be great in my silent ooniverse.
Doesn't the Scanner Targeting Enhancement turn the target reticle red when on target?
Re: Quick HUD question
Posted: Mon May 18, 2015 4:18 pm
by cim
Smivs wrote:No idea if this would work, but possibly a script to detect when 'laserhits.ogg' (the sound you get when you do hit a target) is triggered using the 'isPlaying' property, and then the script could trigger a HUD feature.
This wouldn't work -
isPlaying
checks if that particular sound source is playing, not if any sound source using that source file is playing, and the various built in sounds use sources not accessible to JS.
Cody wrote:Doesn't the Scanner Targeting Enhancement turn the target reticle red when on target?
Only if by HUD settings or JS that option has been turned on - and even then it's not a completely accurate indicator at long range.
Re: Quick HUD question
Posted: Mon May 18, 2015 4:45 pm
by ClassicPCGames101
Cody wrote:ClassicPCGames101 wrote:... or colour change to the crosshairs when you hit (even better if you're on target) would be great in my silent ooniverse.
Doesn't the Scanner Targeting Enhancement turn the target reticle red when on target?
I found the auto crosshairs OZP and it works well on local station traffic, haven't tried it in combat yet.
Re: Quick HUD question
Posted: Mon May 18, 2015 5:09 pm
by Cody
cim wrote:Only if by HUD settings or JS that option has been turned on - and even then it's not a completely accurate indicator at long range.
Ah yes, I often forget that it's not the default in core kit - and yes, it ain't reliably accurate.
Re: Quick HUD question
Posted: Tue May 19, 2015 9:10 am
by ClassicPCGames101
ClassicPCGames101 wrote:
I found the auto crosshairs OZP and it works well on local station traffic, haven't tried it in combat yet.
Erm well it's not too accurate at long distance, the Custom Shields is working well though.