Page 1 of 1
Electronic Disruption Missile
Posted: Wed Jun 11, 2008 11:54 am
by Amen Brick
Would it be possible to implement a missile that knocked out 1-4 random electronic aids (Compass, ECM, etc)?
Posted: Wed Jun 11, 2008 12:16 pm
by Commander McLane
Something similar may already exist. Have a look in
Missiles & Bombs.oxp.
The thread is
here.
Posted: Wed Jun 11, 2008 3:56 pm
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.
Posted: Wed Jun 11, 2008 4:09 pm
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.
Posted: Wed Jun 11, 2008 4:12 pm
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.
Posted: Thu Jun 12, 2008 7:52 am
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.
Posted: Thu Jun 12, 2008 10:19 am
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.
Posted: Sat Jun 21, 2008 9:59 pm
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.
Posted: Sat Jun 21, 2008 11:37 pm
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...
Posted: Sun Jun 22, 2008 8:38 pm
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
Posted: Sat Jun 28, 2008 3:18 pm
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.
Posted: Sat Jun 28, 2008 7:07 pm
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.
Posted: Mon Jun 30, 2008 10:44 am
by Amen Brick
Glad this idea worked!