[X3:LU] Trying to make a maintenance cost script for LU. Need help.

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
User avatar
Zaitsev
Posts: 2005
Joined: Tue, 2. Dec 08, 01:00
x4

[X3:LU] Trying to make a maintenance cost script for LU. Need help.

Post by Zaitsev » Wed, 21. Jul 21, 05:25

So I'm trying to make a maintenance cost script for LU, where the script will run in a continuousl loop and pull money from the player account based on the number of ships I own and ship class, with the bigger ships being more expensive to keep around.

So far I got this snippet for getting the number of ships of each type:

Code: Select all

$shipm5.arr = get ship array: of race Player class/type = M5

$numbersm5 = size of array $shipm5.arr

$costm5 = $numberm5 * 5000

$maintenance = $maintenance + $costm5

*repeat for all ship classes

This would then be repeated for all ship classes, ending with a total maintenance cost I can work with. I am however wondering if there's a simpler way of checking how many ships I have and what class they are, or if I can do some clever math to calculate some sort of "upkeep factor" I can work with.

Then I got this to "pay" for the upkeep of my ships:

Code: Select all

$money get player money

 if $money > $maintenance
  $costmain = - $maintenance
  add money to player: $costmain
 
 if $money = $maintenance
  $costmain = - $maintenance
  add money to player: $costmain
  send incoming message 'Account at zero' to player: display it = [TRUE]

 if $money < maintenance
  $minus = - $money
  add money to player: $minus
  send incoming message 'Lack of funds for maintenance' to player: display it = [TRUE]
This is the part I'm most uncertain about, since I have absolutely no clue about what I'm doing and I'm about as smart as a bag of hammers when it comes to programming in general. Some thorough and detailed explaination would be much appreciated.

Then there's the "repeat once a day" part. Here I'm totally and utterly lost, and have no clue whatsoever. I also need to cobble this together and make the parts cooperate, and that's another part I have no clue about. Here I suspect I basically need someone to do it for me, or at least explain like I'm 5 years old.
I'm sorry, I can't hear you over the sound of how awesome I am :D

DiDs:
Eye of the storm Completed
Eye of the storm - book 2 Inactive
Black Sun - Completed
Endgame - Completed

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

Re: [X3:LU] Trying to make a maintenance cost script for LU. Need help.

Post by Hector0x » Wed, 21. Jul 21, 08:42

you should check how Mayhem 3 does it with these 2 scripts:

Mayhem.GetShipMaintenanceCost
Mayhem.Monitor.Maintenance

They contain alot of Mayhem 3 related variables and features, but you should be able to use it as a skeleton version for LU.
I myself am a complete script noob and could still make some adjustments. The documentation in Joubarbe's scripts is rather well done these days.

Post Reply

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