Page 1 of 2
Ship equipment
Posted: Sun Dec 29, 2013 11:55 am
by Mad Hollander
I'm working on oxp and have a question - how to correct detect the enemy's equipment ?
I use event shipTargetAcquired and call target.equipmentStatus(id)
Seem it works wrong, because I often check for "EQ_MISSILE" and the code return "EQUIPMENT_UNAVAILABLE" and after that the ship can attack with a missile
Re: Ship equipment
Posted: Sun Dec 29, 2013 12:05 pm
by Smivs
You might be checking if the ship
can have the equipment. To find out what it actually has, try the ship property
equipment
Re: Ship equipment
Posted: Sun Dec 29, 2013 2:55 pm
by Thargoid
The ship.equipment will give you an array of the equipment that the target ship has, as Smivs says. But note that missiles aren't classed as equipment in this case (nothing that is pylon mounted is classed as equipment, those are available via ship.missiles, again as an array of items that the target ship currently has on its pylons.
Re: Ship equipment
Posted: Sun Dec 29, 2013 4:52 pm
by Mad Hollander
I disagree. Sometimes ship has missile and equipmentStatus is EQUIPMENT_OK, but in the most cases the status is EQUIPMENT_UNAVAILABLE when the ship has missiles.
The same thing with the lasers. I.e. when forwardWeapon is Beam laser, equipmentStatus might be EQUIPMENT_UNAVAILABLE.
Looks like it depend on the shipdata and shipyard configs.
Re: Ship equipment
Posted: Sun Dec 29, 2013 5:47 pm
by Mad Hollander
Code: Select all
player.consoleMessage(target.equipmentStatus("EQ_MISSILE"));
player.consoleMessage(target.equipmentStatus("EQ_WEAPON_PULSE_LASER"));
player.consoleMessage(target.equipmentStatus("EQ_WEAPON_BEAM_LASER"));
Something strange, I expect three lines, each of them EQUIPMENT_OK or EQUIPMENT_UNAVAILABLE
I often see two or one line. What can be the reason ?
Re: Ship equipment
Posted: Sun Dec 29, 2013 6:26 pm
by Zireael
MadHollander, try using
Code: Select all
player.consoleMessage(target.equipment);
It should do what you want - inform the player of the equipment the target DOES have, and not whether it might theoretically equip it or not.
As I understand
Thargoid and
Smivs, equipmentStatus will not work correctly at
all for missiles. I suppose it might be similar with lasers.
Re: Ship equipment
Posted: Sun Dec 29, 2013 8:23 pm
by Thargoid
In this context neither missiles nor lasers are equipment, hence equipmentStatus isn't applicable to them. They are accessed separately, as I already mentioned for missiles (or more strictly pylon mounted items including mines and their oxp equipment derivatives).
Hence neither will appear in the equipment array, so your check is meaningless. If you want to know if a ship has anything on its pylons, check if ship.missiles exists and ship.missiles.length > 0 If it is you can then parse through the array and check exactly what is on each pylon.
Re: Ship equipment
Posted: Sun Dec 29, 2013 11:16 pm
by Dawn Trader
Mad Hollander wrote:I'm working on oxp and have a question - how to correct detect the enemy's equipment ?
Let me get this straight... you want an oxp that lets you know what is hidden in the innermost region of another ship?????? Why don't you make an oxp that makes all ship transparent like glass????
With this oxp.. all the mystery and indecisions about engaging the ship is gone. the response of a ship to your attentions should be surprising and once the weapon is disclosed then you can say "OH OH" I am a goner.
Re: Ship equipment
Posted: Sun Dec 29, 2013 11:52 pm
by Cody
<grins> I thought exactly that just now when six assassins jumped me at the Onorti WP. There was no time to dwell upon what ordnance they might have been carrying though - it was execute evasion plan beta (and pretty damn quickly too). Ahh yes, the dangerously interesting life of an ace courier!
Re: Ship equipment
Posted: Mon Dec 30, 2013 12:10 am
by Norby
Mad Hollander wrote:I often see two or one line.
Repeated consoleMessages with the same content will not appear again within a few seconds.
As others said, the correct way is the ship.missiles array. I hope you will be use it for some balanced changes or power up NPCs and not the player.
Re: Ship equipment
Posted: Mon Dec 30, 2013 12:16 am
by Yah-Ta-Hey
Cody wrote:Ahh yes, the dangerously interesting life of an ace courier!
Ta-pockata ta-pockata ta-pockata
walter mitty
Re: Ship equipment
Posted: Mon Dec 30, 2013 2:31 am
by Diziet Sma
Cody wrote:<grins> I thought exactly that just now when six assassins jumped me at the Onorti WP. There was no time to dwell upon what ordnance they might have been carrying though - it was execute evasion plan beta (and pretty damn quickly too). Ahh yes, the dangerously interesting life of an ace courier!
Sounds like you've found another vocation as challenging as that of contrabandista!
Re: Ship equipment
Posted: Mon Dec 30, 2013 8:02 am
by Zireael
Thargoid wrote:In this context neither missiles nor lasers are equipment, hence equipmentStatus isn't applicable to them. They are accessed separately, as I already mentioned for missiles (or more strictly pylon mounted items including mines and their oxp equipment derivatives).
Hence neither will appear in the equipment array, so your check is meaningless. If you want to know if a ship has anything on its pylons, check if ship.missiles exists and ship.missiles.length > 0 If it is you can then parse through the array and check exactly what is on each pylon.
Exactly why I suggested using target.equipment. The missiles & laser should remain a mystery.
Re: Ship equipment
Posted: Mon Dec 30, 2013 10:12 am
by Mad Hollander
Dawn Trader wrote:Mad Hollander wrote:I'm working on oxp and have a question - how to correct detect the enemy's equipment ?
Let me get this straight... you want an oxp that lets you know what is hidden in the innermost region of another ship?????? Why don't you make an oxp that makes all ship transparent like glass????
With this oxp.. all the mystery and indecisions about engaging the ship is gone. the response of a ship to your attentions should be surprising and once the weapon is disclosed then you can say "OH OH" I am a goner.
You are right - I'm working on oxp that detect enemy equipment.
1 all external equipment can be seen, theoretically, with an unarmed eye - look at the Dark Wheel novel in the very beginning.
2 hence it can be seen with a subsystem
3 moreover, the most of the equipment
http://wiki.alioth.net/index.php/Catego ... pment_OXPs by the fact do the same
4 the same oxp's have significantly bigger impact on balance
5 NPC do the same, i.e. when the role between pirate or assassin is chosen.
The main Idea of the oxp is to give some piece of information that can help to make a decision
1. attack or not
2. who is the first
3. when is to chase or escape during dogfight
Re: Ship equipment
Posted: Mon Dec 30, 2013 11:10 am
by Mad Hollander
Norby wrote:Mad Hollander wrote:I often see two or one line.
Repeated consoleMessages with the same content will not appear again within a few seconds.
As others said, the correct way is the ship.missiles array. I hope you will be use it for some balanced changes or power up NPCs and not the player.
I see no sense to power up NPC when the most popular tactic is "execute evasion plan beta". Actually, in vanilla oolite there are lot's of places when the enemy are too strong. I.e. five, six and more groups of assassins or pirates.
Actually, I was starting this oxp when I tried Adder. There is too little energy, single laser, single missile and etc. I like this ship but I don't like to escape every second fight. With this oxp I can, at least, know the chances before fight, not after.