various equipment questions

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

Moderators: winston, another_commander

User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

various equipment questions

Post by Smivs »

NPC-only equipment has traditionally been given a TL of 99 in the equipment.plist. Now that TL99 is deprecated and a condition_script is used to prevent these becoming available to players, what TL should we state in the equipment.plist?
Last edited by Smivs on Thu Mar 12, 2015 6:34 pm, edited 1 time in total.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: TL for NPC-only equipment

Post by spara »

Smivs wrote:
NPC-only equipment has traditionally been given a TL of 99 in the equipment.plist. Now that TL99 is deprecated and a condition_script is used to prevent these becoming available to players, what TL should we state in the equipment.plist?
I haven't got the slightest what's the "correct" way, but I'm using TL0 and this

Code: Select all

this.allowAwardEquipment = function(eqKey, ship, context) {
	//only allow via scripting
	if (context === "scripted") return true;
	return false;
}
in conditions to make equipment scripted only.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: TL for NPC-only equipment

Post by Smivs »

spara wrote:
I haven't got the slightest what's the "correct" way...
Same here :) hence the question.
I'm currently looking at Aliens and want to update the 'Photon Torpedo' which is a special Scorpax weapon which is not available to anybody else.
The equipment.plist is

Code: Select all

(
      (
        99, 
        1, 
        "Photon Torpedo",
        "EQ_PHOTONTORP_MISSILE",
        "Scorpax photon missile",
        {
          condition_script = "oolite-conditions.js";
          available_to_all = false;
        }
      )
)
and I have

Code: Select all

 script_info = {"oolite-barred-equipment" = "EQ_PHOTONTORP_MISSILE"};
in the missile's shipdata.
It works fine with no log errors in 1.81, but I did wonder about that TL, just out of interest really.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Ngalo
Competent
Competent
Posts: 58
Joined: Mon Mar 02, 2015 2:08 pm
Location: drifting in remLock mask near Vezadi Station

Re: TL for NPC-only equipment

Post by Ngalo »

Sorry if I've read this (or the documentation) wrong, but isn't there an 'available_to_player' key which you can set 'false' or 'no' in equipment.plist?
I do use and quite like Aliens OXP, btw.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: TL for NPC-only equipment

Post by spara »

Ngalo wrote:
Sorry if I've read this (or the documentation) wrong, but isn't there an 'available_to_player' key which you can set 'false' or 'no' in equipment.plist?
Sure, but there are cases were finer control is needed. You for example want some mission related equipment to be added to NPC ships only from javascript or you want an NPC equipment to be available only to certain NPC ships.
Smivs wrote:
...but I did wonder about that TL, just out of interest really.
Thinking about the context, it's probably just a placeholder.

My money's on the placeholder :mrgreen: .
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: TL for NPC-only equipment

Post by Smivs »

Ngalo wrote:
Sorry if I've read this (or the documentation) wrong, but isn't there an 'available_to_player' key which you can set 'false' or 'no' in equipment.plist?
I do use and quite like Aliens OXP, btw.
Hi Ngalo :)
Yes, it's 'available_to_all' and it is set to false (see above). This whole area is a bit confusing because there are several ways to approach it, and most seem to work.
I'm glad you like the OXP - have you been photon torpedoed yet? They are a bit lethal (as they were developed by the Scorpax as anti-Thargoid weapons) which is why I didn't think they should be on general sale :wink:
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: TL for NPC-only equipment

Post by spara »

Smivs wrote:
...and I have

Code: Select all

 script_info = {"oolite-barred-equipment" = "EQ_PHOTONTORP_MISSILE"};
in the missile's shipdata.
This is quite interesting. One would assume that it prevents "EQ_PHOTONTORP_MISSILE" from the missile itself. :?:
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: TL for NPC-only equipment

Post by Smivs »

Again, I'm assuming this is right - it certainly works, but could be redundant. I think 'oolite_barred_equipment' only prevents player access, but clarification would be nice. The Scorpax has these specified in its shipdata

Code: Select all

missile_role = "EQ_PHOTONTORP_MISSILE";
and certainly has them in-game.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: TL for NPC-only equipment

Post by spara »

Smivs wrote:
Again, I'm assuming this is right - it certainly works, but could be redundant. I think 'oolite_barred_equipment' only prevents player access, but clarification would be nice. The Scorpax has these specified in its shipdata

Code: Select all

missile_role = "EQ_PHOTONTORP_MISSILE";
and certainly has them in-game.
Yup. I've been reading the equipment.plist page for about million times and still have some trouble grasping it. "Available_to_all" seems to mean "this item can be installed on all ships". So setting it to "no" effectively removes the equipment from shop. I assume that "available_to_NPCs" means that the equipment can be added by the game to NPC ships. So setting that to "no" would stop that. On the other hand, does "available_to_all" already bar it from all ships? After that the only way to add the equipment to a ship would be via script or missile_role assuming of course that my assumptions are correct. Correct, I'm confused with these :lol: .
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: TL for NPC-only equipment

Post by cim »

So, a few separate issues here:

available_to_all = false; means that the equipment can only be fitted to player ships which have the item in either the Standard or Optional Equipment section of their shipyard.plist definition. Unlikely, for a random piece of OXP equipment, but not impossible. This is what's actually doing the purchase blocking in this case. (Generally I wouldn't recommend using this on OXP equipment unless you want to tie it to a playable ship in the same OXP). Exactly when this is applied to the player ship has varied between Oolite versions [1] ... you should assume that it always applies and situations where it doesn't are bugs to be reported, I think.

available_to_player = false; means that the equipment can't be fitted to a player ship. If you don't want to use a condition script, Ngalo is right that this is the correct property.

script_info = {"oolite-barred-equipment" = "EQ_PHOTONTORP_MISSILE"}; when combined with oolite-conditions.js as the condition script means that the equipment can't be fitted to the ship with that script_info in its shipdata.plist, and works on player and NPC ships. In this case, this means that the missile can't mount copies of itself on its pylons as additional ammunition, which will no doubt relieve anyone it's fired at.

While you can stick oolite-conditions.js on OXP equipment (and perhaps you may as well if you don't need any other condition support), obviously the chance of any core or OXP ship specifically barring it is very low - you're probably better off giving the item its own OXP-specific condition script. In general, condition scripts are the solution to the problem of there being lots of equipment availability properties with overlapping and unclear effects, and in this case a custom one could be used to ensure that not only could the player not fit it, but neither could any non-Scorpax NPC.

TL for NPC equipment is irrelevant in the core game; set it to some reasonable value just in case some OXP is introduced which has persistent NPCs, tracks their equipment purchasing, and supports OXP equipment. TL:99 is an old magic value which allowed the TL to be changed by script (including legacy scripts) - it was never particularly appropriate for items which should never be player-accessible, for which 100 or 98 (or one of the many more specific properties) is better.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: TL for NPC-only equipment

Post by Smivs »

Thanks cim. That's certainly clarified things a bit.
From what you've said, it seems I certainly covered all the bases, but somewhat redundantly. 'available_to_player = false;' sounds like what I really want for this, so I can go tidy things up now.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Ngalo
Competent
Competent
Posts: 58
Joined: Mon Mar 02, 2015 2:08 pm
Location: drifting in remLock mask near Vezadi Station

Re: TL for NPC-only equipment

Post by Ngalo »

smivs wrote:
I'm glad you like the OXP - have you been photon torpedoed yet?
Haven't been hit by one yet. But I have outrun one on injectors. Didn't fancy going back to finish off the Scorpax though.
User avatar
spara
---- E L I T E ----
---- E L I T E ----
Posts: 2691
Joined: Wed Aug 15, 2012 4:19 am
Location: Finland

Re: TL for NPC-only equipment

Post by spara »

One more question. How dominant these settings are in relation to adding equipment with awardEquipment or missile_role?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: TL for NPC-only equipment

Post by cim »

They should override those, too (condition scripts have a mechanism to say in which situations they apply; the rest should be universal)
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: various equipment questions

Post by Smivs »

Back again with another question (and a change of title for this thread as I suspect this won't be the last one).
"installation_time" and "repair_time" are now writable (in 1.81) but how do they work? I notice in another post that they are measured in seconds, but I have a piece of equipment that requires a zero installation time - I've moved on to looking at the Tea Maker, and this concerns the refills, which shouldn't take 11 minutes and 40 seconds to install - that's seems silly to me :)
Back to the point, having

Code: Select all

"installation_time" = 0;
in the equipment.pist doesn't do anything. Is there not a zero-option or have I mis-understood something?
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply