[SCRIPT] [2008.11.06] Marine Trainer v1.02

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

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

[SCRIPT] [2008.11.06] Marine Trainer v1.02

Post by JumperBR » Wed, 5. Nov 08, 23:25

=============================================
Marine Trainer v1.02
by JumperBR
=============================================

http://www.4shared.com/file/70594739/de ... rV102.html

To install, use Cycrow's Plugin Manager.

:arrow: Description:

Tired of receiving hundres of messages for you to babysit your marine for each step? This may be the solution for you as you now can send them on a nice trip where they will trained from 0 to 100 in every skill.



:arrow: Usage:

You need:
a) A ship capable of transporting marines
b) Marines
c) A ship upgrade, currently its the fight command software MKII

To use it go to the Additional Ship Commands of your ship and select the option "Train Marines onboard"

Theres a few issues so far:
- I found no way to get a marine skill, only to set (cant read, can write), so if you have a marine with skill 100 already in your ship his skill are lost (imagine this as a brainwash machine)
- Its expensive, I took as closer from the game as possible, unless my numbers are wrong this is how much you spend with credits and time:
Worst Case Scenario (gaining 5 points every train):
Cr: 1560000
Time: 358 min (about 6 hours)

Best Case Scenario (gaining 10 points every train):
Cr: 810000
Time: 50 min
Note: cost is multiplied per marine, time isn't.
I guess my time numbers are a bit off, but credits are very close to those in-game.


:arrow: Technical:

My scripts use the Text File 7789 and ship command 1240.




Version History:

1.00 - 2008.11.05 - Initial release.
1.01 - 2008.11.06 - Bug fix, cost is decreased by 3x, time is increased by 3x and a message is displayed when training is complete..
1.02 - 2008.11.10 - Script Repackaged...


Have Fun and let me know your findings of my script.[/quote]
Last edited by JumperBR on Mon, 10. Nov 08, 23:00, edited 3 times in total.

fud
Posts: 9837
Joined: Wed, 25. Jan 06, 14:26
x3

Post by fud » Wed, 5. Nov 08, 23:32

Nice!

This will sure beat the hell out of wanting to punch yourself in the face every 5 seconds when an IM chimes in...

User avatar
Sandalpocalypse
Posts: 4447
Joined: Tue, 2. Dec 03, 22:28
x4

Post by Sandalpocalypse » Thu, 6. Nov 08, 02:01

What about just training up to 3 stars or so?
Irrational factors are clearly at work.

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR » Thu, 6. Nov 08, 02:52

You can train as long as you want... you can stop at any time, you just cant resume from where you stopped...

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 » Thu, 6. Nov 08, 02:58

Ok, first, it works, now...for 5 men on my M6 and 10 on my TP sitting at a military base, it cost me around 17mil. then got in a fight, lost the 5 on my M6, so went back and got 5 more, from the TP, and refilled it with new recruits, and turned it on again...it wiped out ALL the men that was already done, and started agin with the new recruits, if that cant be fixed it'll get very expensive quickly, now I'm retraining the men I just paid for, lucky for me I took 5 off for the M6, but it should train just the guys who are new, not retrain the whole ship, also saw 2 guys, both argons that only trained to lev 2 and stopped and the training shut down, saying it was done.

Heretic666
Posts: 463
Joined: Fri, 20. Feb 04, 17:30
x3tc

Post by Heretic666 » Thu, 6. Nov 08, 07:33

Sounds like you need to be able to select which marines you want to train.

Are you able to do that? I don't know if they count as cargo, or if there is a new command to let you select only marines.

And if you could set it so that when you run the command you can only select marines that are not currently being trained, that would save mistakes.
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR » Thu, 6. Nov 08, 12:36

Well... as I said, you cant resume training even if your marines are full trained, if you select the option from the aditional commands your mariners will be trained from scratch (only fighting skill is untouched).

I recomend you to use separated ships to train them and use it as a reserve and remove every marine from it as you finish the training and place new ones for another training run.

There isnt much I can do to prevent reset of skills for marines already trained... I cant set local variables on marines to write its skill and I am not confortable in creating a global variable with all marines you ever trained and their skills, it would consume too much memory and affect game perfomance.

I also found a bug on my script which set the skill, one marine is being skipped when the skill is set... Im releasing a bug fix tonight.

About the part to select the marines, there is a option to select one marine on ship... I could make the script select marines when starting... but it would ask a fixed number of times (maybe cap the maximum marines per run on 5 and ask which marines every time)... I just dont like this option, I really prefer to simple leave a TP for training marines and other ships replenish from it, its way simpler.
Also, on my tests, no name showed for the marines... I couldnt select a marine by name that way, skills arent show as well.

My initial idea for the script was to train marines individually from the point they were... but the script engine is limited as I cant get the skill of the marine in any area, only set it.

I just discovered another bug... the time isnt multiplying by skills... it will take 3x what is taking now. Will have to check if cost is multiplying by 3 too... if not, its getting even more expensive to train them.

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 » Thu, 6. Nov 08, 12:42

Time and money are ok, if you want to leave that go..but yes, saw one marine in a list ignored, on my ship it was the highest rank there, maybe a lev 3-4 guy, but 1 mil plus each to full isnt too bad if the time is quick enough to be worth it..just a thought, if they get more expensivem we'll have to start considering, it'll be more than the normal cost, just faster.

Maahes
Posts: 872
Joined: Wed, 20. Nov 02, 15:14
x4

Post by Maahes » Thu, 6. Nov 08, 13:23

This sounds great, I'm looking forward to getting home and trying it out.

A couple of quick questions:
1) Does this leave the fighting skill alone?
2) Does the Training ship have to be flying, or can it be docked? Personally I think having it flying would be the best, maybe have the ship jump around a few sectors, maybe just the core ones, so the trainees can get advice from the best people in each area of training.
3) Does it notify you once training is complete?

Cheers
M

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR » Thu, 6. Nov 08, 13:39

KRM398, I believe time have to go up... its going too fast now, only 2 hours in the worst case scenario, the correct is 3x that...

That marine being ignored will be hotfixed today...

Maahes,
1) Yes, my intention was to simplify the training from the outposts so you dont get a message every minute. Fighting doesnt change.
2) Its a aditional command from the ship, it doesnt affect flying nor it has to be flying... I believe you can fly the ship with no down side. However,I really recommend that you specify a ship as a Marine Trainer so your other ships can replenish from it, and remember: every time you activate the command their skills (except fighting) are reseted.
I recommend:
a) Buy a TP
b) fill with 10 marines (or whoever the ship capacity is)
c) Train to whatever skill you want (you can stop at anytime up to max)
d) Transfer ALL marines from that ship to another ship, like the ship you will use to board
e) go to step B

3) Working on that. A message notifying completion and how much it costed is good.

cya
Mai ingrish iz gud?

User avatar
Graxster
Posts: 817
Joined: Sat, 14. Oct 06, 01:01
x3tc

Post by Graxster » Thu, 6. Nov 08, 17:58

KRM398 wrote:..it wiped out ALL the men that was already done
You have to remove the marines that are already trained/have skills. As mentioned in the original post, there is currently no way (Egosoft's problem) of getting the current skills of a marine.

Ideally, you'd want to "get current skills", then raise them to whatever you're training to. This is not possible due to limitations in the script engine. The only command is "set skill (skill) to level (xx)". So if you can't "see" that he already has 2 in mechanical, it's impossible to "I know he has 2, so increase that to 3". The only option left is assuming all trainees start with zero.

-G

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 » Thu, 6. Nov 08, 19:02

Yes, anytime your training marines, the ships name and the amount they have been trained is shown on the property list, as well as any other time you see that ship, aka, in station with you or whatever, and the info as it changes, is shown on top of the 'health bar' at the bottom of your hud, (when training in your ship)so you know at a glance what % they are trained and what it costs you. If you stop at say 80% it doesnt go away, it says 80% and the cost so far as long as you have marines on board, even if they get used and your empty, it still says that untill you start new men.

This is agreat help, even if you go to 3x the time, we'll have to remember to have some training while we use others, of course we can use them faster than that, but we'll adjust, ty good script, and saves me from leaving the game for as many rests, the 'beep' and messages were driving me batty,lol.

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR » Thu, 6. Nov 08, 22:55

Well... version updated with 1.01, I hotfixed the issue where one of the marines wasnt being trained, I also increased the time 3x and decreased the cost 3x (as I found to be too expensive).
A fully trained marine will cost "only" 500k and take 6 hours to train in the worst case scenario...
Mai ingrish iz gud?

Heretic666
Posts: 463
Joined: Fri, 20. Feb 04, 17:30
x3tc

Post by Heretic666 » Fri, 7. Nov 08, 16:17

Don't know about reducing the cost...

Would probably have been best leaving it as it was..

Nvm though, downloading now ;)
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Post by KRM398 » Fri, 7. Nov 08, 18:22

Ok, 101 downloaded and ran, went in, new ship,TP, at merchants Haven, at military dock there. Ten new guys all the needed software, etc..training and went out working while it ran..checked a while later, at 91%..the cost was something like 8.7mil for ten guys, definately less..my calculator says thats 9.5 mil for ten guys..ok..but one guy still isnt training, sorry..just thought you'd like to know. Didnt try just 5 guys on my M6, have special ships now just to train on, but out of ten, one does nothing, except maybe get paid for it..lol.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Sun, 9. Nov 08, 04:30

I had the problem with the 1 untrained guy as well. I believe I found the problem:

Code: Select all

003   while $size > 0
004    $marine = $marines[$size]
005    $marine -> set marine skill: hacking=$skill
006    $marine -> set marine skill: mechanical=$skill
007    $marine -> set marine skill: engineering=$skill
008    dec $size = 
009   end

I think it should be

003   while $size > 0
004   dec $size =  
005   $marine = $marines[$size]
006   $marine -> set marine skill: hacking=$skill
007   $marine -> set marine skill: mechanical=$skill
008   $marine -> set marine skill: engineering=$skill
009   end

you are skipping marines[0] and trying to train a marine that doesn't exist.

Also this command should not be available on ships without a cargo life support system.

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR » Sun, 9. Nov 08, 21:13

Ok, sry, I guess I did something wrong when I repackaged... :(
By tomorrow I repost the file.
Mai ingrish iz gud?

Saint-Ashley
Posts: 1267
Joined: Sat, 3. Dec 05, 03:40
x4

Post by Saint-Ashley » Tue, 11. Nov 08, 03:10

Code: Select all

003   while $size > 0
004    $marine = $marines[$size]
005    $marine -> set marine skill: hacking=$skill
006    $marine -> set marine skill: mechanical=$skill
007    $marine -> set marine skill: engineering=$skill
008    dec $size = 
009   end
This is what it should be :

Code: Select all

003   while $size >= 0
004    $marine = $marines[$size]
005    $marine -> set marine skill: hacking=$skill
006    $marine -> set marine skill: mechanical=$skill
007    $marine -> set marine skill: engineering=$skill
008    dec $size = 
009   end
Notice the >= which allows marine 0 to be set with skills. The first element in an array is 0, then the last element of the array is array size -1.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 11. Nov 08, 03:24

That was my first solution as well, but $size is size of the array. So on the first run of the loop you try use an element that isnt there. But, moving the dec statement to the beginning of the loop fixes both problems.

User avatar
Big Bad Orca
Posts: 320
Joined: Sat, 3. Feb 07, 23:21
x4

Post by Big Bad Orca » Fri, 14. Nov 08, 00:15

I can't find the command in the additional ship commands menu... I've managed to run the script from the script editor though.
My favourite memory of the X series was babysitting that TL across half the universe in XTension and finally arriving in Getsu Fune to be gifted the TL! I called her Big Bad Orca...

Post Reply

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