Page 1 of 2

Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 7:10 pm
by Smivs
Hi all,
I'm working with a bit of high-tech kit which has an initial TL of 99 which I want to make repairable at TL15 only, and I can't! It also becomes repairable at TL14.
To make sure it's not buyable, I've scripted it so that the TL reduction kicks in only when the player docks with a damaged item, thus.

Code: Select all

this.shipDockedWithStation = function (station)
{
 if(player.ship.equipmentStatus ("EQ_HIGHTECH_DEVICE") == "EQUIPMENT_DAMAGED")
  {
   EquipmentInfo.infoForKey("EQ_HIGHTECH_DEVICE").effectiveTechLevel = 14;
  }
}
This might seem a strange way to do this, but I have my reasons. :wink:
I have also tried setting effectiveTechLevel to both 15 and 16, with the same result...namely the repair is offered at TL14.
I've checked there are no missionvariables in the save file which could be causing this.
Every other element of this WIP is working fine and as expected, except this bit.
Is TL14 some sort of default maximum...the game rounds-down anything higher?

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 7:32 pm
by Eric Walch
Smivs wrote:
I have also tried setting effectiveTechLevel to both 15 and 16, with the same result...namely the repair is offered at TL14.
I've checked there are no missionvariables in the save file which could be causing this.
Every other element of this WIP is working fine and as expected, except this bit.
Is TL14 some sort of default maximum...?
yes, it is hardcoded that 14 is the maximum. In my opinion that is a bug because TL15 is also very useful as you realised:
With a value of effectiveTechLevel=15, Equipment becomes only buyable at techlevel 16 (none-existing) but reparable at techlevel 15

Code: Select all

Level 15 systems only exist in G1 (1x), G2 (1x), G5 (1x), G6 (1x) and G7 (2x) 
That makes that the player can repair such stuff, but not in every galaxy :wink:

The current limit is not mentioned in the wiki and I just found out in a similar way as you now did: wondering why things in the oxp didn't work as I programmed.

I already had in mind to add this change to trunk in the near future.

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 7:41 pm
by SandJ
Eric Walch wrote:
In my opinion that is a bug because TL15 is also very useful as you realised: With a value of effectiveTechLevel=15, Equipment becomes only buyable at techlevel 16 (none-existing) but reparable at techlevel 15

I already had in mind to add this change to trunk in the near future.
Is there any mileage in making the cloaking device repairable at TL15 at the same time?

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 8:06 pm
by Smivs
Eric Walch wrote:
yes, it is hardcoded that 14 is the maximum. In my opinion that is a bug.....
I already had in mind to add this change to trunk in the near future.
<Smivs nods in agreement> :)

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 8:10 pm
by Eric Walch
SandJ wrote:
Is there any mileage in making the cloaking device repairable at TL15 at the same time?
That was the reason I ran into that 'bug/feature'. In my opinion it should become reparable. And with that techlevel there are only 6 systems in the whole of 8 galaxys were you could do it.

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 8:36 pm
by Cody
Eric Walch wrote:
SandJ wrote:
Is there any mileage in making the cloaking device repairable at TL15 at the same time?
That was the reason I ran into that 'bug/feature'. In my opinion it should become reparable. And with that techlevel there are only 6 systems in the whole of 8 galaxys were you could do it.
Music to my ears! At what price... the same as the NEU? Or substantially more?

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 9:43 pm
by Smivs
<Smivs quietly bins his CloakRepair OXP>

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 10:05 pm
by Eric Walch
El Viejo wrote:
Music to my ears! At what price... the same as the NEU? Or substantially more?
Currently its only my personal opinion, but in the code is already commented a suggestion for a long time, to make it repairable. In my opinion it makes oolite more challenging. Without the option for repair, is damaging the cloak, the same as being killed. Whenever it happens to me, I have to kill myself to continue with a game were I still have a cloak. So, I am never in the situation were I have no cloak at all.

When the cloak can be repaired, I am more likely to accept the loss and continue playing without cloak. In the worse case it can take 2 galactic jumps to enter a galaxy that has repair facilities for it. That probably means playing without cloak for several days/weeks. Adds a new challenge for those that were hooked to the cloak.

The current purchase price has always been set at 50000. That is 5% higher than the NEU, but that was more because there had to be a value filled in. I think the price could be upped so that repair itself costs 50 grand.

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 10:11 pm
by Gimi
Eric Walch wrote:
When the cloak can be repaired, I am more likely to accept the loss and continue playing without cloak. In the worse case it can take 2 galactic jumps to enter a galaxy that has repair facilities for it.
The current purchase price has always been set at 50000. That is 5% higher than the NEU, but that was more because there had to be a value filled in. I think the price could be upped so that repair itself costs 50 grand.
I agree with this, it should be repairable. It would probably make the game harder in the long run, as the player would have more encounters without the cloak (waiting for repair). Just remember to make sure that the repair bots can't fix it.

Re: Problems with 'effectiveTechLevel'

Posted: Fri Feb 24, 2012 10:50 pm
by Cody
Eric Walch wrote:
I think the price could be upped so that repair itself costs 50 grand.
That's exactly how I had it set for ages. But I reckon the NEU is by far the more valuable kit, combat-wise, so I recently reduced it to match the NEU price.
However, if it was to go into the core game, 50k for repair is a cool number.

Re: Problems with 'effectiveTechLevel'

Posted: Sat Feb 25, 2012 5:55 am
by Switeck
Smivs wrote:
I'm working with a bit of high-tech kit which has an initial TL of 99 which I want to make repairable at TL15 only, and I can't! It also becomes repairable at TL14.
To make sure it's not buyable, I've scripted it so that the TL reduction kicks in only when the player docks with a damaged item, thus.

Code: Select all

this.shipDockedWithStation = function (station)
{
 if(player.ship.equipmentStatus ("EQ_HIGHTECH_DEVICE") == "EQUIPMENT_DAMAGED")
  {
   EquipmentInfo.infoForKey("EQ_HIGHTECH_DEVICE").effectiveTechLevel = 14;
  }
}
Simple solution: check what TL the system you're in is...and make the item repairable via effectiveTechLevel *IF* it's a TL15 system.

Re: Problems with 'effectiveTechLevel'

Posted: Sat Feb 25, 2012 9:54 am
by Thargoid
Gimi wrote:
Just remember to make sure that the repair bots can't fix it.
The repair bots (and repair system) can fix a cloak, but the chance is low. Lvl 99 tech currently has a 10% chance of fixing, and items with a tech level between 9 and 17 have a diminishing chance (90% at TL9, dropping by 10% per TL).

That has been in there from the beginning, and will remain in there. Personally I also don't like the concept of unfixable technology, so in lieu of any other solution I worked around it. Especially as other OXPs introduce a few cloaked ships, hence narratively it's not quite the one-off item it perhaps used to be.

But making it unrepairable on a per-user basis is simple, by just adding the repair chance equipmentInfo tag to the cloak's entry, as detailed in the OXP itself.

Re: Problems with 'effectiveTechLevel'

Posted: Sat Feb 25, 2012 10:46 am
by Commander McLane
For completeness I'd like to add that also the Hackers on a Hacker Outpost have the technology to repair the cloaking device, if you have Anarchies.oxp installed. This has been the case for quite a long time.

Re: Problems with 'effectiveTechLevel'

Posted: Sat Feb 25, 2012 11:22 am
by Eric Walch
Commander McLane wrote:
For completeness I'd like to add that also the Hackers on a Hacker Outpost have the technology to repair the cloaking device, if you have Anarchies.oxp installed. This has been the case for quite a long time.
I see. But currently you are always making it non-buyable after a launch from a hackers Outpost:

Code: Select all

this.shipWillLaunchFromStation = function(station)
{
	if(station.name === "Hacker Outpost") delete missionVariables.TL_FOR_EQ_CLOAKING_DEVICE;
That would mean that when officially making it repairable on a level 15 system, this code would revert it to the current, not-repairable, situation. Better add a check in it to revert it to the original value of EquipmentInfo.infoForKey("EQ_CLOAKING_DEVICE").effectiveTechLevel on docking an Outpost. :lol:

It is not even needed to do these level settings in the worldScript. It could also be done in the station script itself when it detects a launch/docking of a player.

Re: Problems with 'effectiveTechLevel'

Posted: Sat Feb 25, 2012 1:07 pm
by Commander McLane
Good call. When I included the repairability of cloaking devices to Anarchies.oxp, there was no other script that tried to do the same, therefore I took it for granted that the device's TL would stay at 99, and I only needed to change it on docking.

This will of course interfere with other OXPs trying to reset its TL more permanently.

Although other OXP authors could of course easily assume the same thing and also change the TL only temporarily. If everybody sticks to it, there won't be any interference and any override.

Anyway, for the benefit of a changing policy for vanilla Oolite (and OXPs which may be more careless) I'm going to change it along your suggestion for the next release of Anarchies.