Quick HUD question
Moderators: winston, another_commander
- ClassicPCGames101
- Above Average
- Posts: 17
- Joined: Wed May 06, 2015 1:16 pm
Quick HUD question
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).
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).
Why are pirates called pirates ... because they AARGH!
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Quick HUD question
You know, I completely understand.ClassicPCGames101 wrote:...the missus...I will be unable to hear her continuous intelligent stream of thoughts).
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Quick HUD question
Is there a JS event for that?ClassicPCGames101 wrote:Is there a HUD that gives a visual signal if your lasers hit the target?
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: Quick HUD question
Wouldn't shipTakingDamage handle that?
Code: Select all
this.shipTakingDamage = function(amount, whom, type)
{
// Your code here
}
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: Quick HUD question
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:
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);
}
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Quick HUD question
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...?
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...?
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Quick HUD question
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.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Quick HUD question
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.Smivs wrote:...the script could trigger a HUD feature.
P.S. I've found my previous experiment with shipAttackedOther:
https://bb.oolite.space/viewtopic.php?f=3&t=12491
- ClassicPCGames101
- Above Average
- Posts: 17
- Joined: Wed May 06, 2015 1:16 pm
Re: Quick HUD question
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.Wildeblood wrote: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.Smivs wrote:...the script could trigger a HUD feature.
P.S. I've found my previous experiment with shipAttackedOther:
https://bb.oolite.space/viewtopic.php?f=3&t=12491
Why are pirates called pirates ... because they AARGH!
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Quick HUD question
Doesn't the Scanner Targeting Enhancement turn the target reticle red when on target?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.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
Re: Quick HUD question
This wouldn't work -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.
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.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.Cody wrote:Doesn't the Scanner Targeting Enhancement turn the target reticle red when on target?
- ClassicPCGames101
- Above Average
- Posts: 17
- Joined: Wed May 06, 2015 1:16 pm
Re: Quick HUD question
I found the auto crosshairs OZP and it works well on local station traffic, haven't tried it in combat yet.Cody wrote:Doesn't the Scanner Targeting Enhancement turn the target reticle red when on target?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.
Why are pirates called pirates ... because they AARGH!
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Quick HUD question
Ah yes, I often forget that it's not the default in core kit - and yes, it ain't reliably accurate.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.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- ClassicPCGames101
- Above Average
- Posts: 17
- Joined: Wed May 06, 2015 1:16 pm
Re: Quick HUD question
Erm well it's not too accurate at long distance, the Custom Shields is working well though.ClassicPCGames101 wrote:
I found the auto crosshairs OZP and it works well on local station traffic, haven't tried it in combat yet.
Why are pirates called pirates ... because they AARGH!