Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Ship equipment

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Mad Hollander
Dangerous
Dangerous
Posts: 84
Joined: Wed Nov 14, 2012 11:57 am

Ship equipment

Post 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
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Ship equipment

Post 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
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Ship equipment

Post 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.
Mad Hollander
Dangerous
Dangerous
Posts: 84
Joined: Wed Nov 14, 2012 11:57 am

Re: Ship equipment

Post 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.
Mad Hollander
Dangerous
Dangerous
Posts: 84
Joined: Wed Nov 14, 2012 11:57 am

Re: Ship equipment

Post 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 ?
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Ship equipment

Post 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.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Re: Ship equipment

Post 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.
User avatar
Dawn Trader
Competent
Competent
Posts: 45
Joined: Thu Sep 29, 2011 3:45 am

Re: Ship equipment

Post 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.
Cloning, It's not for everyone.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16071
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Ship equipment

Post by Cody »

Dawn Trader wrote:
"OH OH" I am a goner.
<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!
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!
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Ship equipment

Post 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. ;)
User avatar
Yah-Ta-Hey
---- E L I T E ----
---- E L I T E ----
Posts: 333
Joined: Thu Feb 24, 2011 2:31 am
Location: Traversing new opportunities in space

Re: Ship equipment

Post by Yah-Ta-Hey »

Cody wrote:
Ahh yes, the dangerously interesting life of an ace courier!
Ta-pockata ta-pockata ta-pockata :D










walter mitty
Bartle tester says while I am drinking evil juice, I am: 80% killer/ 80 % achiever/ 33% explorer and 0% socializer.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Ship equipment

Post by Diziet Sma »

Cody wrote:
Dawn Trader wrote:
"OH OH" I am a goner.
<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! :wink: :lol:
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Ship equipment

Post 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.
Mad Hollander
Dangerous
Dangerous
Posts: 84
Joined: Wed Nov 14, 2012 11:57 am

Re: Ship equipment

Post 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
Last edited by Mad Hollander on Mon Dec 30, 2013 12:44 pm, edited 1 time in total.
Mad Hollander
Dangerous
Dangerous
Posts: 84
Joined: Wed Nov 14, 2012 11:57 am

Re: Ship equipment

Post 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.
Post Reply