Difference between revisions of "NPC equipment damage OXP"

From Elite Wiki
(Added newer versions (Phkb & Tsoj))
(Moved link to download section, added more links, better summary)
Line 1: Line 1:
NPC Equipment Damage 0.2.1 by [[User:Ngalo|Ngalo]]
 
  +
Allows NPC equipment & cargo to get damaged in combat, just as happens to the player.
   
Does what it says on the tin: allows NPC equipment to get damaged in combat, as much like the core player damage handling as I can manage.
 
  +
== Overview ==
  +
Ngalo was famous for pushing equal rights for NPC's. Just as the player gets shields, so too should the NPC's... But here the player is disadvantaged. So Ngalo evened things up here too...
   
Also damages NPC cargo, because Oolite does both with the same code for the player.
 
   
== Newest Version (not on Expansions Manager) ==
+
== Newest Version ==
Tsoj found a few bugs (damage probability calculation was way too low compared to what Oolite does for the player, and a typo made the OXP incompatible with N-Shields), that he fixed.
+
Tsoj found a few bugs (damage probability calculation was way too low compared to what Oolite does for the player, and a typo made the OXP incompatible with N-Shields) that he fixed.
   
 
Here is the new version: [https://app.box.com/s/y7e38xnfsuoraochjpt76u72b4smzzaq NPC Equipment Damage OXP 0.3.0]. This includes the manifest fix by phkb.
 
Here is the new version: [https://app.box.com/s/y7e38xnfsuoraochjpt76u72b4smzzaq NPC Equipment Damage OXP 0.3.0]. This includes the manifest fix by phkb.
   
 
== Note on code ==
 
== Note on code ==
  +
This oxp also damages NPC cargo, because Oolite does both with the same code for the player.
  +
 
OXP equipment which needs to be disabled by script when damaged can push a handler onto the worldScripts.NPC_Equipment_Damage.NPC_equipmentDamagedHandlers array.
 
OXP equipment which needs to be disabled by script when damaged can push a handler onto the worldScripts.NPC_Equipment_Damage.NPC_equipmentDamagedHandlers array.
   
Line 27: Line 29:
   
 
}</blockquote>
 
}</blockquote>
 
{{OXPNote|The current Expansions Manager version of this OXP does ''not'' work on AppleMacs: see BB Discussion below for better versions}}
 
   
 
== License ==
 
== License ==
Line 35: Line 35:
 
== Version history ==
 
== Version history ==
 
*0.3.0 Tsoj made the oxp fairer to players, and fixed compatibility with [[N-Shields]]
 
*0.3.0 Tsoj made the oxp fairer to players, and fixed compatibility with [[N-Shields]]
*0.2.3 Phkb made the oxp AppleMac compliant
+
*0.2.3 Phkb made the oxp AppleMac compliant, fixing the manifest
 
*0.2.1 Added a small fix which prevents time-wasting if the damaged ship is about to die anyway.
 
*0.2.1 Added a small fix which prevents time-wasting if the damaged ship is about to die anyway.
 
*0.2 Made use of compatibility improvements in Ship Configuration OXP.
 
*0.2 Made use of compatibility improvements in Ship Configuration OXP.
Line 41: Line 41:
 
*0.1.1 Fixed 'quantity is not defined' bug in cargo damage code
 
*0.1.1 Fixed 'quantity is not defined' bug in cargo damage code
 
*0.1 Initial WIP release
 
*0.1 Initial WIP release
  +
  +
== Download ==
  +
*[https://app.box.com/s/y7e38xnfsuoraochjpt76u72b4smzzaq NPC Equipment Damage OXP 0.3.0] - unzip and drop the .oxp in your AddOns folder
   
 
== Links ==
 
== Links ==
[http://www.aegidian.org/bb/viewtopic.php?f=4&t=18139|BB Discussion]
+
*[http://www.aegidian.org/bb/viewtopic.php?f=4&t=18139|BB Discussion]
  +
*Author: [[User:Ngalo|Ngalo]]
  +
*[[Cheating]] - this is an ''anti-cheating .oxp'', but one that helps the player...
  +
   
 
[[File:Tag-colour-blue.png]]{{OXPLevel|0}}
 
[[File:Tag-colour-blue.png]]{{OXPLevel|0}}

Revision as of 11:04, 10 December 2021

Allows NPC equipment & cargo to get damaged in combat, just as happens to the player.

Overview

Ngalo was famous for pushing equal rights for NPC's. Just as the player gets shields, so too should the NPC's... But here the player is disadvantaged. So Ngalo evened things up here too...


Newest Version

Tsoj found a few bugs (damage probability calculation was way too low compared to what Oolite does for the player, and a typo made the OXP incompatible with N-Shields) that he fixed.

Here is the new version: NPC Equipment Damage OXP 0.3.0. This includes the manifest fix by phkb.

Note on code

This oxp also damages NPC cargo, because Oolite does both with the same code for the player.

OXP equipment which needs to be disabled by script when damaged can push a handler onto the worldScripts.NPC_Equipment_Damage.NPC_equipmentDamagedHandlers array.

Note that such handlers will be called as if they were in the damaged ship's script, not your worldScript.


A simple example handler from my NPC Energy Units OXP:

this.NPC_energy_equipmentDamaged = function(equipment)

{

if (equipment == "EQ_NPC_NAVAL_ENERGY_UNIT") this.ship.energyRechargeRate /= worldScripts.NPC_Energy_Units.NEU_multiplier;

if (equipment == "EQ_NPC_ENERGY_UNIT") this.ship.energyRechargeRate /= worldScripts.NPC_Energy_Units.EEU_multiplier;

}

License

You may use, adapt, distribute etc. this Oolite Expansion Pack as permitted by the Creative Commons Attribution-NonCommercial-ShareAlike License (CC-BY-NC-SA).

Version history

  • 0.3.0 Tsoj made the oxp fairer to players, and fixed compatibility with N-Shields
  • 0.2.3 Phkb made the oxp AppleMac compliant, fixing the manifest
  • 0.2.1 Added a small fix which prevents time-wasting if the damaged ship is about to die anyway.
  • 0.2 Made use of compatibility improvements in Ship Configuration OXP.
    • Prevented the script from trying to damage equipment which is already damaged, or which can't be damaged at all.
  • 0.1.1 Fixed 'quantity is not defined' bug in cargo damage code
  • 0.1 Initial WIP release

Download

Links


Tag-colour-blue.png

Levelindicator0.png
0-{{{2}}}