Bug in !lib.get.randomshiptype

Home Board Index » X3AP » Scripts and Modding » Bug in !lib.get.randomshiptype

Hammerit

Hammerit avatar
Level badge Stickguey (8)
Posted 10 years ago.

:nuts

I really hate it when that happens. I just found out why my reworked war code occassionally crashed while creating a ship. It has nothing to do with my code of course, but with what I repurposed from the original war code from Egosoft Whatever

Just in case you ever encounter the "!lib.get.randomshiptype" script be aware it misses an important fallback. In case there is no ship Type matching the chosen race + class combination it quite literally kills itself.

The example I encountered was:



$shipType = [THIS]-> call script '!lib.get.randomshiptype' : a.race=[ATF] a.class=[M8] a.blocked=null a.onlyFirst=[TRUE]



Apparently The ATF doesn't have no love for bombers. Why the original war code worked? ... I'm glad you asked sunny jim. Because for some totally random reason they don't create M8s in the war scripts. I guess I just found out why LOL

The fix is easy though. All you need to do is add "return null" at the end of the '!lib.get.randomshiptype' script and you're safe Eek.

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

I guess your edits are part of something greater? like a re-write of the war-scripts? ie. a mod or something? if so, maybe a link to it would be nice Smile

So I could have a pokey :P

Hammerit

Hammerit avatar
Level badge Stickguey (8)
Posted 10 years ago.

I guess your edits are part of something greater? like a re-write of the war-scripts? ie. a mod or something? if so, maybe a link to it would be nice

So I could have a pokey
- Roguey


Sure thing Wink. I'm rewriting the entire war code so it isn't as random anymore but still uses the basic concept of AP (eg. war sectors, war missions, etc.). The AP war manager is disabled as if Shady business were completed and the war ended that way.

I mainly mod for myself or on requests because my game is so heavily modded that extracting and testing individual changes is rather time consuming. All changes are modular though and there's little to no dependencies to other code and none to other mods so it's not actually that hard. I think the last mod for an X game I ever actually released for X2 ...

If you want I can send you the mod, no problem ^^. I've created a new thread for the mod here: http://roguey.co.uk/forum/viewtopic.php?id=1004

1


You need to log-in to post here.