New shield event request: <GetRegenHP>

Post ideas & suggestions you have pertaining to the game here.
Post Reply
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

Right now, shield devices come with the following three events:
<GetMaxHP>
<OnShieldDamage>
<OnShieldDown>

It would be very helpfull to have a <GetRegenHP> event (fired every 30 ticks or so), as to allow for the creation of shields with a dynamic regen rate.

The other method would be to add a 'regenBonusPerCharge=' attribute for shield generators using charges, but I think the event would be more flexible :)
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Seconded.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

That would be very interesting.

Just imagining a large HP shield with increasing regeneration proportionate to how much damage it has sustained "(the missing percentage of it's maximum HP) Per X seconds"
So a kaidun shield with 400HP would regenerate 400 HP/X sec.
but one with 600 HP would regenerate 200 HP/X sec.
And a shield with 50 HP would regenerate 750 HP/X sec.

That would make enhancement of such shields insanely powerful
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

did you have a look at this old proof of concept variable regen rate shield mod ?
http://xelerus.de/index.php?s=mod&id=184
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

I was not aware of the mod you link to. I did something like that myself and it resulted in this request.
Betelgeuse's proof of concept has two issues that both show that dynamic shield regeneration rates are not really supported:
  1. The regeneration is not smooth, but rather bursts of regen every 30 seconds (due to the use of the <onUpdate> event).
  2. The shield generators description will indicate that the shield does not regenerate; hardly a quality that would make me buy one.
~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

1. Doesn't onUpdate activates every 30 ticks? (That's like, just about a second if I'm not mistaken)
2. You can say it in the description, that the shield regenerates with special technique or something.
Yes, look at my avatar, I have a wyvera type ship.
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

my mistake, I meant to say '30 ticks'. And yes, I could write about the special properties it in the description.
However, it would make things way more polished. and accessible to the casual modder, if the requested event was to be supported.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

It would also make things more polished if it was possible to do a custom stat line. For this you'd just want to say "regen variable" or something similar. For weapons using scripted projectiles you'd want multiple damage entries or a damage entry with multiple type icons or somesuch. For the Rasiermesser powered armors and duralloy and similar you'd want a regen entry even though armor doesn't normally have one. For stuff like patcher arms and patch spiders you might want to put a regen entry as well.
Literally is the new Figuratively
User avatar
sun1404
Militia Captain
Militia Captain
Posts: 527
Joined: Thu Nov 03, 2011 10:32 am
Location: Heretic. (Finally!)

Custom stat lines would be great! But I think that'll be harder to implement than even the event itself.
Yes, look at my avatar, I have a wyvera type ship.
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

@ pixelfck
Is it possible for you to run a scripted event every, say, 3 ticks and gather your variable regeneration through increased fine granularity regenerations? (Or would that just create massive lag?)
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

@FourFire: I tried it (with recurring- and single event timers) but it turns out that the gSource and/or gItem variables are not set for events triggered by a timer. So that pretty much ruled out that solution.
But even if it did work, it would be more complicated that it may first seem. The engine works with whole number only, the regenerated HP per tick vary, even for a static regeneration rate.
Also, running complex code every tick would put quite a strain on the engine; even more more than one ship (enemies for example) could have the ship equipped.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Happily there is only one shield per ship so you can use objsetdata/objgetdata to store and retrieve the ship's objectID on whatever object your timer is running on. You can also store a counter to count off each timer iteration to handle fractions. Eg. a shield with a 6 2/3 regen per tick would regen 6 on the first iteration, 7 on the second and third, and reset the timer to the start on the fourth.
Literally is the new Figuratively
TVR
Militia Commander
Militia Commander
Posts: 334
Joined: Sat Sep 08, 2012 3:26 am

TVR wrote:Use this for recurring event timing control, rather than the virtual station method:

Code: Select all

<ItemType UNID="&Timer;"
      name=            "Timer1"
      level=            "5"
      value=            "2500"
      mass=            "3000"
      frequency=         "uncommon"
      modifiers=         "MajorItem; NAMI"

      description=      "This device will execute the <OnFireWeapon> event in itTimerEvent once every tick."
      >

   <Image imageID="&rsItems1;" imageX="0" imageY="192" imageWidth="96" imageHeight="96"/>

   <AutoDefenseDevice
         targetCriteria=   "G N:10000"
         weapon=         "&itTimerEvent;"
         fireRate=      "1"
         /> <!-- fireRate controls how often the recurring event should fire, 1 or 2 = 30 times per second, 3 = 15/s, 5 = 10/s, 15 = 6/s, etc. Default target criteria is when a gate is within 10k ls, which means it will almost always trigger, and weaponDevice is a special dummy weaponDevice that only includes the code to be executed and some additional parameters -->
         
   <Events>
      <OnInstall>
         Nil
      </OnInstall>
   </Events>
</ItemType>

<ItemType UNID="&itTimerEvent;"
      name=            "Timer Event"
      level=            "5"
      value=            "2500"
      mass=            "3000"
      frequency=         "notrandom"
      modifiers=         "MajorItem; NAMI"

      description=      "When fired and only when fired from an AutoDefenceDevice or the weapon fire button, this weapon device executes the code placed under its <OnFireWeapon> event."
      >

   <Image imageID="&rsItems1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>
   
   <Weapon

         type=         "missile"
   
         damage=            "generic:0"
         fireRate=         "15"
         powerUse=         "100"
         
         sound=         "&snRecoillessCannon;"
         > <!-- powerUse controls the amount of power consumed by the timer device, fireRate is only used if this device is installed separately from the timer, and sound will play every cycle, other keys have no function -->
   </Weapon>
   
   <Events>
      <OnFireWeapon>
         <!-- repeating code here -->
      </OnFireWeapon>
   </Events>
</ItemType>
This does not require a new station per system, instead, the timing control device stays on the spaceObject once installed. <checkTarg> can be transferred to <OnFireWeapon> with no or minimum modification.
This provides gSource, and is the recommended timer method since it localized to a single spaceObject. This can serve as the regen'er for the shield with fairly easily.
Fiction is reality, simplified for mass consumption.
PGP: 0x940707ED, 5DB8 4CB4 1EF5 E987 18A0 CD99 3554 3C13 9407 07ED
Bitcoin: 1LLDr7pnZDjXVT5mMDrkqRKkAPByPCQiXQ
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

@Atarlost: Timer Events cannot be put on items, only on objects or types. So the easy solution is out.
@TVR: I'm looking for engine support, making dynamic shield regeneration rates something to play with of everybody.
I'm sure I can come up with code that eventually does what I would like it to do, but in my opinion, it is a horrible solution not very elegant to have a virtual weapon trigger the <OnFireWeapon>-event once every tick, in order to run code that hooks into the shield generator and checks if we need to do some recharging.

All in all, I'm surprised that this feature request has triggered a people into providing all sorts of arguments why it would not be required.
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

pixelfck wrote:@Atarlost: Timer Events cannot be put on items, only on objects or types. So the easy solution is out.
Common practice is to use a virtual station to hold timer events. I think you can actually get away with only one type per mod no matter how many timers you need, though you'll need one instance per timer instance.
Literally is the new Figuratively
Post Reply