Trouble making a new piece of kit

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

Moderators: winston, another_commander

Post Reply
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2659
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Trouble making a new piece of kit

Post by Redspear »

Hi folks,

I'm trying to create some new pieces of equipment that exist as dependencies upon which to install other items.

e.g.

Code: Select all

	(
		100, 1, "Medium Sized Hull",
		"EQ_MEDIUM_HULL",
		"Enables fitting of medium sized equipment.",
		{
			condition_script = "oolite-conditions.js";
			available_to_all = true;
			visibile = false;
			damage_probability = 0;
		}
	),
I've put tech level as 100 because I don't want it to appear for sale (and "1" is just a token value for testing) but I have added some shipdata-overrides to add it as standard equipment to some ships as below:

Code: Select all

	"asp-player" =
	{
		"standard_equipment" =
		{
			extras =
			(
			"EQ_MEDIUM_HULL"
			);
		};
	};
No luck, even when buying a new ship :| ...

If I change visible to "true" and lower the tech level, then they appear for sale (and behave as expected) but never as standard, pre-installed equipment.

I even tried writing a script to add them (new territory for me, so it was almost certainly broken in some way) with player.ship.awardEquipment
but right now it's just not happening.

Any ideas?
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: Trouble making a new piece of kit

Post by Norby »

Redspear wrote:
I have added some shipdata-overrides
You mean shipyard-overrides (and include every lines from the original shipyard).
Redspear wrote:
a script to add them

Code: Select all

this.startUp = this.playerBoughtNewShip = function() {
  if(player.ship.dataKey=="asp-player") 
    player.ship.awardEquipment("EQ_MEDIUM_HULL");
}
Last edited by Norby on Thu Aug 21, 2014 9:00 pm, edited 1 time in total.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Trouble making a new piece of kit

Post by cim »

Redspear wrote:
I have added some shipdata-overrides
First to check the really obvious one - do you mean shipyard-overrides here?

Note that items in standard_equipment are never advertised as being part of the ship's equipment on F3F3 - and that goes double for invisible ones. Have you actually checked with the debug console or similar that after buying the Asp it doesn't have the equipment fitted?

Note that shipyard-overrides replaces rather than merges at the level of the sub-keys. So to avoid removing the Asp's other standard equipment, you'd need to do this instead:

Code: Select all

		"standard_equipment" =
		{
			extras =
			(
                "EQ_SCANNER_SHOW_MISSILE_TARGET",
                "EQ_TARGET_MEMORY",
                "EQ_MEDIUM_HULL"
			);
			"forward_weapon_type" = "EQ_WEAPON_PULSE_LASER";
			missiles = 1;
		};
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Trouble making a new piece of kit

Post by Thargoid »

Code: Select all

visibile = false;
The above certainly won't help - visible only has 2 i's in it...
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2659
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Trouble making a new piece of kit

Post by Redspear »

Sorry, it seems I wasn't very clear.

Yes, I mean shipyard-overrides; apologies for the careless typing...

...which explains this:
Thargoid wrote:

Code: Select all

visibile = false;
The above certainly won't help - visible only has 2 i's in it...
Well spotted Thargoid and thanks.

As for visibility of the equipment. When set to visible, with low tech, they show on F3 (for purchase) and seem to exhibit the dependencies asked of them.
I'm reasoning that they are not installed on a newly purchased craft because, upon purchasing the ship, they neither display on F5 (when set to visible), nor am I prevented from buying them on F3 (I shouldn't be able to buy them if they were already installed, right?)

Thanks cim: I didn't know about the replace not merge issue, but I have also tried editing the equipment.plist itself and even including all of the shipyard info in the override file.
Norby wrote:

Code: Select all

this.startUp = this.playerBoughtNewShip = function() {
  if(player.ship.dataKey=="asp-player") 
    player.ship.awardEquipment("EQ_MEDIUM_HULL");
}
That code has something mine was missing, I'll give it a try, thanks.

Thanks for your time.
Post Reply