[AL Plugin] Khaak Invasions v1.8 [TC] [AP] [Updated: 29.06.2014]

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

Larxyz
Posts: 262
Joined: Tue, 16. Nov 04, 08:46
x3tc

Post by Larxyz »

Was just about to report that the carrier/m6/scouts didnt have any lasers...
but it was allready reported, lol.

by the by, carriers wernt using its missiles?
it had about 1700 stings on board. :)

besty
/larxyz
-XeNoN-
Posts: 373
Joined: Tue, 6. Mar 12, 12:04
x4

Post by -XeNoN- »

Nico@
After installing v1.3 and when i try to put numbers in the timing control then turn on Khaak Invasions, i get very serious lag and constant messages...
What is going on?

EDIT: Removed all scripts from the older version, maked a clean save same thing happens...after i check to "ON" in menu the game halts for 5 mins and nothing happens (the messages were spamming when i didnt uninstalled older version)...wtf is going on?

Also v1.2 worked fine for me except there were no weapons on ships larger than M4.
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

DrBullwinkle wrote:If you begin the tuning with "add default wares" then all ships should get the basic weapons; vanilla and modded alike.

If you want to add *more* weapons, then you could add mod-specific weapons.

The result would be that your Kha'ak might be "normal" strength in vanilla, but stronger-than-normal in XRM. I would think that would be acceptable to many players, without requiring you to maintain two versions of the script.
Yes, I would have to detect some XRM related value, then pick either vanilla or XRM related wares.
I had a look into the scripts with a vanilla setup, and there were also many ships not spawning because I have many XRM related ships in the script.
For now, I made a vanilla safe version. Will it up later, I at work ATM.

I really have to stop scripting and play a little XRM or my head is gona explode in a bloody mess! And I still have to fix those problems regarding my '***''**## ADS eddition. :(
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Post by 7ate9tin11s »

The following code is how I handle weapon compatibility in ik2. Each ship randomly gets lasers which are best in strength, distance, or bullet speed for all turrets. So it does not matter the mod, something will fit in there!

Code: Select all

* lasers
$t = $ship->get number of turrets
while $t 
  dec $t =
  if $ship->can turret $t fire missiles
    * Find and install valid missiles instead
    continue
  end
  $l = $ship->get compatible laser array: turret=$t
  $range = null 
  $range.val = 0 
  $strength = null 
  $strength.val = 0 
  $speed = null 
  $speed.val = 0 
  $index = size of array $l
  while $index 
    dec $index =
    $laser = $l[$index]
    $temp = get range of laser $laser
    if $temp > $range.val 
      $range.val = $temp 
      $range = $laser 
    end
    $temp = get shield damage of laser $laser
    $amt = get hull damage of laser $laser
    $temp = $temp + $amt 
    if $temp > $strength.val 
      $strength.val = $temp 
      $strength = $laser 
    end
    $temp = get bullet speed of laser $laser
    if $temp > $speed.val 
      $speed.val = $temp 
      $speed = $laser 
    end
  end
  if random value from 0 to 4 - 1
    if random value from 0 to 2 - 1
      $laser = $range 
    else
      $laser = $strength 
    end
  else
    $laser = $speed 
  end
  $slots = $ship->get max. number of lasers in turret $t
  = $ship->add $slots units of $laser
  while $slots 
    dec $slots =
    $ship->switch laser in turret $t gun $slots to $laser
  end
end
I also have a much more randomized version for 'not best' ships, but enemies always need to be tuned up to the max, right? :fg:

-7ate9tin11s
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

7ate9tin11s wrote:The following code is how I handle weapon compatibility in ik2. Each ship randomly gets lasers which are best in strength, distance, or bullet speed for all turrets. So it does not matter the mod, something will fit in there!
Well, I think this is the difference between an advanced scripter and a wannabe like me. Hat down 789. I will try to improve my tune routine by using parts of yours :D.
I also have a much more randomized version for 'not best' ships, but enemies always need to be tuned up to the max, right? :fg:

-7ate9tin11s
:) AI is that dumb that it needs some help, don't you think ? :roll:

Regarding missiles: I also noticed the bigger ships not using missiles as much as they should. I will raise missile fire probability and make some tests.
-XeNoN-
Posts: 373
Joined: Tue, 6. Mar 12, 12:04
x4

Post by -XeNoN- »

Nicoman@

I have discovered a problem, while overwriting scripts from 1.2 version the config menu still says 1.2 but when i started a new game it works fine then...
Im too lazy to start all over again since i have 32 days of playing on my save...can you fix this pls or make uninstallation script in game like 789 did.
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

Hey 7ate9tin11s, I used your routine to improve mines and to make it compatible to the vanilla version and to any mod. First I just wanted to make a XRM version, but on your and Doc's demand (and to keep fuss low), I try to get this as compatible as possible.
Ship tuning is no longer a problem. Only one thing left: How to check, if a certain ship class is available or not?
For example: I would like to create an advanced Khaak corvette. But this is only available in XRM, in vanilla only the normal corvette can be used.
a) Is there any command to check for the existance of a certain object class / ship class?
b) Or better check, if XRM is installed?

In case of b), is there any global variable other scripts use to identify XRM?

@ NighTragE There is a .bat file for deleting the KI scripts in the scripts.delete folder. Do you mean that?
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

After our discussion about TC- and XRM- compatible versions of Abandoned Ship Spawner, it occurred to me that we can probably get a mod-independent list of ship types with "get number of subtypes of maintype" and "get ship class from subtype". You could test for a specific ship type with "get ware from maintype x and subtype y".

I have it on my ToDo list to make a mod-independent version of A.S.S., but perhaps you can make the idea work for your script before I get around to it.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Post by 7ate9tin11s »

Nicoman35 wrote:Hey 7ate9tin11s, I used your routine to improve mines and to make it compatible to the vanilla version and to any mod. First I just wanted to make a XRM version, but on your and Doc's demand (and to keep fuss low), I try to get this as compatible as possible.
Ship tuning is no longer a problem. Only one thing left: How to check, if a certain ship class is available or not?
For example: I would like to create an advanced Khaak corvette. But this is only available in XRM, in vanilla only the normal corvette can be used.
a) Is there any command to check for the existance of a certain object class / ship class?
b) Or better check, if XRM is installed?

In case of b), is there any global variable other scripts use to identify XRM?

@ NighTragE There is a .bat file for deleting the KI scripts in the scripts.delete folder. Do you mean that?
Well, now you will understand why everything is so changeable in IK2, to make it work with any mod I have my little 'examine universe' initialization script (plugin.ik2.init)

The portion for ships starts at line 88 (on my personal version, may be slightly different in r2). The inventory of ships to use is done like this (trimmed to remove subtitle notifications):

Code: Select all

* ship classifications
$small = get ship type array: maker race={Kha'ak 7} class={M5 2025}
$temp = get ship type array: maker race={Kha'ak 7} class={M4 2024}
$small = [THIS]->call script '!lib.array.join' : a.arr1=$small  a.arr2=$temp
$temp = get ship type array: maker race={Kha'ak 7} class={M3 2023}
$small = [THIS]->call script '!lib.array.join' : a.arr1=$small  a.arr2=$temp

$medium = get ship type array: maker race={Kha'ak 7} class={M6 2026}
$temp = get ship type array: maker race={Kha'ak 7} class={M8}
$medium = [THIS]->call script '!lib.array.join' : a.arr1=$medium  a.arr2=$temp
$temp = get ship type array: maker race={Kha'ak 7} class={TM 2141}
$medium = [THIS]->call script '!lib.array.join' : a.arr1=$medium  a.arr2=$temp

$large = get ship type array: maker race={Kha'ak 7} class={M2 2022}
$temp = get ship type array: maker race={Kha'ak 7} class={M1 2021}
$large = [THIS]->call script '!lib.array.join' : a.arr1=$large  a.arr2=$temp
$temp = get ship type array: maker race={Kha'ak 7} class={M0 2020}
$large = [THIS]->call script '!lib.array.join' : a.arr1=$large  a.arr2=$temp
$temp = get ship type array: maker race={Kha'ak 7} class={M7 2027}
$large = [THIS]->call script '!lib.array.join' : a.arr1=$large  a.arr2=$temp
$temp = get ship type array: maker race={Kha'ak 7} class={TL 2032}
$large = [THIS]->call script '!lib.array.join' : a.arr1=$large  a.arr2=$temp
This basically builds a list of valid universe ship types to use. It can easily be changed to build arrays on classes instead of three general groups though :)

You may also want to check out the section starting at line 143 which actually goes through and creates each of the ships to figure out some more things about them and determine if they are truly valid for use. This is where you could determine the strength of one option against another to classify a ship as a 'normal corvette' vs an 'advanced corvette'...without ever knowing the type or anything beforehand.

It is tricky, but makes development really nice when done. It is also why I was complaining about making menus taking so long, once you have a proper initialization and menu setup, the rest of the scripts are really easy and simple :D

Hope this helps!
-7ate9tin11s
-XeNoN-
Posts: 373
Joined: Tue, 6. Mar 12, 12:04
x4

Post by -XeNoN- »

Nicoman@
Nah man not that the problem was/is:

Ive deleted all scripts with bat file but in game is "ReadTExt" error, and when i install v1.3 in the menu it shows still 1.2... :S... and when i activate in the menu KI the game freezes and i cant play it...
I started new game and now its ok, but please can you check out about uninstallation procedures.
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

@ 7ate9tin11s
Wow, thank you for your verbose explanation. I had a look at your scripts and they are realy class a. Ships will for shure spawn no matter what. The sector blacklisting is also very instructive. Really nice :).
If I may, I will use part of your scripts for IK.
v1.4 will use my beginner approach though. Because I fear it will take a long time for me to integrate those into IK. And this week RL will draw much of my time, then going to vacation. Will then be back round 5. January '13 and then begin with the integration.
I agree on the mess with menu creation. But I keep copying tecniques from advanced scripters :D and try to make them as user friendly as possible.

@ doc
have used this "get ware from maintype x and subtype y" thing you proposed. Not as flexible as 789's approach, but it should work with almost any mod (asuming the mod does not change vanilla Khaak ships). Thank you for giving me this hint. :)

@ NighTragE
Ah, ok, I have a look on that, thow I can not promise that I will be able to eliminate the problem. I think, the setup file has to be run again for changes to take effect.

For now, gentlemen, have a look at 1.4. Happy eating, my bugs. :fg:
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Post by 7ate9tin11s »

Nicoman35 wrote:If I may, I will use part of your scripts for IK.
All of my scripting/moding code is free for anyone to use in any way they feel fit. If I did not want others to use it, I would not distribute it. :P

Have a good vacation! :D
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

@ 7ate9tin11s
update accomplished, although I have only little time - just like you :P
User avatar
Krogort
Posts: 176
Joined: Sat, 3. Apr 04, 14:30
x4

Post by Krogort »

The link to download this mod seems broken.
Could someone re-host it please ?
User avatar
PromX
Posts: 123
Joined: Thu, 21. Feb 08, 23:39
x4

Post by PromX »

Yeah, that would be really great.
User avatar
SS_T
Posts: 593
Joined: Fri, 27. Mar 09, 21:38
x3ap

Post by SS_T »

Created a redirect to the new xdownloads3 the link should work now. :)
New XDownloads: http://xdownloads.co.uk
User avatar
PromX
Posts: 123
Joined: Thu, 21. Feb 08, 23:39
x4

Post by PromX »

Thank you :)
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

question, does it so that there is only a single major khaak invasion in the universe at a time? I'm seeing one in my game but it has been there a few game hours.... the RRF fleet seemed unable to repel them however all the stations are still intact too...

will they forever stuck like that until get destroyed or at some point they will relocate or even vanish?

can there be multiple invasions at a time?
Nicoman35
Posts: 681
Joined: Thu, 17. Nov 05, 13:12
x3tc

Post by Nicoman35 »

The invasions are timed randomly. You are able to set the frequency in the configuration menu. So it is possible to have multiple invasions running at the same time.
Only thing is: Until first invasion is not beaten, it is very likely the next one to occur in the same sector (insects WANT to have the sector).
Sations will stay untill destroyed. They are not moved. They are just spawned when a new, strong invasion occurs.
ATM, v1.6 still has some issue regarding that stations. As soon as I have some time, I will look into that and develop this further. Untill then, happy hunting.

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