Electronic Disruption Missile

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Amen Brick
Deadly
Deadly
Posts: 187
Joined: Sat May 10, 2008 5:22 pm
Location: Bolton!

Electronic Disruption Missile

Post by Amen Brick »

Would it be possible to implement a missile that knocked out 1-4 random electronic aids (Compass, ECM, etc)?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Something similar may already exist. Have a look in Missiles & Bombs.oxp.

The thread is here.
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

You could use a combo of scriptActionOnTarget (or its funky JS equivalent) and removeEquipment, plus a few dice rolls, to randomly take out a player's systems. This might be rather harsh though - is there a script action to set equipment to 'damaged' rather than removing it outright?

I suppose you could use a timed script to make the effect non-permanent - having a missile temporarily disrupting a player's witchdrive injectors would be quite cool. In fact, wasn't there something in LB's Assassins that did this?

Anyhoo, something along these lines might be quite good as a variation for the Violet Flax disruptor missile, as at the moment it has little effect on the player. It's quite a distinctive-looking missile so you'd know to avoid it.
Download Resistance Commander plus many other exciting OXPs HERE
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Ramirez wrote:
You could use a combo of scriptActionOnTarget (or its funky JS equivalent) and removeEquipment, plus a few dice rolls, to randomly take out a player's systems. This might be rather harsh though - is there a script action to set equipment to 'damaged' rather than removing it outright?
Yes, there is. You can damage stuff in JS by scripting as follows (example how to damage Docking Computers):

Code: Select all

P.setEquipmentStatus("EQ_DOCK_COMP","EQUIPMENT_DAMAGED");
and this is how to repair them again:

Code: Select all

P.setEquipmentStatus("EQ_DOCK_COMP","EQUIPMENT_OK");
The two accepted status states for setEquipmentStatus are EQUIPMENT_DAMAGED and EQUIPMENT_OK. This is already available in version 1.71.2.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ramirez wrote:
This might be rather harsh though - is there a script action to set equipment to 'damaged' rather than removing it outright?
Yes, McLane is using this. Just remove the equipment and add new equipment with the same name but preceded with "damaged". This will do the trick.

Temporary disabling it would be possible. e,g, with a timer. However, when it is damaged, it should stay broken. In normal play equipment is also not selfrepairing.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Eric Walch wrote:
Yes, McLane is using this. Just remove the equipment and add new equipment with the same name but preceded with "damaged". This will do the trick.
Yep. Have a look into Anarchies.
The AI-methods you would have to use are these (for other equipment you have of course to change the names):

Code: Select all

"safeScriptActionOnTarget: removeEquipment: EQ_ECM", "safeScriptActionOnTarget: awardEquipment: EQ_ECM_DAMAGED"
However, it would be necessary to check first whether the player actually has the equipment installed (or he would get awarded a damaged ECM out of nothing - weird). And performing the necessary checks in the missile's AI - while perhaps possible - is at least tricky. Therefore I would strongly suggest doing the whole stuff in the missile's ship-script. And fortunately a_c has already posted the respective JS-methods. The ship-script would also have to check whether the target is within a certain range, because the missile may only work within a radius of 250 meters, not miles and miles away.

Or, alternatively, you could do it in the missile's death_actions. But this has the disadvantage that death_actions don't care for what has caused the death. So even if the missile explodes on launching it would do its work. Not desirable.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I don't think you can ask for a list of equipment a player has. You just have to try equipment a player could have. I just wrote an piece of untested code:

Code: Select all

this.damageEquipment = function()
{
  let list = ["EQ_ADVANCED_COMPASS", "EQ_DOCK_COMP", "EQ_ECM", "EQ_FUEL_INJECTION", "EQ_TARGET_MEMORY"]
  let equipment = list[Math.floor(Math.random() * list.length)]
  if(player.hasEquipment(equipment) player.setEquipmentStatus(equipment, "EQUIPMENT_DAMAGED")
}
Call the function from the AI with: "sendScriptMessage: damageEquipment"

The JS code creates a list of equipment that you may to damage. Than select a random one from the list. At last, when the player has it, damage it. And probably you might add a change factor so it is not always doing things.

Before 1.71 you had to remove the original first or you ended up with both the working and damaged one in your directory, but with the new commands in 1.71.2 a_c mentioned above it is just one command.
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

About restoring the equipment: it'd make sense for an EMP to burn out the electronics, but such a strong pulse should wreck them all and cook any ionized hulls nearby - that's an energy bomb's effect, so you're looking at much more subtler effects such as simply resetting the OS and forcing them to waste time rebooting.

This seems enough to soften a target, and won't affect so much the game balance.
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Post by DaddyHoggy »

@Cmdr. M - I like those ideas - even shutting the drive computers down for say 10s (mixing all that fuel in the right ratio is complicated business - and they're using microwaves now to non-lethally stop a car that refuses to slow for a check-point so this is real life stuff) - would mean you'd be having a very bad day unless you're shields were up to it...
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Captain Hesperus
Grand High Clock-Tower Poobah
Grand High Clock-Tower Poobah
Posts: 2310
Joined: Tue Sep 19, 2006 1:10 pm
Location: Anywhere I can sell Trumbles.....

Post by Captain Hesperus »

DaddyHoggy wrote:
@Cmdr. M - I like those ideas - even shutting the drive computers down for say 10s (mixing all that fuel in the right ratio is complicated business - and they're using microwaves now to non-lethally stop a car that refuses to slow for a check-point so this is real life stuff) - would mean you'd be having a very bad day unless you're shields were up to it...
Wasn't there a thread about a missile/bomb that causes ships to lose the ability to steer/shoot for a period of time?
Could that not be implemented?

Captain Hesperus
The truth, revealed!!
Image
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

Hey people

I tried out Eric's bit of code with the Violet Flax override missile and it works. As well as dumping my cargo it damaged my docking computer. You have to check the F5 screen to see if anything's been damaged though - would it be possible to do a commsMessage to state that a specific system has been damaged? If not, I'll just put in a general warning.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ramirez wrote:
I tried out Eric's bit of code with the Violet Flax override missile and it works.... it damaged my docking computer.
Ay, don't blame me when something gets damaged. And when it does, you can look at one of the GRS stations for repair.
Ramirez wrote:
You have to check the F5 screen to see if anything's been damaged though - would it be possible to do a commsMessage to state that a specific system has been damaged?
I don't think there is a function to get the display name of the equipment. The easiest solution would be to make two corresponding lists. One with the internal names and the other with the display names, and than generate a random number to be used for both lists.

It gets more complicated as we now have a two dimensional array.

Code: Select all

this.damageEquipment = function() 
{ 
this.list = [["EQ_ADVANCED_COMPASS", "EQ_DOCK_COMP", "EQ_ECM", "EQ_FUEL_INJECTION", "EQ_TARGET_MEMORY"], ["Compass", "Docking Computer", "ECM", "Fuel Injection", "Target Memory"]]
  let equipment = Math.floor(Math.random() * list[0].length)
  if(player.hasEquipment(this.list[0][equipment])
  {
     player.setEquipmentStatus(this.list[0][equipment], "EQUIPMENT_DAMAGED") 
     player.consoleMessage(this.list[1][equipment],5)
  }
} 
"equipment" is now not the name of the equipment, as in my first example, but the position in the array. this.list[0] now has the internal names and this.list[1] contains the display names. The addition of "[equipment]" selects the right position within the array.
User avatar
Amen Brick
Deadly
Deadly
Posts: 187
Joined: Sat May 10, 2008 5:22 pm
Location: Bolton!

Post by Amen Brick »

Glad this idea worked!
Post Reply