[MOD] Manual Command Extension v0.10.2 {Discontinued}

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
Black_Sails
Posts: 95
Joined: Wed, 1. Aug 07, 06:35
x3tc

Post by Black_Sails »

I've been digging through the aiscripts, and I just don't get it-why can't our player owned ships utilize these types of functions:

move.refuel -looks like scripting for the ship to look for fuel trade offers, dock + purchase fuel. Although I'm guessing this is what happens when the captain complains there isn't enough fuel and you click on the window and tell him to find fuel?

move.patrol
move.seekenemies
move.escort

multiple fight scripts. and fight.defend.capital.

I'm trying to learn how these scripts link into the game, if they do in fact exist. Like since the defense officers "orders" are set to defending, is it supposed to be calling the fight.defend.capital script? I can't find the file that specifies this.

Another idea I have is that when you recruit officers, they keep their current faction relations, so won't engage? I thought about toying with the hireable NPC faction settings to perhaps player and experimenting with what happens but I'm assuming massive game breakage lol. Still having difficulties locating the actually hireable NPCs though-I found a file in libraries, characters.xml but I'm not sure this is exactly what I'm looking for.
Baleur
Posts: 587
Joined: Fri, 28. Oct 05, 13:37
x4

Post by Baleur »

You are a legend.
Modders, adding functionality to the game faster than Egosoft can patch.
Seriously, why didn't the modders get 30% of the money i spent on the game?
CPU: Intel i7 6300k RAM: 32gb GPU: nVidia 1070 6gb VRAM
rifter08
Posts: 43
Joined: Sat, 8. Sep 12, 03:33
x4

Post by rifter08 »

Thank you soooo much, you are my hero.
And, i think this is what egosoft intended all along, why pay devs good to finish a game when you can get paid for modders to fix obvious omissions.
Tyrant597
Posts: 299
Joined: Wed, 9. Apr 08, 05:52
x4

Post by Tyrant597 »

On a scale of 1 to [X-Rebirth: Release] =) How bad would this be for aborting running scripts on a ship?

Code: Select all

<get_control_entities object="$target" groupname="$ControlEntities"/>
<do_all exact="$ControlEntities.count" counter="$Counter">
     <abort_scripts entity="$ControlEntities.{$Counter}"/>
You don't talks about X:Rebirth...
X4 Mods: Collect Inventory Wares Stations Supply Build Storage Mass Move Marines
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

aegisx wrote:Nice work!

Would a Clear all Orders command be possible? Or how about a Show Orders?
Im not sure what your asking, "Clear All Orders" is pretty much forfiled by "Hold Position", no?
Bean03 wrote:Bug Report:

The new order command does not show on construction vehicles. This may be due to the Call Architect option that is available under my ship.

This may have nothing to do with your mod but I thought i'd point it out since this prevents these ships from utilizing your mod.

You may want to add in a check that the New Order menu option is available and if it is not create it in an open slot. Menu item 4 is empty for me in this situation.
I am aware that the construction ship doesn't seem to have the menu options, however thanks for the report - i did not know that the architect menu option is in the same place however, i will look into that!
Petroph wrote:I think I may have found a potential bug. If you add a ship to your squad. And ask it to take you somewhere, and he completes the order, the ship gets locked up and the game freezes. Not sure if this has anything to do with telling the ship to hold position prior to issuing the order to take me somewhere.
I have experienced this in the standard game, "Take me to..." doesn't seem to work very well at the moment.
Black_Sails wrote:I've been digging through the aiscripts, and I just don't get it-why can't our player owned ships utilize these types of functions:

move.refuel -looks like scripting for the ship to look for fuel trade offers, dock + purchase fuel. Although I'm guessing this is what happens when the captain complains there isn't enough fuel and you click on the window and tell him to find fuel?

move.patrol
move.seekenemies
move.escort

multiple fight scripts. and fight.defend.capital.

I'm trying to learn how these scripts link into the game, if they do in fact exist. Like since the defense officers "orders" are set to defending, is it supposed to be calling the fight.defend.capital script? I can't find the file that specifies this.

Another idea I have is that when you recruit officers, they keep their current faction relations, so won't engage? I thought about toying with the hireable NPC faction settings to perhaps player and experimenting with what happens but I'm assuming massive game breakage lol. Still having difficulties locating the actually hireable NPCs though-I found a file in libraries, characters.xml but I'm not sure this is exactly what I'm looking for.
This is what this mod is designed to do, bridge the gap between the code back end and your user interface - alot of the code needed for these commands already exists in the game (some are going to need modification or special writing) but for the majority all im doing is safely overriding the AI and telling it what to do, rather then have the AI try to decide whats best, which it never does.

I am actually working on move.refuel at the moment, it doesn't seem to want to function.

Now the defense officer on the other hand i dont understand, it seems in this iteration of X ships only have one script stack, im starting to think turret targeting and attack protocols are in the EXE.

I have not looked into officer relations, im not sure if they are relevant or not, but without the ability to see the turret code, because i cant find it, i cant really say for sure.
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

Tyrant597 wrote:On a scale of 1 to [X-Rebirth: Release] =) How bad would this be for aborting running scripts on a ship?

Code: Select all

<get_control_entities object="$target" groupname="$ControlEntities"/>
<do_all exact="$ControlEntities.count" counter="$Counter">
     <abort_scripts entity="$ControlEntities.{$Counter}"/>
Extremely, Extremely Bad.
I do something similar, however i've made sure im not going to terminate something sensitive, like a trade script. Also, if you terminate a jump script, you can potentially leave the ship in a dirty state, deadlocking it - something MCE doesnt protect you from yet.
Dungeoncrawler
Posts: 1093
Joined: Sun, 7. Dec 03, 05:32
x3tc

Post by Dungeoncrawler »

After I initiate dialog with an npc, I lose all ability to input any command. I cannot move the ship, etc.
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

Dungeoncrawler wrote:After I initiate dialog with an npc, I lose all ability to input any command. I cannot move the ship, etc.
any NPC? do you have any steps i could use to reproduce this?
User avatar
Black_Sails
Posts: 95
Joined: Wed, 1. Aug 07, 06:35
x3tc

Post by Black_Sails »

Jack08 wrote:
Black_Sails wrote:I've been digging through the aiscripts, and I just don't get it-why can't our player owned ships utilize these types of functions:

move.refuel -looks like scripting for the ship to look for fuel trade offers, dock + purchase fuel. Although I'm guessing this is what happens when the captain complains there isn't enough fuel and you click on the window and tell him to find fuel?

move.patrol
move.seekenemies
move.escort

multiple fight scripts. and fight.defend.capital.

I'm trying to learn how these scripts link into the game, if they do in fact exist. Like since the defense officers "orders" are set to defending, is it supposed to be calling the fight.defend.capital script? I can't find the file that specifies this.

Another idea I have is that when you recruit officers, they keep their current faction relations, so won't engage? I thought about toying with the hireable NPC faction settings to perhaps player and experimenting with what happens but I'm assuming massive game breakage lol. Still having difficulties locating the actually hireable NPCs though-I found a file in libraries, characters.xml but I'm not sure this is exactly what I'm looking for.
This is what this mod is designed to do, bridge the gap between the code back end and your user interface - alot of the code needed for these commands already exists in the game (some are going to need modification or special writing) but for the majority all im doing is safely overriding the AI and telling it what to do, rather then have the AI try to decide whats best, which it never does.

I am actually working on move.refuel at the moment, it doesn't seem to want to function.

Now the defense officer on the other hand i dont understand, it seems in this iteration of X ships only have one script stack, im starting to think turret targeting and attack protocols are in the EXE.

I have not looked into officer relations, im not sure if they are relevant or not, but without the ability to see the turret code, because i cant find it, i cant really say for sure.
I worked abit, using your code as a base (as at that point, I wasn't exactly sure how to add things into menus). I mimicked your style of adding new commands by modifying the relevant files, with the same syntax, and added in move.patrol, move.escort, move.seekenemies, but I kept seeing errors in the uimenu.xml file in the documents directory. It seems that there is a coding error in egosofts seekenemies script-I was seeing errors there before I even started adding mods or playing with them myself. And since it looks like the patrol script depends on seekenemies, I'm assuming thats why it didn't work.

I couldn't get the escort script to work as I couldn't figure out the proper syntax to designate the player's ship as a target. I continued to receive an error about how the target param was not passed onto the escort script, which requires a target to function.

Code: Select all

["message"]="Error: When calling script move.escort on entity 0xAD5D - script parameter \"target\" was not provided!",},
[2485.000000]={
seekenemies gives this error:

Code: Select all

["message"]="Error: Error in AI script move.seekenemies on entity 0x1268F: Property lookup failed: this.ship.distanceto.[component.{0x65ccL},position.[-27745.275391m, -823.915649m, 7077.757813m]]\
* Expression: this.ship.distanceto.[$destination, $pos]",},
It gives me hope though that with some hacking it may be possible to integrate what looks to be the already existing code, into the game and give some combat functionality to player owned ships.

I also dug around and was unable to find any scripts relating to the turrets or defense officer on the ship. Another thing I was trying to figure out..how would you be able to select a ship from within the game, specify it as the "target", and pass that back into the script for an "attack selected target" style command?

I hope you don't mind me playing around with your code-I have no intentions on posting anything that I manage to get working as a mod. I haven't modded before but felt a strong desire to upon seeing the scripts existing..but for some reason, unused within the game.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

It took days for you to make what Egosoft could not in years... Wow...

ISSUE:

Captured/boarded a Fedhelm, a mining-ship and it has no docking-ports of any kind by the looks of it, thus i cant transfer a captain or assignt it to my squad, can i use this mod to make it move or somethin? My marine-officer is stuck onboard along with my stupidly expensive marines.
User avatar
Black_Sails
Posts: 95
Joined: Wed, 1. Aug 07, 06:35
x3tc

Post by Black_Sails »

Also-about the turrets. This is the only relevant code I've found so far referencing them. Its in the move.attack.object.capital file in aiscripts, starting at line 190

Code: Select all

 <do_if value="$enemies.count" min="1">
        <activate_battlestate object="this.ship" state="battlestate_red" />
        <activate_flaks object="this.ship" /> 
following this looks to be the attacking script. The "apply strengths" comments don't make much sense to me though.

Code: Select all

<!-- For each enemy, apply strength-->
      <do_while value="$enemies.count" min="1">
        <debug_text text=" ' unknown. fight. enemies: ' + $enemies " chance="$debugoutputchance" />

        <do_all exact="$enemies.count" counter="$i">
          <!-- Search/Attacking waiting time -->
          <wait min="500ms" max="10s" profile="decreasing" />
          <do_if value="@$enemies.{$i}">
            <set_value name="$target" exact="$enemies.{$i}" />
            <!-- exclude the player ship in OOS case, this scenario wouldn't make any sense anyway -->
            <do_if value="$target != player.primaryship">
              <!-- Get and apply strengths-->
              <do_if value="$target.isoperational" chance="70" comment="chance of fail">
                <!-- do not attack objects that are too far away, gravidar range can be 50km+ !! -->
                <do_if value="this.ship.distanceto.{$target} lt 4km">
                  <!-- Get the strength in 'result'-->
                  <get_attackstrength object="this.ship" target="$target" result="$result" />
                  <!-- Check for ships of player -->
                  <do_if value="$target.isplayerowned" chance="100">
                    <do_if value="$result gt $target.hull*0.2 or $target.hull lt $target.maxhull*0.3">
                      <!-- Signal to warning about a player´s ship under attack -->
                      <signal_objects object="$target" param="'ShipOwnedAttacked'" param2="$target" param3="$target" />
                      <!-- <wait exact="1min" comment="wait to give a chance to the player (not fair for NPC)"/> -->
                    </do_if>
                  </do_if>
                  <!-- Apply the strength to target -->
                  <apply_attackstrength object="$target" attacker="this.ship" strength="$result" result="$isdead" />
                  <debug_text text="'%1 OOS. Apply strength of %2 against %3 is: %4(%5|%6). Is killed: %7'.[player.age,this.ship.knownname,$target.knownname,$result,$target.hull,$target.shield,$isdead]" chance="$debugoutputchance" />
                </do_if>
              </do_if>
            </do_if>
          </do_if>
        </do_all>
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

swatti wrote:It took days for you to make what Egosoft could not in years... Wow...

ISSUE:

Captured/boarded a Fedhelm, a mining-ship and it has no docking-ports of any kind by the looks of it, thus i cant transfer a captain or assignt it to my squad, can i use this mod to make it move or somethin? My marine-officer is stuck onboard along with my stupidly expensive marines.
I haven't a clue, have you tried? you may have to get the ship repaired. Ooo, comand idea! Send for Repair.
Black_Sails wrote:...
im going to guess "strengths" is a german way of saying "weights", weight targets and attack by priority?
HAH, theres a warning about player ships being under attack, i cant help but notice it doesnt work :D
shane1022
Posts: 11
Joined: Mon, 18. Nov 13, 18:37

Post by shane1022 »

Hello! I just wanted to tell you that after installing your mod, and the The mod to make cap ships not use jump fuel, my cap ships will no longer jump to a new part of the galaxy. They will just anywhere inside of DV but will not jump to ALB. I just wanted to post it on both mod pages so we can figure it out.
User avatar
Black_Sails
Posts: 95
Joined: Wed, 1. Aug 07, 06:35
x3tc

Post by Black_Sails »

I'm going to try this..out of curioisity..maybe I can get the ship to be stationary, run the defense script, and see what happens when it stays in "battlestate red". Although I have a feeling that matching the srcmovemode with the fight.defend.capital isn't the correct way to do it.

Code: Select all

<!-- Set ship to defend itself -->
						<do_if value="event.param == 'gEC_Defense'">
							<activate_battlestate object="this.ship" state="battlestate_red" />
							<activate_flaks object="this.ship" />
							<set_value name="$scrMoveMode" exact="'fight.defend.capital'" />
							<abort_called_scripts/>
						</do_if> 
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

Black_Sails wrote:I'm going to try this..out of curioisity..maybe I can get the ship to be stationary, run the defense script, and see what happens when it stays in "battlestate red". Although I have a feeling that matching the srcmovemode with the fight.defend.capital isn't the correct way to do it.

Code: Select all

<!-- Set ship to defend itself -->
						<do_if value="event.param == 'gEC_Defense'">
							<activate_battlestate object="this.ship" state="battlestate_red" />
							<activate_flaks object="this.ship" />
							<set_value name="$scrMoveMode" exact="'fight.defend.capital'" />
							<abort_called_scripts/>
						</do_if> 
If you didnt touch the menus, where is the gEC_Defence Signal coming from?
shane1022 wrote:Hello! I just wanted to tell you that after installing your mod, and the The mod to make cap ships not use jump fuel, my cap ships will no longer jump to a new part of the galaxy. They will just anywhere inside of DV but will not jump to ALB. I just wanted to post it on both mod pages so we can figure it out.
thats verry odd, as far as i know both mods change diffrent files
shane1022
Posts: 11
Joined: Mon, 18. Nov 13, 18:37

Post by shane1022 »

thats verry odd, as far as i know both mods change different files


yes but I believe one of the mods has a bug that makes it so your cap ships wont jump to another part of the galaxy. I just wanted to point it out to both authors because I don't have a way to test it without creating a new save and I don't have time for that tonight.
Last edited by shane1022 on Tue, 19. Nov 13, 09:18, edited 1 time in total.
User avatar
Black_Sails
Posts: 95
Joined: Wed, 1. Aug 07, 06:35
x3tc

Post by Black_Sails »

I added onto the menus, but by following the syntax I saw from your mod. So for additional "actions", in the player.default.xml file, I added in for example the gEC_Defense signal. I added it below the conditions to check for as well on line 126. Then, on orders, I added it into the menu with this line

<add_player_choice_sub text="{7777,4} section=gOrders_ECDefense" .....

I used the id 4 field under the t file for this and renamed it to Defense. I'm not exactly clear on the purposes of the T file however, I just followed the format you used in your extensions.

edit: I think I see it now. The T field is the text that is actually used in the menu. I'm completely new to this so I'm just learning how everything fits in together..
User avatar
jocan2003
Posts: 629
Joined: Tue, 6. Mar 07, 17:48
x4

Post by jocan2003 »

Oh snaps.... finaly basic commands done in less than a few day by a guy alone... they had 7 years and didnt implement the most basic and important stuff....

Anyway big thanks to you, one question tho, if i tell a trader to hold, then make him do a trade run, after his run will he come back into follow mode? or stay on hold?
User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 »

jocan2003 wrote:Oh snaps.... finaly basic commands done in less than a few day by a guy alone... they had 7 years and didnt implement the most basic and important stuff....

Anyway big thanks to you, one question tho, if i tell a trader to hold, then make him do a trade run, after his run will he come back into follow mode? or stay on hold?
it *should* revert back to hold. this is its intended and coded behavior but its also untested behavior.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti »

Jack08 wrote:
swatti wrote:It took days for you to make what Egosoft could not in years... Wow...

ISSUE:

Captured/boarded a Fedhelm, a mining-ship and it has no docking-ports of any kind by the looks of it, thus i cant transfer a captain or assignt it to my squad, can i use this mod to make it move or somethin? My marine-officer is stuck onboard along with my stupidly expensive marines.
I haven't a clue, have you tried? you may have to get the ship repaired. Ooo, comand idea! Send for Repair.
Nope, wont work, since the ship has no captain, i cant give it any orders nor "contact" it via coms.
Property owned, CO-button only gives "details" and "back" buttons.

Is there a way to give commands to "any friendly ship" with out it being in a squad?

Return to “X Rebirth - Scripts and Modding”