Jumpdrive cooldown time

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

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

Post Reply
adriancos
Posts: 26
Joined: Tue, 24. Apr 12, 11:43
x3tc

Jumpdrive cooldown time

Post by adriancos » Sat, 26. Jul 14, 17:21

hello

i noticed that there are some mods that modify the jumpdrive, but none of those i could find have something that i would be very interested in:
a jumpdrive cooldown time, it will make the game a lot more interesting (or hard) from my point of view :wink: (i am already using XRM, but the fact that the jumpdrive can be used at any point is not good)

does someone know of the existence of a mod or script that is doing this? or it is possible to create one? (i read somewhere that some stuff can not be modified in the game)

Edit: typo

User avatar
MaxVatutin
Posts: 200
Joined: Thu, 7. Nov 13, 15:41
xr

Post by MaxVatutin » Sun, 27. Jul 14, 00:14

Hey!)

Yep, it's possible and really simple to add such a cooldown. Same way i've made it for FTL system (for BSG mod, instead of vanilla jump drive). If you have some skills in scripting for X3 (or gain some, you'll have to read a little and you'd better use X-studio), just add at the beginning of two vanilla scripts named "!move.jump.pck" and "!move.emergencyjump.pck" something like:

Code: Select all

$owner.race = [THIS]-> get owner race
if $owner.race == [PLAYER]
 if [THIS] is task 1234 in use
  $jumpdrive.not.charged = read text: page=1234 id=1
  if [THIS] == [PLAYERSHIP]
   display subtitle text: text=$jumpdrive.not.charged duration=300 ms
  else
   send incoming message $jumpdrive.not.charged to player: display it=[FALSE]
  end
  return null
 end
end
So it's simple check for task used.
Instead of "1234" you may use any number, but you should avoid confrontation with any other script.
$jumpdrive.not.charged is a variable which contains a text from language file "1234" (you may also change it, of course) with any text you'd like to see.

Then, in the very end of the two listed above scripts, just before "return null" command you should add something like:

Code: Select all

[THIS]-> begin task 1234 with script 'jumpdrive.cooldown.pck' and priority 1234: arg1=null arg2=null arg3=null arg4=null arg5=null
Same, "1234" you may change, but the number of task should be the same as in the previous part of the code.

In the end, you'll have to add one new script "jumpdrive.cooldown.pck", for example:

Code: Select all

if [THIS]-> is of class [M5]
 $cooldowntime = 123456
else if [THIS]-> is of class [M4]
 $cooldowntime = 167567
else if [THIS]-> is of class [M3]
 $cooldowntime = 257756
...
else if [THIS]-> is of class [M1]
 $cooldowntime = 749568
end
@ =wait $cooldowntime ms
if [THIS] == [PLAYERSHIP]
 $jumpdrive.recharged = read text: page=1234 id=2
 display subtitle text: text=$jumpdrive.recharged duration=300 ms
end
return null
So, you may set any cooldown time for each ship class. Also you can load some text to $jumpdrive.recharged and see a message when you jump drive is ready to be used.

So, overall, while the script "jumpdrive.cooldown.pck" is on task 1234 for any ship, it will not be able to use the jump drive. Additional check added for playerships only to prevent breaking AI actions.

The main problem is that any automated script system which uses jumps will just stop if the jump drive is not ready (such as universe trader and so on).

P.S. Maybe my method is wrong, but it works well =)

adriancos
Posts: 26
Joined: Tue, 24. Apr 12, 11:43
x3tc

Post by adriancos » Sun, 27. Jul 14, 11:10

hello Max

i have no experience of modding in X series, but i noticed that there is a lot of documentation in the forum, i already started reading :)


thank you very much for the explanations, very detailed and clear

:wink:

just installed X-Studio, very handy tool

Post Reply

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