Alternative M5 to M3+ capping mod (Alpha release, testers and feedback needed)

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
Alberto.Rota
Posts: 4
Joined: Fri, 22. Feb 13, 18:34
x3ap

Alternative M5 to M3+ capping mod (Alpha release, testers and feedback needed)

Post by Alberto.Rota » Fri, 22. Feb 13, 22:42

Hi there! After a time of development the code is now "functional", it's still an alpha version, but it's an start.
Let me remind you what is this about:
General description of the final mod. (Not the actual state)
  • This mod will add a new tipe of ship to the game, the M6A, also known as M6-Abductor (Weak M6 with capacity to dock 1 M5-M3 and a built in component called "Abductor equipment").
    Under the piracy menu, this ship will have de "Abduce fighter" command, which allow to force a damaged M5-M3 ship to dock into the M6A, and once docked, the ship will be assaulted by marines.
    If the assault succes, you gain control of the ship, if not, the "Abductor equipment" will prevent fightbacks by destroying the fighter (And doing some damage to the M6A)
And now that you know that, let me talk you about the actual estate of this project :
  1. It is still into an alpha version, this means that is a version intended only to other programmers, not to the general gamers.
  1. Even being an alpha version, the scripting work is fully functional, so, it represents quite well the final product, but it's still subject to changes.
  1. No new ships nor custom wares at the moment, just the script.
At this point, if anyone want to offet support, can send me a PM saying it, and i will send you the script by mail, so that you can test, customize and give feedback to improve.
Now, mi objectives with the code are:
  • Add internacionalization, at least English and Spanish.
  • Add the "Abduce target" order to the ship piracy menu
  • Add sounds, to complement the texts.
  • Revalance times and damages.
So, if anyone want to help, or just to give this a try, PM me.
Thanks!!! (And sorry for my bad english:cry:)
Last edited by Alberto.Rota on Fri, 8. Mar 13, 19:37, edited 1 time in total.

User avatar
DrBullwinkle
Posts: 5704
Joined: Sat, 17. Dec 11, 02:44
x3tc

Post by DrBullwinkle » Sat, 23. Feb 13, 03:20

There are examples of many of the pieces that you need in the Cheat Package.

Also look at Salvage Claim Software for examples of claiming ships and using the ware manager.

The MSCI Programmer's Handbook contains most of the basics of X3 programming.

User avatar
apricotslice
Posts: 13643
Joined: Sun, 16. May 04, 13:01
x3ap

Re: Alternative M5 to M3+ capping mod (Question)

Post by apricotslice » Sat, 23. Feb 13, 07:16

Alberto.Rota wrote:Hi there! I found this quite ilogical:
  • 1) You can board every ship M6 or superior that you found (With a bit of skill and many marines) from the security of your ship. :thumb_up:
  • 2) At the same time, your skill doesn't count at all when you try to cap a smaller (presumably easier to obtain) ship :thumb_down:, beeing mostly random :thumb_down:, and in advance, you shoud go YOURSHELF to the abbandoned ship to cap it (Cause your 5 star marines dont know how):thumb_down:
Boarding is a new thing. Up until TC, M6 and up were not captureable unless part of a plot. Boarding with then introduced to make M6 and up captureable, but with more effort required to do so.

So "small ships" bail out and become abandonned and claimed.
"large ships" are boarded and captured.

They are completely separate operations. "capping" means forcing a small ship to bail and then claiming it. (There are guides on how to do it better). "boarding" is using marines on a capital ship.

  • This mod will add a new tipe of ship to the game, the M6A, also known as M6-Abductor (Weak M6 with capacity to dock 1 M5-M3 and a built in component called "Abductor equipment").
    Under the piracy menu, this ship will have de "Abduce fighter" command, which allow to force a very damaged M5-M3 ship to dock into the M6A, and once docked, the ship will be assaulted by the marines.
    If the assault succes, you gain control of the ship, if not, the "Abductor equipment" will prevent fightbacks by destroying the fighter (And doing some damage to the M6A)
Nice. :) So in essence, you will appear to be a neutral ship offering docking and repair to damaged ships, and instead be a pirate sucking in the unwary. Nice thinking.
1st Step: Order a ship to dock into another ship.
  • Description (Short):
    Write a script to tell a M5-M3 ship to dock into a ship.
  • Description (Detailed):
    Write a script that (Pseudocode):

    Code: Select all

    if not prayership.target then 
        targetship = select target; //Ship selection menu.
    else 
        targetship = prayership.target; // Player target.
    end;
    
    if targetship <= M3 then // targetship is a valid target.
        targetship.stopComands();            
        targetship.dockAt(prayership); // We asume i'm piloting ann M7C.
    else                                                 
        sounds.play("Command rejected"); // targetship is a invalid target.
    end;
    
There is no reason why you cant get a list of all ships M3 and smaller, then check for damage, and randomly issue the "offer" to a random damaged ship, just by pressing a hotkey. I'd suggest the so selected ship also have the "option" of rejecting the offer.
Problems & doubts:
Is it possible to order an ENEMY ship to dock on a ship owned by the player?
And with an ownerless ship?
Where can i find an appropiate example to follow?
Is this already done by someone else?
[/list]
Yes, you can give ships orders, but I cant tell you how. However, as said, its probably in the cheat pack somewhere.

If the ship doesnt have a pilot, you just claim it. You cant give orders to a ship without a pilot, no point. So abandonned ships are not part of your target ships.
2nd Step: Add ware and ware restriction.
Cant help with that, but look at the EMP mod, which was designed to make adding wares easy.
3th Step: Add change ownership to the script.
  • Description:
    At this point, we can force an enemy to dock, but not implemented the ownership change yet, i will do it here.
    Future
Thats easy enough to do. You get the list of docked ships, which will only contain one ship, and then use the change of ownership command on it.
4th Step: Add the new ship.
  • Description:
    Till this point, i've been fliying into an M7C, time to add a true M6A to end.
    Future
For now, it will be more than enougth if i can take the first point, but every help will be welcome.
Thanks!!! (And sorry for my bad english:cry:)
Also relatively easy to do. Read my Modding 101 guide first, and then any of the other non-model guides on the same subject. If you want a unique model, thats more advanced, better to just clone an existing ship first and get it working. I'd suggest you choose an existing M6 that docks 1 M5 and then modify it the way you want.

The scripting you intend to do is reasonably straight forward. For array handling, look at the cheat pack and how it does it. You just need the order of commands.

Finding commands in the editor is the major issue for the first timer. Its a right cow to use, but after a while, you get a sense of what is where. However, Exscriptor is an external editor, and from memory, you can cut and paste in it, so can grab code out of the cheat pack and edit it in your own script.

So all you really need is X3Editor2, maybe Modmanager, and Excriptor for tools.

Adding the ship would need the latest tships, your own unique text file (See modding 101 and the modding documentation/download sticky thread) and if you change the turrets on your ship, then you need tcockpits as well. If you have to change the dock on the ship to get it to accept up to an M3, then I think you need dummies. (Dummies the file for the dock change, dummies to suck on while you learn the internal editor and deal with its frustration factor :) ).

In the inspired words of The Hitch Hikers Guide to the Galaxy......Go to it, good luck. (normally given when someone intends to get drunk btw, but it works for anything.)

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 21102
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Sat, 23. Feb 13, 10:57

Alberto.Rota wrote:2) At the same time, your skill doesn't count at all when you try to cap a smaller (presumably easier to obtain) ship
This is not completely true. While a lot of the bailing stuff is indeed hard coded, there is still some logic involved, which places the player in a position to obtain knowledge about the capping process. This knowledge includes things like the correct choice of weapons, making pauses when firing to give the bailing system a chance to kick in etc. So skill is important, when trying to cap ships.
As for overtaking ships there is already the System Override Software, which allows the take-over of abandoned ships from your own one. I'm not sure, if its range can be increased. However, making an own script with such a function is as easy as using the <RefObj> set owner race to <Var/Race> command in a script.
Alberto.Rota wrote:Under the piracy menu, this ship will have de "Abduce fighter" command, which allow to force a very damaged M5-M3 ship to dock into the M6A, and once docked, the ship will be assaulted by the marines.
If the assault succes, you gain control of the ship, if not, the "Abductor equipment" will prevent fightbacks by destroying the fighter (And doing some damage to the M6A)
Would you please elaborate the "assault process". When will the assault fail?
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

User avatar
apricotslice
Posts: 13643
Joined: Sun, 16. May 04, 13:01
x3ap

Post by apricotslice » Sat, 23. Feb 13, 11:41

As I see it, the assualt process would basically have to be scripted, maybe using some of the boarding phrases. The logic for it would randomly decide if it was successful or not, as well as to what extent the ship is damaged by the destruction of the target vessel.

If I was doing it, I'd just be using a series of random number generators and some binding logic code, that lets the script randomly work its way through the variable outcomes. I assume the actual boarding code does much the same thing.

Logic wise, its not difficult to write.

Re SOS, its actually very easy to change the range. My Apricot Claim Software started out as Cycrows SOS Mk 2, and one of the first things I changed was the range. Its just a number attached to a variable, change the number, changes the range. 5 second script change. Mine will claim anything that shows on the nav map. I also bolted on auto beaming onto your carrier, so claiming also beams it aboard, saving it becoming a target and taking all day to dock. Mine is also mapped to a hot key, so getting an abanndoned ship claimed and on board your carrier is just 2 clicks. Target and hotkey.

It never made sense to me that you had to spacewalk to claim a ship. Hence it was one of the first scripts I had a go at.

SOS mk2, if you start with that, is actually a fairly simple script to work with.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 21102
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Sat, 23. Feb 13, 11:55

apricotslice wrote:The logic for it would randomly decide if it was successful or not, as well as to what extent the ship is damaged by the destruction of the target vessel.
One concern of the OP was that the capping process is random and wouldn't depend on the actual player skills. Replacing this system with a different one that is still just random, doesn't sound like an improvement to me.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

User avatar
apricotslice
Posts: 13643
Joined: Sun, 16. May 04, 13:01
x3ap

Post by apricotslice » Sat, 23. Feb 13, 12:09

X2-Illuminatus wrote:
apricotslice wrote:The logic for it would randomly decide if it was successful or not, as well as to what extent the ship is damaged by the destruction of the target vessel.
One concern of the OP was that the capping process is random and wouldn't depend on the actual player skills. Replacing this system with a different one that is still just random, doesn't sound like an improvement to me.
I guess thats where you blend in the boarding style of things. Once the target vessel has docked, it then depends on how many marines you have and their skills.

I had another idea though, more complicated to do. You could build a MD front end, so that you had to actually talk to the target pilot, and so depending on what race the pilot is, and your relative ranks, the dialogue choices the player makes determines the likelihood of getting the target to agree to dock. If agreement is given, then the MD creates an object that a script checks for and when found, does the rest of it. The MD could be set up like a mission that appears on any ship in sector that fits the requirements for the script.

That way, skill comes in how to talk to each race (and the more logic and options you build into the MD, the harder it could be to get the sequence right), and then the actual takeover is dependent on the stats of the pilot vs the stats of the marines.

Ultimately though, most of the "action" wont involve the player directly. It cant, since the player cant actually slug it out with the pilot.

I like the whole concept. As a pirate way to get hold of unique ships, this is brilliant. And since the ship will be badly damaged for it to work, it will still cost the player a lot to get a useful ship out of it.

Btw, you can beam in any races ship, and change it while on board. I found that out with a minor bug in my beam system. Then remove the pilot and change the ownership while on board. So once you get agreement from the pilot to dock for repairs or safety, you can beam them on immediately, rather than wait for them to dock and risk them getting destroyed on the way.

Alternatively, if you want to be a really nasty pirate, you could just beam any ship on board and send in the marines. :lol:

Alberto.Rota
Posts: 4
Joined: Fri, 22. Feb 13, 18:34
x3ap

Post by Alberto.Rota » Sat, 23. Feb 13, 13:10

Guau! Really thanx to every one for the help!:mrgreen: Let me explain myself a bit further:
Nice. So in essence, you will appear to be a neutral ship offering docking and repair to damaged ships, and instead be a pirate sucking in the unwary. Nice thinking.
Not exactly the original idea (Explained later in this post), but quite a great adition, in fact, convined with Marine repairs you can make it a legal way of making money, REALLY reparing other race ships!!! I promise you that once i've achieved all my goals, i will try to add this feature. :P
Would you please elaborate the "assault process". When will the assault fail?
Of course yes, here it goes, when it will be finish:
Preconditions(Things that you need even before thinking in "abducing".)
  • ->An M6A with the built in component "Abductor equipment" and "Internal sentry lasers".
  • ->At least 1 marine on your M6A (You will need more to have a real chance).
  • ->A valid target.
    • 1) M5 to M3 sized ship.
    • 2) Heavily damaged (Arround 75% of the hull gone), to grant that they are not able to represent a real danger inside the M6A (Think that you are going to dock AN ENEMY INSIDE YOU! :twisted: ).
    • 3) Really slow (50 or 75 m/s max, not yet decided), cause other way, the "Abductor equipment" will be unable to supress all the inertia of the ship to force them to dock, being the fighter engines more powerfull that the tractor force of the "Abductor equipment".
Process (Abduction)(Things that happens sice you start abducing till you have the enemy inside)
  • ->Enemy ship goes to dock on you. Not by their own will, but "forced" by the "Abductor equipment" (Remember that he is a really slow ship, so this will take a wile)
  • ->All energy to the "Abductor equipment"!!! Or, in other words, you don't have laser/shield regen at all, you still have your reserve, but not regen, abducing a ship is an extremelly exausting proces, so take care that you have enought shield/laser energy before doing it!
  • ->Over my dead and cold body!!! Or, in other words, if the operation takes lot of time, the enemy ship will eneable the self-destruction mechanism of the ship, doing significant damage to the M6A if it lands (As hull damage increases, this is less likely or even imposible to happen).
Process (Taking the ship)(Things that happens sice the enemy dock till it's yours)
  • ->Abduction completed, returning energy. You regain your shield/laser regeneration, no need to power the "Abductor equipment" in advance.
  • ->Board it! Now!. Your marines begin the assault of the fighter as follows:
    • 1) Duration:The duration of the assault is determined by the total fight skill of all the marines on board and by the tipe of enemy ship (M5 much shorter than M3), and by the hull strength (More integrity = more time)
    • 2) Damage to the fighter: Every few seconds, the enemy ship will take damage (You can even destroy it and lose your prey!), the amount is calculated based on the Engeniering skill of your marines (All 5star -> Amost no dmg)
    • 2) Damage to the M6A: It's quite obious but... you have a functional and angry enemy inside!!! Expect damage!!! How much? well, its calculated based on enemy remaining weapons, but it decreases over time based on engeniering skill of your marines (They de-activate it)
    • 2) A bomb inside: Remember the "Over my dead and cold body!!!" point? Expect heavy damage and marine lost. (Piracy is bad and dangerous)
And thats all the process when it will be finished, i expect it to be readable and comprensible.
One concern of the OP was that the capping process is random and wouldn't depend on the actual player skills. Replacing this system with a different one that is still just random, doesn't sound like an improvement to me.
Absolutely agree, so, where i need skill? :gruebel: Go back to "All energy to the Abductor equipment!!!" point, and let me add that M6A will have almost no shielding and almost no laser capacitor, but a great laser and shield regen, so... skill!!! Furthermore, go back to "Over my dead and cold body!!!", if you dont offer an easy landing to a "Really slow" ship... BOOM!!!, so, as you cant move much, you are even more exposed.
I had another idea though, more complicated to do. You could build a MD front end, so that you had to actually talk to the target pilot, and so depending on what race the pilot is, and your relative ranks, the dialogue choices the player makes determines the likelihood of getting the target to agree to dock. If agreement is given, then the MD creates an object that a script checks for and when found, does the rest of it. The MD could be set up like a mission that appears on any ship in sector that fits the requirements for the script.
Perhaps a future adition, a very future one, let me go step by step. :P

Alberto.Rota
Posts: 4
Joined: Fri, 22. Feb 13, 18:34
x3ap

Post by Alberto.Rota » Mon, 25. Feb 13, 23:59

Hi again! I'm having a few problems implementing the reduction of the laser/shield regen, i'm actually using the following:

Code: Select all

* Disabling laser/shield regeneration.
  $abductor.currentLaserEnergy = $abductor->get current laser strength
  if $abductor.currentLaserEnergy >= $abductor.initialLaserEnergy
    $abductor->set laser energy to $abductor.initialLaserEnergy
  else
    $abductor.initialLaserEnergy = $abductor.currentLaserEnergy
  end
  $abductor.currentShieldEnergy = $abductor->get current shield strength
  if $abductor.currentShieldEnergy >= $abductor.initialShieldEnergy
    $abductor->set laser energy to $abductor.initialShieldEnergy
  else
    $abductor.initialShieldEnergy = $abductor.currentShieldEnergy
  end
But it doesn't work properly. :evil:
Can someone point me in the correct direction? the script is advancing at a good rithm, espect an alfa release soon :wink:

Alberto.Rota
Posts: 4
Joined: Fri, 22. Feb 13, 18:34
x3ap

Post by Alberto.Rota » Fri, 8. Mar 13, 19:57

A very short tutorial to the Alpha testers/helpers:
To try this into the game, you will need:
  • 1) Enable the hotkey from the control settings.
  • 2) An Hiperyon Vanguard (Only M6 that can dock a fighter) as playership, with at least 2 marines and Special command software.
  • 3) A targer with shields under 50% and under 3km away.
How it works:
  • 1) You try to get control of the target computer ship, your 2 top hackers will try it, and a System override sofware is a nice help in this stage.
  • 2) You force the enemy ship to dock on your ship, try to end this fast, cause your control over it is not forever.
  • 3) Once inside you (Or at your side in the hiperion :P ) the true party begin, your marines will assault the ship and, after a while, take it.

The takeover process is as follows:
SpoilerShow
1) Your 2 best fighters determine how much the process take, internal sentry lasers will help.
2) Your 2 top mecchanics will avoid damage to the target, freigth scanner will help them to avoid even more damage.
3) The target will cause damage to you, it is calculated depending of the weapons it has.
4) Your 2 top engenieers will deactivate the enemy weapong preventing the damage, a pair of terran emp rifles whill make it much faster
For the ones who want to dive into the code, the names are quite self-defining, but you are free to ask any doubt.

Post Reply

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