A plea for cloaking to affect missiles . .
Moderators: winston, another_commander
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
A plea for cloaking to affect missiles . .
. . to some at least easily noticeable degree. At present (well, on my system anyway: Oolite PC version 1.83.0.6559) that is not the case, and I feel it is (too) unrealistic and a bit unfair!
-
- Quite Grand Sub-Admiral
- Posts: 6671
- Joined: Wed Feb 28, 2007 7:54 am
Re: A plea for cloaking to affect missiles . .
This is something you can easily do by editing the
Shift-restart and off you go.
oolite-cloaking-device-equipment.js
script, found in Resources/Scripts. Make the this.activated
function look as follows:Code: Select all
this.activated = function()
{
player.ship.isCloaked = !player.ship.isCloaked;
if (player.ship.isCloaked)
{
// find missiles targeting player
var missilesTargetingPlayer = system.filteredEntities(this, function(ent)
{
return (ent.isMissile && ent.target == player.ship);
}, player.ship, 25600);
for (var i = 0; i < missilesTargetingPlayer.length; i++)
{
missilesTargetingPlayer[i].target = null; // target lost -> missile detonates
}
}
}
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: A plea for cloaking to affect missiles . .
Thanks, Commander.
I think I'd like to use a modified version of that code - modified such that only certain types of missiles are affected, and perhaps with some randomisation (if that wouldldn't slow the game down). *However*, what I'd like to do with it, would be to put it in an expansion pack which overwrites Oolite's own
I think I'd like to use a modified version of that code - modified such that only certain types of missiles are affected, and perhaps with some randomisation (if that wouldldn't slow the game down). *However*, what I'd like to do with it, would be to put it in an expansion pack which overwrites Oolite's own
oolite-cloaking-device-equipment.js
. If it would be alright to do that, could you tell me how to, please? Thanks.-
- Quite Grand Sub-Admiral
- Posts: 6671
- Joined: Wed Feb 28, 2007 7:54 am
Re: A plea for cloaking to affect missiles . .
To make it into an OXP:
1. Save the above script in the Scripts subfolder of your OXP folder, say under the nane mycloak.js.
2. Copy/paste the entry for the Cloaking Device to an empty equipment.plist file, save it under the Config subfolder.
3. In your equipment.plist, edit the
The game will now use your Cloaking Device, rather than the core one.
1. Save the above script in the Scripts subfolder of your OXP folder, say under the nane mycloak.js.
2. Copy/paste the entry for the Cloaking Device to an empty equipment.plist file, save it under the Config subfolder.
3. In your equipment.plist, edit the
script= [...]
line to make it refer to mycloak.js.The game will now use your Cloaking Device, rather than the core one.
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: A plea for cloaking to affect missiles . .
Thanks a lot, another_commander. I've implemented all that, and it works. However, I was wondering about:
(1) whether ships will still be able to lock missiles on the player, when the player is cloaked (which may mean that, with my code as it stands, the missile is liable to detonate as soon as launched);
(2) implementing the same behaviour but for when the target is *not the player*. Would that be hard to do? What routine would I have to hack?
Thanks.
(1) whether ships will still be able to lock missiles on the player, when the player is cloaked (which may mean that, with my code as it stands, the missile is liable to detonate as soon as launched);
(2) implementing the same behaviour but for when the target is *not the player*. Would that be hard to do? What routine would I have to hack?
Thanks.
-
- Quite Grand Sub-Admiral
- Posts: 6671
- Joined: Wed Feb 28, 2007 7:54 am
Re: A plea for cloaking to affect missiles . .
I don't think that missiles will be launched while the player is cloaked. Try spawning a few Cobra pirates and shot them until they fire a missile, then cloak and wait. If they don't fire any more missiles while you are cloaked, then it's all good.UK_Eliter wrote:(1) whether ships will still be able to lock missiles on the player, when the player is cloaked (which may mean that, with my code as it stands, the missile is liable to detonate as soon as launched);
(2) implementing the same behaviour but for when the target is *not the player*. Would that be hard to do? What routine would I have to hack?
shipCloakActivated
handler, but I can't dedicate time to work that out right now. Maybe one of our OXP scripter gurus can jump in at this point.Re: A plea for cloaking to affect missiles . .
Updating the missile AI so that it checks if the current target is cloaked may be the more reliable approach.
-
- Quite Grand Sub-Admiral
- Posts: 6671
- Joined: Wed Feb 28, 2007 7:54 am
Re: A plea for cloaking to affect missiles . .
After cim's reply, I decided to go in and check what's going on, because I was certain that the AI for the missiles was already taking into account cloaking. And it does indeed.
On a standard core install, the missiles will just go towards the direction the last kown position of the cloaked ship. In case of the ship decloaking, they resume their chase. I tested it quickly and it was very obvious to me that this works as intended. I don't think there is anything to fix here.
@UK_Eliter: Are you by any chance using an older version of Griff's ships? If yes, please check the shipdata.plist and see what AI is assigned to the missiles. If it's not a JS AI, then maybe that's the problem.
Edit: Aaarrrrgghhhhh! It was working only because of a local AI mod I had done some time ago. Ouch. OK, committing the fix to trunk in a while.
Edit #2: Done and you can test the fix without having to wait for the nightly, since it's an edit of the oolite-priorityai.js file in Resources/Scripts. In theto
On a standard core install, the missiles will just go towards the direction the last kown position of the cloaked ship. In case of the ship decloaking, they resume their chase. I tested it quickly and it was very obvious to me that this works as intended. I don't think there is anything to fix here.
@UK_Eliter: Are you by any chance using an older version of Griff's ships? If yes, please check the shipdata.plist and see what AI is assigned to the missiles. If it's not a JS AI, then maybe that's the problem.
Edit: Aaarrrrgghhhhh! It was working only because of a local AI mod I had done some time ago. Ouch. OK, committing the fix to trunk in a while.
Edit #2: Done and you can test the fix without having to wait for the nightly, since it's an edit of the oolite-priorityai.js file in Resources/Scripts. In the
behaviourMissileInterceptTarget
function, replace the last line from
Code: Select all
this.ship.performIntercept();
Code: Select all
if (this.ship.target && !this.ship.target.isCloaked)
{
this.ship.performIntercept();
}
else
{
this.ship.performIdle();
}
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: A plea for cloaking to affect missiles . .
Dear another_commander
How long until this fix makes it into a stable release, please? If it will be a while, I will release an expansion pack that plugs the gap.
PS: Cim - thanks.
PPS: @another_commander - no, I'm not using any Griff shipsets. I have 'anarchies_facelift_0.5.oxp', but I don't think that counts.
How long until this fix makes it into a stable release, please? If it will be a while, I will release an expansion pack that plugs the gap.
PS: Cim - thanks.
PPS: @another_commander - no, I'm not using any Griff shipsets. I have 'anarchies_facelift_0.5.oxp', but I don't think that counts.
-
- Quite Grand Sub-Admiral
- Posts: 6671
- Joined: Wed Feb 28, 2007 7:54 am
Re: A plea for cloaking to affect missiles . .
You are essentially asking when the next version of the game will be released and there is no answer to that question. Consider it will be a while, just to be on the safe side.UK_Eliter wrote:How long until this fix makes it into a stable release, please? If it will be a while, I will release an expansion pack that plugs the gap.
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: A plea for cloaking to affect missiles . .
Right. Thanks. I'll see what I can do, expansion pack-wise.another_commander wrote:You are essentially asking when the next version of the game will be released and there is no answer to that question. Consider it will be a while, just to be on the safe side.
-
- ---- E L I T E ----
- Posts: 1248
- Joined: Sat Sep 12, 2009 11:58 pm
- Location: Essex (mainly industrial and occasionally anarchic)
Re: A plea for cloaking to affect missiles . .
another_commander,
The javascript fix you supplied seems to work. However: does it interfere with custom AIs for missiles (as in the AIs for my Nexus missiles, for example)? Such an AI might intend to respond in a certain way to
PS: I thought for a moment that the fix had ended up making a ship (namely a Boa that was attacking the player ship)
The javascript fix you supplied seems to work. However: does it interfere with custom AIs for missiles (as in the AIs for my Nexus missiles, for example)? Such an AI might intend to respond in a certain way to
TARGET_CLOAKED
, but before it can get that message it may, by dint of having done performIntercept
, get told to performIdle
.PS: I thought for a moment that the fix had ended up making a ship (namely a Boa that was attacking the player ship)
performIdle
(it was still red on the scanner, but it was rotating on its axis). Yet, on examining the log, I find:Code: Select all
Entity "Boa" position: (27741.3, 2026.58, 341680) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT range: 1992.99 (visible: yes) mass 181789 AI: armoury_stunnedAI.plist:STUNNED / oolite-nullAI.js
-
- Quite Grand Sub-Admiral
- Posts: 6671
- Joined: Wed Feb 28, 2007 7:54 am
Re: A plea for cloaking to affect missiles . .
I don't know anything about the Nexus missile, so I can't say. Why don't you give it a try and see what happens? If there is interference, then you may want to provide a specific AI for your missile that overrides core.
As far as the Boa is concerned,message is not related to the missile AI change and it does not appear to be originating from core either.
As far as the Boa is concerned,message is not related to the missile AI change and it does not appear to be originating from core either.
- Zark Montor
- Competent
- Posts: 42
- Joined: Thu Jan 02, 2014 1:06 am
- Location: Sevenoaks, Kent, UK
Re: A plea for cloaking to affect missiles . .
Under normal conditions, if you fire whilst cloaking, bang, you de cloak. someone locks a missile onto you, it would lock onto a heat signature or electronic system ping (i'm trying to over elaborate on purpose) so cloaking might not solve the issue of getting hit etc. i think you would have to have a whole system dedicated to chaff/ecm, cloak and emergency maneuver within a short space of time for you to even think about a 50/50 chance of losing any missile TBH and practical. Also, you end up with a missile that might look for another target, depending on which type of missile has been used.. Could have some amusing consequences, space junk, scooping a live warhead.....
Last edited by Zark Montor on Thu Dec 10, 2015 6:52 pm, edited 1 time in total.
I have returned! Less annoying and still enjoying the mighty Oo!
1.86 on self reconned dell studio xps thru Pep 8/64. Runs very well.
Nice to see its still well supported. Oo, Suits you, Sir!
1.86 on self reconned dell studio xps thru Pep 8/64. Runs very well.
Nice to see its still well supported. Oo, Suits you, Sir!
- Zark Montor
- Competent
- Posts: 42
- Joined: Thu Jan 02, 2014 1:06 am
- Location: Sevenoaks, Kent, UK
Re: A plea for cloaking to affect missiles . .
Perhaps rather than just an OXP for this, you could look at a key sequencer or hot key for all sorts of things, such as cargo scooping, ship towing etc etc, there are some tasks that require activation of various systems that would be made easier by way of hot key sequencing.
I have returned! Less annoying and still enjoying the mighty Oo!
1.86 on self reconned dell studio xps thru Pep 8/64. Runs very well.
Nice to see its still well supported. Oo, Suits you, Sir!
1.86 on self reconned dell studio xps thru Pep 8/64. Runs very well.
Nice to see its still well supported. Oo, Suits you, Sir!