[X3LU] Mayhem 3.21b

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
You Lose Profit
Posts: 6
Joined: Sat, 6. Jan 18, 02:07
x3tc

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by You Lose Profit » Sat, 27. Jun 20, 21:49

So don't be in the TL when I eject the station, like be in another ship when ejecting?

User avatar
Hector0x
Posts: 998
Joined: Mon, 18. Nov 13, 18:03
x3tc

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by Hector0x » Sun, 28. Jun 20, 07:44

You Lose Profit wrote:
Sat, 27. Jun 20, 21:49
So don't be in the TL when I eject the station, like be in another ship when ejecting?
Yes. With eject i think he meant that you can leave your TL with a spacesuit. Build the station, and then enter your TL again.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by Joubarbe » Sun, 28. Jun 20, 11:27

Edna wrote:
Thu, 25. Jun 20, 19:27
Joubarbe, let me once again thank you for not only creating this lovely mod over and over again, but also spend hours on checking out other players' games and fix the bugs they find. You're doing one hell of a job, and I hope you have fun doing all this.
changelog 3.0 RC wrote:AI was ordering too many ships when a squadron was only composed of the leader (ie. no followers).
Dozens of hours of playing to realize that, 3 hours of debugging.
I'm living the fun.

xwarpewpew
Posts: 10
Joined: Thu, 4. Jun 20, 22:53

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by xwarpewpew » Sun, 28. Jun 20, 16:53

how is the ai trade deal with goods it didnt sell?

i just check my traders cargo and part of them seem to be holding mix cargo
like going to buy eng and still having allmost full cargo of ore

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by Joubarbe » Sun, 28. Jun 20, 17:17

There's supposed to drop their cargo at home before starting other trades. Upload your save if you want me to look into it.

User avatar
Hector0x
Posts: 998
Joined: Mon, 18. Nov 13, 18:03
x3tc

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by Hector0x » Sun, 28. Jun 20, 17:44

xwarpewpew wrote:
Sun, 28. Jun 20, 16:53
how is the ai trade deal with goods it didnt sell?

i just check my traders cargo and part of them seem to be holding mix cargo
like going to buy eng and still having allmost full cargo of ore
Your trader found a station to to sell the Ore, but after he bought it, the sell location isn't valid anymore because another ship already locked the deal in the meantime. For me this always fixed itself so far. They periodically try to sell goods from their cargohold. Once they find another factory which needs ore they get rid of it. It can take a while.

You can forbid your traders to cramp all their cargo full with one commodity by setting an external cash limit for your traders. But for ore this may not work because even small amounts are really bulky.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by Joubarbe » Mon, 29. Jun 20, 03:46

I've just tested it again: when I put some wares into the cargo of a Trader, and that they cannot be sold, he "tries to export them", then return home, then unload them, before looking for other trade opportunities.
If you have a valid example of a possibly stuck Trader, please upload a save.

4square425
Posts: 85
Joined: Fri, 14. Jun 13, 02:52
x3tc

Re: [X3LU] Mayhem 3 BETA 9 (Hotfix 3)

Post by 4square425 » Tue, 30. Jun 20, 02:35

I seem to recall that in vanilla Litcube you could hide ships when they get built. Could that be added to the Outpost "Build Options"? It would be helpful when producing a lot of fighters that will end up moving to a carrier automatically anyway. The Ship Display Manager works fine, but this would eliminate that step.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Joubarbe » Thu, 2. Jul 20, 09:54

Mayhem 3.0 RC released

For those who don't know, "RC" means "Release Candidate", it's generally the last version before "the real one". It doesn't mean that 3.0 will be perfectly balanced or bug-free, but I don't consider Mayhem in beta anymore.

4square425
Posts: 85
Joined: Fri, 14. Jun 13, 02:52
x3tc

Re: [X3LU] Mayhem 3.0 RC

Post by 4square425 » Thu, 2. Jul 20, 19:23

Huzzah! I posted this to Reddit, but want to congratulate you on such a smooth beta process (at least on our end, who knows what you went through).

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Joubarbe » Thu, 2. Jul 20, 19:46

Thanks man, it has been... an adventure :) Not finished, though!

Huillam
Posts: 430
Joined: Fri, 16. Dec 11, 11:24
x4

Re: [X3LU] Mayhem 3.0 RC

Post by Huillam » Fri, 3. Jul 20, 16:18

Mayhem 3 out of beta? Long live Mayhem! Or not, we're now awaiting Mayhem 4! Back to work Joubarbe. :p

User avatar
Edna
Posts: 195
Joined: Mon, 14. Oct 13, 21:18
x4

Re: [X3LU] Mayhem 3.0 RC

Post by Edna » Fri, 3. Jul 20, 21:37

I wouldn't even know how a Mayhem 4 could even change the game even more than LU, Mayhem 2 and 3 already do. If anything, I'd love to see a final polish of Mayhem 2, since it's still a very fun gameplay with just a few mechanical issues left to deal with. And Mayhem 3 has so much that we yet have to try out, as the different galaxy settings of each game alter the experience INSANELY much. I yet have to give a fully filled galaxy a shot, and have yet to reach boarding/Yaki/OCV stage since there's always something happening that changes the progression from one lane to another.
Image

User avatar
Edna
Posts: 195
Joined: Mon, 14. Oct 13, 21:18
x4

Re: [X3LU] Mayhem 3.0 RC

Post by Edna » Sat, 4. Jul 20, 10:00

By the way, have you considered using your XM-R mission boards for Mayhem 3? I liked the plug-in really much, although I never went very deep into it. What I liked was that every available mission was listed in the sector, so you didn't have to dock at each station just to see it's not the mission you've been looking for. I also loved the Heavy Escort missions, although I can see why they wouldn't be a thing in Mayhem, where ships are not supposed to be created from thin air.
Image

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Joubarbe » Sat, 4. Jul 20, 10:52

X-Missions Reloaded is a very old script, full of bugs and very badly implemented. Mayhem 3 missions are fine as it is now, just use your other ships to dock where there are missions and use the Mission Briefing new command. It's by design that you have to dock.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Joubarbe » Sun, 5. Jul 20, 09:57

Modding Guidelines

Introduction

To edit any script from X3, I highly recommend X-Studio, from mr.bear. Without this tool, I would never have gone into X3 modding. Also, because Mayhem runs on Litcube's Universe sets of new hardcoded commands, you'll also need this extra file, required for X-Studio to be able to read the new commands (put the file into the X-Studio root folder).

At some point, you may want to take a look at what scripts are running on what ships. It's easily doable by going into the script editor from your ship console (Shift-C, then S), then activate the following debugging option:

Image

That will add a new information panel into any ship info menu:

Image

As this little article is not a tutorial, I recommend reading the MSCI Handbook, MSCI being the name of the scripting language used by X2 and X3. Chapters 4 and 7 are especially useful.

Mayhem 3 has about 800 scripts rewritten or modified. Vanilla scripts always start with an exclamation mark, but some of them have been totally rewritten, like !move.jump, !fight.attack.object, !fight.defend.sector or !fight.attack.enemiesrange.land. Some others have been added, also prefixed with a "!", because I consider them to be part of the fundamental commands, like !ship.cmd.flee, or !ship.cmd.fleet.retreat. Note that the "!" prefix is just a convention: it changes nothing about how these scripts work or interact between each other.

Before going deeper into how Mayhem 3 works, you have to understand that there are two kind of scripts: locals and globals. Local scripts run on a specific object (ship or station), and also on a specific task, Task 0 being the main task of every ship. Global scripts on the other hand run independently on Task -1. A list of these scripts can be found in the script editor, in the Global Script Tasks menu:

Image

By convention, all Mayhem global tasks that run permanently (ie. in a loop) are prefixed with the "Monitor" keyword. As you can see above, these are very important scripts, like the two Autopopulate scripts that manage the AI strategies concerning ships and stations.

When reading other people code, it may be very useful to understand how scripts interact with each other. You can use a tool like Notepad++ and research the name of the script (without quotes and without the .xml extension) inside the scripts folder, or use the following X-Studio feature:

Image

Script Prefixes
  • Vanilla and core scripts start with an exclamation mark, as explained above.
  • Mayhem main scripts start with "Mayhem.". Example: Mayhem.BuildShip.
  • Library scripts start with "Joubarbe.Lib", like Joubarbe.Lib.GetCommonwealth.
  • Menus start with "Menu.", "Menu.PC" being for menus from the Player Console, and "Menu.DWM" for the Outpost Manager (formerly "Dock Ware Manager").
Many scripts are useless, such as all the ones that are prefixed with "!job", "al.", "!lib" and "!plugin". These are remnants from either vanilla, LU or other third party scripts, like MK3 Improved. They don't impact performance.

Mayhem Scripts Overview

Here is a list of some of the most important scripts used by Mayhem ("X" indicates that there are multiple scripts with the same prefix):
  • setup.Mayhem runs every time the game loads a new game or an existing savegame. Many features start from here.
  • Mayhem.AddBlueprint is used to add a ship type to the list of ships that the player can build.
  • Mayhem.AddFullTemplateToBacklog and Mayhem.AddToBacklog are used to order ships, stations and weapons, for both AI and player.
  • Mayhem.BuildShip, Mayhem.BuildStation, Mayhem.BuildStationAI.
  • Mayhem.Claim, Mayhem.Conquer and Mayhem.IsClaimable manage most of the logic behind sector takeover.
  • Mayhem.Cmd.X and Mayhem.Task.X manage all squadrons (AI fleets) and Workers.
  • Mayhem.EquipShip is used to instantly equip any ship with either a template's list of components, or with random components if a template of the ship type doesn't exist. This script is rarely used, because Mayhem 3 doesn't cheat (except for Pirates, Xenons and OCV). Instead, Cmd.ShipTemplateOutfit.Dock is used to make both AI and player pay for their templates.
  • Mayhem.GameCreator.X manage all the galaxy generation process.
  • Mayhem.Init.Templates is the starting point of all templates management. It is called only once at game start, and manages a lot of AI related stuff, like what priority is given to specific stations, what lasers to put in ships, how to compose a squadron, etc.
  • Mayhem.InitializeX setup stations. They are called every time a station is built.
  • Mayhem.Marine.X and Mayhem.MarineMission.X are respectively managing marines themselves, and boarding missions.
  • Mayhem.Mission.X manage the new procedural missions that you may receive when you dock at a station.
  • Mayhem.MissionEntry.X manage journal's entries.
  • Mayhem.Monitor.X are the main global scripts of Mayhem. They each run inside an endless loop.
  • Mayhem.Squadron.X and Mayhem.Worker.X handle squadrons and workers management (global scripts).
  • Mayhem.Task.TemplateWhenReady is an important script that setup every ship built from an Outpost, AI or Player.
  • Menu.SaturnComplexHub.Install and Menu.SaturnComplexHub.Install.SM handle the Research station menu. It's actually using the former SCH menu from LU.
Adding New Ships

Adding a new ship via TShips (inside addon\10.cat) is not enough to make the ship fully and properly integrated within Mayhem 3. There is no magic in the AI, it has to know precisely what it is allowed to build. This is handled through Mayhem.Template.Ships. In that file, you'll find some of these lines:

Code: Select all

$class = [M3]
$lists = array alloc: size=0
dim $list = {Argon Nova}, {Argon Notus}, {Argon Venti}, {Argon Eclipse}
append $list to array $lists
This means that when the Argons need an M3 (see Mayhem.Template.Squadrons if you want to change the composition of their fleets), they will pick a random ship type from this list. So if you want to add a ship that is called "Betty's Fury", first add your ship to the TShips file (I won't detail how to do that here), then modify the script:

Code: Select all

dim $list = {Argon Nova}, {Argon Notus}, {Argon Venti}, {Argon Eclipse}, {Argon Betty's Fury}
Remember that templates are only set at game start. You'll need to call Mayhem.Init.Templates again in your game if you want the AI to be updated, or start a new game (calling Mayhem.Template.Ships does nothing).
Research stations should be properly updated as they scan all available ship types every time you open the menu.

The above method is required if you add custom ships to the Commonwealth (+ Yakis). However, if you want to add ships for Xenons, you'll have to edit Mayhem.Monitor.Galaxy, because Xenons are spawned every X minutes from a random Xenon station, and they are spawned from thin air, and artificially equipped. If you need to add ships for Pirates, you don't have to edit anything, Mayhem.Task.Station.PirateBase is used on each pirate base to spawn a ship. It uses the script Mayhem.GetRandomShipType to get a random ship subtype from all existing ones, including the ones you add yourself. However, you need to define pirate ships as Yakis, because there are no Pirate ships in Mayhem 3.

Now the hardest part: ship balance. The following elements have been manually edited:
  • Compatible lasers and missiles, also within TCockpits. All ships follow the same logic depending on their class and race.
  • Wares list (1 for every ship).
The general characteristics and the performance of the ships have all been automatically edited with an external tool I've developed, that you can find at this page. The script I'm using in Mayhem 3.0 can be downloaded here (you'll also need my custom variables - put everything in the root folder) (FYI, here is the original TShips I'm applying the script to). However, running this script on your newly added ships will not work, because Mayhem 3's ship balance is based on the physical size of each ship. What you need to do is to go in the in-game script editor, open the script editor menu where all scripts are listed, then highlight Mayhem.ExportShipSizes, hit R and execute the script on null (global script).

Image

Image

It will take some time to process. When it's finished, the data will have been exported to "addon\t\9978-L044.xml". You need this file to use my JSON tool (it will throw a fatal error if the file is missing). It's also better to include it if you want to share your new ships. However, it's not mandatory, the only downside is that the ship compendium won't display the size of your new ship.

When the JSON tool is finished, it will generate a new TShips inside an "output" folder. Copy that inside a new catalog file (overwriting the default file in 10.cat is a bad idea) via X3 Editor 2, and you should see consistent statistics in the ship compendium menu.

Note that the script I'm using for the JSON tool has some randomized values in it. That means that every time you run the script, ships will have slightly different stats.

Script Tasks

Here is a list of all tasks ID that Mayhem 3 is using. You should never use these IDs in your own scripts, even though some of these come from Mayhem 2 and are obsolete.
  • 201/202: Mayhem.Task.Station.Outpost, Mayhem.Task.Station.ResearchStation and Mayhem.Task.TradingStation
  • 1221: Mayhem.Task.Expedition
  • 1312: Mayhem.Task.ExploreScan
  • 1313: Mayhem.Task.TemplateWhenReady
  • 1314: Mayhem.Fleet.ProtectCarrier
  • 1315: Mayhem.Fleet.Whip
  • 1316: !move.undock
  • 1317: !ship.cmd.attack.std (see Mayhem.Fleet.Attack)
  • 2044: Mayhem.Task.Claimeable
  • 1318: Mayhem.StallEngine
  • 1319: Mayhem.Task.Defend.Watch
  • 1320: Mayhem.Task.DefendObject.Follow
  • 1321: Mayhem.Task.Jump
  • 1322: Mayhem.Task.Station.Credits
  • 1323: Mayhem.Task.Station.Destruction
  • 1324: Mayhem.Task.Station.Autoassign
  • 1325: Mayhem.Task.Station.MaxJumpsCheck
  • 1326: Mayhem.Task.Station.Autopricing
  • 1327: !fight.defend.monitor
  • 1328: Mayhem.Task.CarrierRepair
  • 1329: Mayhem.Task.OCVVirus
  • 1330: Mayhem.Task.MarineMission
  • 1331: Mayhem.Task.Station.Repair
  • 203: Mayhem.Task.Station.PirateBase
  • 1332: !fight.attack.object.stationTactics
Last edited by Joubarbe on Mon, 13. Jul 20, 07:42, edited 1 time in total.

User avatar
Hairless-Ape
Posts: 320
Joined: Wed, 6. Nov 02, 20:31
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Hairless-Ape » Mon, 6. Jul 20, 23:23

When is this monster going to be ready for prime time?

Are there any u-tube vids, or other tutorials on 3.0 to outline some of the basics?


cheers.
Out of my mind. Back in 5 minutes.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Joubarbe » Tue, 7. Jul 20, 10:26

Tutorial videos, by Hector0x

The current version is very playable. It's a Release Candidate, so don't expect new features for the 3.0.

GriwMF
Posts: 4
Joined: Sun, 17. Nov 13, 12:03

Re: [X3LU] Mayhem 3.0 RC

Post by GriwMF » Thu, 9. Jul 20, 15:17

Hey, Panda. Not sure, but it looks like a bug - Agent does not want to do task #10 - export Teladianium to hull planting facility
Image

I've tried removing all other task, change different settings - still no clue, it just checks it and skips. Save is https://drive.google.com/file/d/1j2gRxl ... sp=sharing

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [X3LU] Mayhem 3.0 RC

Post by Joubarbe » Thu, 9. Jul 20, 16:19

Indeed it was a bug, something about your Agent already wanting to go to your Hull Plating factory before requesting a trading lock. Fixed for next patch.

Post Reply

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