[Video Tutorial] Mission Director Basics

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
User avatar
Tohron
Posts: 331
Joined: Mon, 24. Oct 11, 06:38
x3tc

Post by Tohron » Mon, 22. Apr 13, 16:56

Simple question on the first video - you mention extracting files from a catalog file in the X3 Editor 2, but don't say where the catalog file is or how to extract it. Can anyone offer a little guidance? Thanks!

User avatar
Ketraar
Moderator (DevNet)
Moderator (DevNet)
Posts: 9067
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Mon, 22. Apr 13, 18:11

Yes sorry, its always assumed you know these things, bad habit too actually.

Anyway, the files you have to extract are in the cats, depending on which game you use (TC or AP) they will be located in different locations, TC main installation folder for TC and \addon for AP.

The best would be to extract all cats into a working folder starting with the lower numbers and working your way up, overwriting as you go. This makes sure you have the latest version.

For single files its the other way around, open the highest cat and extract the needed files, and work your way down if the higher cat does not contain all the files you need. In this case never overwrite any files.

This method is true to any modding activity.

MFG

Ketraar
Image

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

Post by DrBullwinkle » Mon, 22. Apr 13, 18:25

Rather than hunting for files, it is more reliable (and quicker) to find the file in VFS (Virtual File System).

You can Open from VFS from the file menu or:
  • Pull down Plugins menu.
  • Choose Cat Manager.
The Cat Manager gives you a "view" into VFS. Any file that you open from the Cat Manager will automatically be the most-current version of the file (the same version that the game uses).

VFS automatically manages the Addon folder if you set the Game Profile correctly (Options/Configuration). So just look in the Director folder for the files that you want.

Two ways to export a file:
  • Drag and drop from VFS to Windows Explorer.
  • Pull down the Files menu and choose Extract Files.

User avatar
Ketraar
Moderator (DevNet)
Moderator (DevNet)
Posts: 9067
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Mon, 22. Apr 13, 18:34

Not sure if its my settings but I dont trust VFS for AP, it mixes the files up, specially MD I noticed it.

Anyway, having a full extracted working copy of the games is IMO the simplest way to mod, specially if you like to mod multiple parts of the game.

MFG

Ketraar
Image

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

Post by DrBullwinkle » Mon, 22. Apr 13, 18:40

Ketraar wrote:Anyway, having a full extracted working copy of the games is IMO the simplest way to mod
Agreed.

I have never seen VFS make a mistake. If you move or modify a file outside of X3 Editor, then you may have to close and reopen X3 Editor to re-read the files.
  • (It *should* be sufficient to "Reload game data" but that sometimes does not do the entire job.)

MeltingPointSP
Posts: 30
Joined: Sat, 18. May 13, 03:39
x3ap

Post by MeltingPointSP » Tue, 28. May 13, 02:29

DrBullwinkle wrote: I have never seen VFS make a mistake. If you move or modify a file outside of X3 Editor, then you may have to close and reopen X3 Editor to re-read the files.
There does appear to be a problem with the way X3E2 extracts files (Using the Extract Files botton) with more then one "." (Period) in the file name. (As are most of the MD files in AP)

For example, "0.1 Assassinate 1" is extracted as "0.xml"

This problem is compounded when extracting the entire directory, where any file in the format #.*.pck (ex. "0.19 Escort Convoy.pck") will be replaced by any other file starting with the same number (ex. "0.4 Return Wares.pck"). For each of these examples "0.xml" will be created and replace the previous "0.xml" file.

However, dragging the file (or folder) out of the VFS (to say your desktop) has the desired effect, with the file(s) named properly.

I'm not even sure how I ended up here, or why I'm even looking at MD files, or why this is my first post; I think it started a few days ago, looking for a script to remove rocks from a sector, now I have editors, studios, commandline tools, 100's of bookmarks, coffee stains...

Edit:
DrBullwinkle wrote:Rather than hunting for files, it is more reliable (and quicker) to find the file in VFS (Virtual File System).

You can Open from VFS from the file menu or:
  • Pull down Plugins menu.
  • Choose Cat Manager.
Neither of these methods produce the dircetor.htm/.css/.xsl files displayed in the first video.

The only convoluted way to get to these files, is to open VFS (Plugins->Cat Manager) then go to File->Open Catalog and open each .cat file in your AP/TC folder. For AP it appears that 2 files are in 01.cat and the other 4 are in 02.cat

Oh, and after all that, these files only work with Internet Explorer. I haven't had IE installed on a computer for nearly a decade.
Last edited by MeltingPointSP on Tue, 28. May 13, 04:07, edited 1 time in total.

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

Post by DrBullwinkle » Tue, 28. May 13, 03:50

MeltingPointSP wrote:I'm not even sure how I ended up here, or why I'm even looking at MD files, or why this is my first post; I think it started a few days ago, looking for a script to remove rocks from a sector, now I have editors, studios, commandline tools, 100's of bookmarks, coffee stains...
Think of the coffee stains as a "badge of honor" for having learned something so important.

And, just so that your first post will not go to waste:

Remove Rocks (Mini Asteriods) (Laux)

MeltingPointSP
Posts: 30
Joined: Sat, 18. May 13, 03:39
x3ap

Post by MeltingPointSP » Tue, 28. May 13, 04:16

DrBullwinkle wrote:
Think of the coffee stains as a "badge of honor" for having learned something so important.

And, just so that your first post will not go to waste:

Remove Rocks (Mini Asteriods) (Laux)
:P Thanks for the link, more code I can assimilate into my rock removal script that is quickly spiraling out of control.

On a more serious note, I'm very quickly learning why there are so few modders for this game. I would cry if it wasn't so funny. I truly hope X:Rebirth has a more sane modding environment.

salleonis
Posts: 26
Joined: Sat, 1. Sep 12, 15:46
x3tc

Post by salleonis » Sat, 21. Sep 13, 13:31

Thank you Ketraar for find time to create this tutorials.I have problem to understand what is going on in Naming Convention part 2.My code is same as code in last second of video(part 2) but when i change name to Tutorial in game,ships(or ship) are created but first message is "Group Objects amount" (and always is zero no mater how many ships are created) not "Hello {player.name},welcome to MD tutorial."I was thinking that first message would be Hello then Group . Please Ketraar or somebody help me understand what i m doing wrong.

User avatar
Ketraar
Moderator (DevNet)
Moderator (DevNet)
Posts: 9067
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Sat, 21. Sep 13, 14:03

Can you post your code or link to the MD file, then we can have a look, might be a typo in there or something. :-)

Glad people still giving it a go to learn MD. :-)

MFG

Ketraar
Image

salleonis
Posts: 26
Joined: Sat, 1. Sep 12, 15:46
x3tc

Post by salleonis » Sat, 21. Sep 13, 14:27

Here is code:

Code: Select all

<cues>
    <cue name="MDTutorial_TopLevel" delay="2s">
      <condition>
        <check_all>
          <check_value value="{player.name}" exact="Tutorial"/>
        </check_all>
      </condition>
      <timing>
        <time exact="2s"/>
      </timing>
      <action>
        <do_all>
          <incoming_message author="Ketraar"  text="Hello {player.name},welcome to MD tutorial."/>
          <do_all min="1" max="5" counter="ships">
            <create_ship name="this.TutorialShip{counter@ships}" group="this.TutorialGroup" race="argon"  racelogic="0" typename="SS_SH_A_M1">
              <position object="{player.ship}" min="10km" max="20km"/>
              <sector sector="{player.sector}"/>
            </create_ship>
          </do_all>
         </do_all>
      </action>
      <cues>
        <cue name="MDTutorial_Hail" delay="2s">
          <condition>
            <check_all>
              <check_value value="{object.distance@MDTutorial_TopLevel.TutorialShip1}" max="5km" />
            </check_all>
          </condition>
          <action>
            <do_all>
              <set_value name="this.Objects" exact="{group.object.count@MDTutorial_TopLevel.TutorialGroup}"/>
              <incoming_message author="Ketraar"  text="Group Objects amount: {value@this.Objects}"/>
            </do_all>
          </action>
        </cue>
      </cues>
    </cue>  
  </cues>
</director>
Thank you for quick replay.If it is typo i will punish my self, no X for whole day. :)


Edit: added code-tags, so that the formatting doesn't get lost. X2-Illuminatus

User avatar
Ketraar
Moderator (DevNet)
Moderator (DevNet)
Posts: 9067
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Sat, 21. Sep 13, 15:04

Doesnt look like a typo, try adding a cue_complete condition in the MDTutorial_Hail cue like this

Code: Select all

<cue name="MDTutorial_Hail" delay="2s">
          <condition>
            <check_all>
              <cue_is_complete cue="MDTutorial_TopLevel"/>
              <check_value value="{object.distance@MDTutorial_TopLevel.TutorialShip1}" max="5km" />
            </check_all>
          </condition> 
This may help avoid the sub cue to trigger too soon and getting both messages at same time, where the last one will be "on top" in your inbox.

MFG

Ketraar
Image

salleonis
Posts: 26
Joined: Sat, 1. Sep 12, 15:46
x3tc

Post by salleonis » Sat, 21. Sep 13, 15:49

Thank you X2-Illuminatus i overlooked that option.
Here is code now:

Code: Select all

<cues>
    <cue name="MDTutorial_TopLevel" delay="2s">
      <condition>
        <check_all>
          <check_value value="{player.name}" exact="Tutorial"/>
        </check_all>
      </condition>
      <timing>
        <time exact="2s"/>
      </timing>
      <action>
        <do_all>
          <incoming_message author="Ketraar"  text="Hello {player.name},welcome to MD tutorial."/>
          <do_all min="1" max="5" counter="ships">
            <create_ship name="this.TutorialShip{counter@ships}" group="this.TutorialGroup" race="argon"  racelogic="0" typename="SS_SH_A_M1">
              <position object="{player.ship}" min="3km" max="6km"/>
              <sector sector="{player.sector}"/>
            </create_ship>
          </do_all>
         </do_all>
      </action>
      <cues>
        <cue name="MDTutorial_Hail" delay="2s">
          <condition>
            <check_all>
              <cue_is_complete cue="MDTutorial_TopLevel"/>
              <check_value value="{object.distance@MDTutorial_TopLevel.TutorialShip1}" max="5km" />
            </check_all>
          </condition>
          <action>
            <do_all>
              <set_value name="this.Objects" exact="{group.object.count@MDTutorial_TopLevel.TutorialGroup}"/>
              <incoming_message author="Ketraar"  text="Group Objects amount: {value@this.Objects}"/>
            </do_all>
          </action>
        </cue>
      </cues>
    </cue>  
  </cues>
</director>
I changed position object to be able to see ships and not to fly around to find them.First message trigger after change name second not at all.I waited for 5 min.Forgot to say , doing all this in AP 3.0.

User avatar
Ketraar
Moderator (DevNet)
Moderator (DevNet)
Posts: 9067
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar » Sat, 21. Sep 13, 17:00

Well make sure you are max 5km to the Target ship, collision avoidance can sometimes move objects from the desired position even if you set them to be within 3-5 km. To test properly I suggest you spawn only 1 ship so you can narrow down the issue (change the max=5 in the do_all to max=1).

Cant see anything wrong from here, unfortunatelly I have no valid AP installation to try it myself. :-|

MFG

Ketraar
Image

dillpickle
Posts: 1154
Joined: Mon, 3. Nov 08, 15:25
x3tc

Post by dillpickle » Sat, 21. Sep 13, 17:39

If you're going to use {object.distance@object) you need to get your units correct:

Code: Select all

<check_value value="{object.distance@MDTutorial_TopLevel.TutorialShip1}" max="5km" />
Should be:

Code: Select all

<check_value value="{object.distance.km@MDTutorial_TopLevel.TutorialShip1}" max="5" />
{object.distance@object} will be looking for a value in whatever the base distance measurement is, and specifying "km" in the value will be throwing it. {object.distance.km@object} and {object.distance.m@object} are more manageable variations.

Other ways to do it would be:

Code: Select all

<condition>
  <check_all>
    <object_position object="MDTutorial_TopLevel.TutorialShip1" max="5000m">
      <position object="{player.ship}"/>
    </object_position>
  </check_all>
</condition>
For this first ship in the group, or:

Code: Select all

<condition>
  <check_all>
    <any_object_position group="MDTutorial_TopLevel.TutorialGroup" max="5000m">
      <position object="{player.ship}"/>
    </any_object_position>
  </check_all>
</condition>
For any ship in the group.

You don't technically need:

Code: Select all

<set_value name="this.Objects" exact="{group.object.count@MDTutorial_TopLevel.TutorialGroup}"/> 
You can just use:

Code: Select all

<incoming_message author="Ketraar"  text="Group Objects amount: {group.object.count@MDTutorial_TopLevel.TutorialGroup}"/>
Image

Post Reply

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