[SCR] Hotkey: Transfer Energy (To Shields, Weapons, Engines) v2

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

[SCR] Hotkey: Transfer Energy (To Shields, Weapons, Engines) v2

Post by s9ilent » Tue, 27. Jan 09, 04:47

A basic hotkey script, that switches your FIGHTER (only) between 4 modes.

energyto.zip
Image

energyto.zip

Installation.
Unzip to your scripts folder
eg program files\egosoft\x3 terran conflict\scripts
eg program Files\Steam\SteamApps\common\x3 terran conflict\scripts





When you press the hotkey, It sends the following subtitles:
Power to Shields
Power to Weapons
Power to Engines
Power Balanced (Off)
  • It draws powers from the shields, weapons reserves and engines; and shunts it to one of them.
  • It draws 20% from two, and gives a 30% bonus to one (or it does nothing in the balanced case)
  • Now works on all ships (You still need to be flying it)
  • The fighter, needs to have shields
  • It idles when your dock (i.e Reverts back to the original settings). And then up to 10 seconds after you undock, it will turn back on again (to its last mode)
  • Changing modes makes your ship auto accelerate to full speed (design feature)

    CAUTION
  • Leaving energy transfer on for extended periods of time, can causes seriously system damage (temporary, albeit dangerous), causing the loss of energy and engines.
Last edited by s9ilent on Wed, 28. Jan 09, 11:52, edited 8 times in total.

Legionnaire
Posts: 1242
Joined: Sun, 8. Feb 04, 17:28
x4

Post by Legionnaire » Tue, 27. Jan 09, 05:34

Actually this reminds me more of X-Wing and Tie Fighter than Freespace Lol
as for keys, i cant think of any immediately obvious ones, but 3 in a row together would make sense i believe Gazz created some scripts/libs? that enabled different actions on multiple presses of the same key,so that might let you cycle through settings, but seeing as ive never managed to get my head round scripting, i dont actually know if that might do what you need.

Legionnaire
Mobo MSI Z270 Gaming M3 CPU i5 7600K @4.2
RAM 16Gb Corsair Vengeance
2x 1TB (RAID 0)+ 4TB SSHD + 3TB HDD + 500GB SSD (Windows and X4 install Locatrion)
Windows 10 PRO
8GB MSI 1070Ti

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 27. Jan 09, 05:43

Hrm.. his multiple clicker has some application here, but its not quite enough as there are essentially four modes.
(Engine, las, shield, balanced)

And forcing someone to quadruple click to do something is a little cruel.


Hrm.. I suppose f6-8 are currently unbound. Although I'm swinging more towards a single hotkey for cycling between the four modes. As the increments I can do are limited to essentially 1 engine tunning. (which is 10% of the base speed, not including other engine tunnings) but I want it to be a consistent increase across ships (I think?) so it will be a fixed increased/decreased (proportion) to all stats.


Hrm... potential problem.... There is no get laser energy recharge rate...

User avatar
Axeface
Posts: 1903
Joined: Fri, 18. Nov 05, 01:41
x4

Post by Axeface » Tue, 27. Jan 09, 10:20

Ok... awesome! DLing now.

A little bit of X-Wing Alliance for TC :) Thanks.

u24j7x5
Posts: 598
Joined: Thu, 1. Sep 05, 09:00
x4

Post by u24j7x5 » Tue, 27. Jan 09, 11:51

hi,

@s9ilent

the scripts 'lib.math.fixed.multi2' and 'lib.math.fixed.multi3' are missing in the zip, i guess.

greez

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 27. Jan 09, 11:54

Hrm.. Whoops

Re uploaded with the maths libs

User avatar
Hexenhammer
Posts: 124
Joined: Fri, 10. Aug 07, 23:57
x3tc

Re: [SCR] Hotkey: Transfer Energy (To Shields, Weapons, Engines)

Post by Hexenhammer » Tue, 27. Jan 09, 17:45

s9ilent wrote:
  • It only works on fighters
  • The fighter, needs to have shields
please specifiy what you mean with 'fighters'. m3,4,5 only or can i use this script with my hyperion m6 also?
Image Image

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 27. Jan 09, 22:23

Fighters is an object class used by X3. It specifically means M3-5 and possibly M8's.
A M6 is not a fighter

User avatar
LV
Sith Lord
Posts: 6362
Joined: Wed, 6. Nov 02, 21:31
x3tc

Post by LV » Tue, 27. Jan 09, 22:47

a couple of things

1. a very good script

2. i don't like your docking procedure, i'd personally feel a short hotkey use of this may be better

3. It only works on fighters
why? a good idea should not wasted, why not have ts/tl ships sacrifice laser and shield power for a faster escape? (outrun a missile or a short quick engine tuning/and/or rudder increase?

4.Changing modes makes your ship auto accelerate to full speed (design feature)

why not also consider slower speed in combat as an idea?

5. Penalty (in my book: low chance of eqip/rudd/tun/etc breakage)

you should refine this one, it has muchos potential :thumb_up:


feel free to ignore me, you've written a good script even i'd consider installing as default with the correct balancing imo
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 27. Jan 09, 23:40

@LV (Wooo first moderator complimented script <3)

2. I have to put back a temporary "Power Balanced" mode when docking, as a player would sooner or latter notice.. hey I have 14/10 engine tunnings, and inevitable try to "upgrade" the ship, which will in fact put it back to 10 and "refund" those 4. The script does auto-restore the ship back to the amount its suppose to be at (charging the player.. oh DOH!!!... right... it doesn't charge the player yet... GRRR I haven't made that script yet... I just left a place holder...)
But yeh, in short, it reverts the ship to prevent tinkering. Then it un-re-reverts?? the ship 0 - 10123ms after its launched (!dockedat)

How would you have done the docking thing?


3, One of the main reasons I wanted to exclude capitol ships, is because there is no "get laser recharge rate" command. And right now the script just uses the shields change / 5 to approximate the correct amount to add to lasers. "/5" is aprox correct for fighters (with the M4+ and M3+ being weird, standing at about /4.5). But with capitol ships its just all over the shop. (2-4ish)
And I can't exactly build a self-generating library, as AFAIK laser energy is only for insector ships. (So it would be a very laggy & noisy, self generating library)
Leaching power from near-non existant weapon banks, I needed something to balance them to prevent continuous engine-maxing. (I see your point 5)
Ill considering opening this up to transport ships (TL's may need a library.. *sigh* a manually generated one...)

4) Speed Control. Originally the script kept your ships speed constant at xx% with the set speed command. However, I quickly realised that the set speed command is actually cheating, as it would instantly accelerate you.
(the code is still there, just commented out.. hrm... or I deleted it.. that too). So now I have the choice of, don't change speeds, full speed, or speed 0.
I had to pick one, so I figured pick the max. I could make two copies of the script, one with out the speed-max-er. OOOORRRRR, if speed is already max, then re-max, else nothing.


5. Hrmm.. :( But I luv my ship.. What to break what to break... I know, I can break things with out breaking them!
a) Remove wares, insert "place holder" debris sort of wares, which will be restored in time,
b) Just remove wares (boom they exploded)
c) Random energy spikes, loss of shields/laser/engines sporadically set speed to 0
Which is/are your favourite(s)?
each tick, randomly generate a number between -10 -20(Mean 5) (Mean/second 25) Desired expected failure time, 60s? 25 * 60 150 0, 1500 is the burnout, does something "bad" to the boosted system, reverts count, disables power boost.


But Ill have to stick this to the "todo" list for now :S SFM needs tweakage (again) and I've got work soon

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Wed, 28. Jan 09, 12:06

Ok updated as per LV's suggestions.

Changes:

If your at 100% speed, it will keep you at 100% speed when your engines change, otherwise, it'll stay at the same level (number, not percent) its current at.

Works on all ships (it still gains /5 laser energy thou :S I couldn't find an effective balancing solution for the /2 - /5 issue)

Keeping it on for extended periods of time can cause energy surges to your ship. Resulting in random loss of engines/shields/lasers. It will beep slowly when your at minor fluctuations, then beep madly, then beep madly and loudly, then your ship will short out and go funny. Shorting out will also cause energy transfers to turn off, and disable for the duration of the short.
Once the short is over, the system begins it's re-power up cycle, and when it says power balanced again, you can turn it on again.

User avatar
Hexenhammer
Posts: 124
Joined: Fri, 10. Aug 07, 23:57
x3tc

Post by Hexenhammer » Wed, 28. Jan 09, 14:53

Really a useful script, I love it - and thanks for making it work with *all* vessels (esp. my Hyperion) :)

I yet have some ideas for improvement:

1. 20 seconds until the first warning occurs seems a bit short, especially in bigger battles with many enemies. How about 30 second steps (30,30,15,15 until it shorts)?

2. +1 on more usable keys, like F5 - F8 or so!

3. It would be even cooler if the script gave an audio signal upon changing modes, like the computer saying "diverting power to the shields now, SIR" ;)

4. If possible, do some visual icons for the different modes which appear in the HUD when changing modes, so that the pilot can see which mode currently is activated.


Great script! Keep up the good work!
Image Image

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Wed, 28. Jan 09, 22:46

1. The time between modes is slightly random. On average.. your ships should last about a minute. However... despite the fact its a neg bin dist with 300 iterations... the expected number rarely happens...
So Currently, the warnings are at 20s, 40s, 55s (alarm beeps) (On average)
How long would you recommend spacing out the warnings (given that it runs only for a minute)

2. What does the second key do?
I was considering useing Gazz's double click manager to do a "restore defaults"

3. Someone would have to record and upload the sound file. And it can't be me, as it would take a LONG time for me to upload a wav (and I lack the storage space). Plus I don't exactly have the most awesome recording setup (People complain on left for dead that they can never hear me :S)

4. I made subtitles. Turn them on in your audio controls menu. As for a blip or something, AFAIK, the custom GUI doesn't work with X3TC (Well the gui is an external app so that always works, but the interface doesn't)
And short of creating a different coloured Sun (or blip) in the universe, my options are limited.

User avatar
Hexenhammer
Posts: 124
Joined: Fri, 10. Aug 07, 23:57
x3tc

Post by Hexenhammer » Wed, 28. Jan 09, 23:39

Hi s9ilent,
thanks for the fast reply :)

1. If it is that complicated to change the timer settings, just leave it as it is now. I only wanted to suggest that the whole "shorting out" thing be delayed a bit, e.g. 30s first warning, 60s second warning, 75s third warning, 85s short - or so.
In the range of only one minute, the 20s,40s,55s setting is ok!

2. I meant using different keys for different modes: F5 = power balanced, F6 = power shields, F7 = power engines, F8 = power weapons. That should be possible, isn't it? I don't know bout Gazz's manager so I can't say anything about it.

3. No no, it is possible to use the ingame text-to-speech engine to tell stuff I think. It's huefte's Space Loot Transporter script which made me think about it:
http://forum.egosoft.com/viewtopic.php?t=217169
If an error occures, the reason will be told with audio-comments.
There are *no* .wav or .mp3 files whatsoever included here, only the scripts - and the computer tells you a lot of stuff when using this script; which was not so before (e.g. "target is out of range, it is impossible to transport" and such)!
Therefore it must be possible to include audio messages used by the game engine to tell the pilot exactly what just happens :)

4. I have subtitles enabled and can read the "Power to Weapons" messages, but they don't stay on the HUD and in the midst of battle it would be nicer to just look at an icon or button which tells what mode is currently active, instead of pressing the plugin-button over and over again.
But this is not so important; the script is working fine.. only suggestions here :)
Image Image

adecoy
Posts: 203
Joined: Wed, 24. Jan 07, 07:26
x3tc

Post by adecoy » Thu, 29. Jan 09, 02:38

is it possible to script in the pyramid from xwing/freespace, the one thats like this?



e
/.\
s w
shield engine weapons

and you could move the dot around with your mouse.
Image

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”