Page 2 of 2

Cloaking is wasted on the npc...

Posted: Mon May 07, 2012 4:22 pm
by Switeck
"EQ_SHIELD_ENHANCER" is not useful enough for what I desire.

The npc ship cannot even be forced to cloak unless it is near max energy. Below ~75%, and it decloaks and stays decloaked.
Giving them a lot higher energy (max) only buys them a few extra seconds unless their total energy regen rate is over 10 energy/second...and even that isn't enough if it's firing away with laser/s and/or plasma turrets.

So unless a npc ship is scripted to only use cloaking in short bursts, there's almost no point in it being able to cloak. A script that can get it to cloak for 1 second every time a missile is fired at it would be pretty slick, but it would still have to fall back to ECM if it lacks enough energy to cloak or inject away.

Re: Cloaking is wasted on the npc...

Posted: Tue May 08, 2012 4:43 am
by Capt. Murphy
Switeck wrote:
"EQ_SHIELD_ENHANCER" is not useful enough for what I desire.

The npc ship cannot even be forced to cloak unless it is near max energy. Below ~75%, and it decloaks and stays decloaked.
Giving them a lot higher energy (max) only buys them a few extra seconds unless their total energy regen rate is over 10 energy/second...and even that isn't enough if it's firing away with laser/s and/or plasma turrets.

So unless a npc ship is scripted to only use cloaking in short bursts, there's almost no point in it being able to cloak. A script that can get it to cloak for 1 second every time a missile is fired at it would be pretty slick, but it would still have to fall back to ECM if it lacks enough energy to cloak or inject away.
OK, have to ask - what exactly is it you desire or want to happen? Is is a specific scenario for a specific ship, or is it the general cloaking behaviour you want to change? If the former, don't forget that although you can't directly alter maxEnergy or recharge rate via script, you can alter energy on the fly, so in effect you can script an alternative cloak discharge rate using either timers or frameCallBacks from a shipScript. If the latter it is also doable via worldScript and can explicitly not affect the player if that is the intention.

Cloaking parameters are the same for the NPC and the player AFAIK. It looks to me that the parameters are 1) need 75% of max energy to activate the cloak (whether via cloak_automatic or script. 2) But it stays active until energy drops below 128 absolute value (subject to the cloak_passive shipdata key for NPCs). 3) Energy use rate 12.8 / second.

Re: wiki typo or really the case?

Posted: Tue May 08, 2012 4:19 pm
by Switeck
Having a npc ship that can stay cloaked indefinitely (at least as long as nothing is shooting at it and it's not shooting as well) but without giving it an atrociously high energy regeneration rate if it's not cloaked might be useful. I don't know what frameCallBacks are. What/where do I need to read to find out about them?

I neither confirm nor deny using cloaked npc ships in my unreleased OXPs. :P

Re: wiki typo or really the case?

Posted: Tue May 08, 2012 6:11 pm
by Capt. Murphy
frameCallBacks basically allow you to set up a function that is run once every single frame. I think initially it was intended for animations, but they have a lot of potential uses beyond fancy graphics.

The wiki entry is here http://wiki.alioth.net/index.php/Oolite ... meCallback.

Having thought about about what you want to do a timer from the NPC's shipScript is probably the simplest way to go. When the NPC is cloaked it runs once per second to add to the NPC's energy an amount somewhere between 0 and 12.8, which in effect reduces the rate that energy is used by the cloak by that amount. Just remember to be careful with the condition checks/triggers so it only runs when the NPC is cloaked.

Re: wiki typo or really the case?

Posted: Tue May 08, 2012 6:19 pm
by Thargoid
If you want an example of this (not quite for cloaking, but same overall effect) look at the Navy Station in TCAT. Normally it has a timer increasing its energy, except when the big bugShip attacks during the middle segment. During that sequence the timer is stopped, so that the regen rate is low enough that the station could actually get nuked.

But at other times, the combined energy recharge is enough to make the station tough enough to seem like a normal station. Your ship would do something very similar, using being cloaked or not as the trigger to start/stop the timer.