[Video Tutorial] Mission Director Basics

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

MeltingPointSP
Posts: 34
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: 5715
Joined: Sat, 17. Dec 11, 01: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: 34
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
EGOSOFT
EGOSOFT
Posts: 11818
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
EGOSOFT
EGOSOFT
Posts: 11818
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
EGOSOFT
EGOSOFT
Posts: 11818
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: 1159
Joined: Mon, 3. Nov 08, 14: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}"/>

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

Post by salleonis » Sat, 21. Sep 13, 19:06

With dillpickle correction

Code: Select all

<check_value value="{object.distance.km@MDTutorial_TopLevel.TutorialShip1}" max="5" />
and Ketraar

Code: Select all

<cue_is_complete cue="MDTutorial_TopLevel"/> 
working properly.Thank you people. :)

Aven Valkyr
Posts: 228
Joined: Thu, 13. Mar 14, 23:52
x3ap

Post by Aven Valkyr » Mon, 9. Mar 15, 00:25

Ketraar I hope you are still monitoring this post as I have a question to ask about library files within the x3 TC MD. I would like to call a library file within the cue of another file. Basically when a check value passes within the cue the library is called for. I've played with the <cue ref=""/> but there is no way to control what happens. It just reads the tag of the cue itself, does everything within the library file, then continues down into the cue own conditions and actions. I have tried to disable this cue from a parent cue by giving the cue a name and then using that name within the parent cue to cancel the actions of it. for example:

<cue name="this" ref="something"/>

I've tried:
<cue>
<conditions>
<check_all>
<cue_exists cue="this">
</check_all>
<actions>
<do_all>
<cancel_cue cue="this">
</do_all>
</cue>
<cue ref="something" name="this"/>

And that doesn't stop the cue from running. I just don't know what to do. How do you call a library and have the ability to safely use it within a do_all function?

User avatar
alexalsp
Posts: 1823
Joined: Fri, 18. Jul 14, 05:28
x4

Re: [Video Tutorial] Mission Director Basics

Post by alexalsp » Wed, 26. Apr 23, 16:49

I looked through the files of the Director folder and I had a doubt, but since I'm not strong in this, I want to clarify with knowledgeable people.

Tell me, is there a mistake here?

Code: Select all

<set_value name="this.hour" exact="(({value@this.test}-{value@this.hour_okr}*60*24))/60)" comment="hour"/>
and

Code: Select all

<set_value name="this.day" exact="(({value@this.test}-{value@this.day_okr}*60*24*30))/60/24+1)"/>
and

Code: Select all

<set_value name="this.ShipPrice" exact="{value@this.Price}-({value@this.Price}*(100-{object.hull@this.Gaea}/100)"/>
My suggestion...

Code: Select all

<set_value name="this.hour" exact="(({value@this.test}-{value@this.hour_okr}*60*24)/60)" comment="hour"/>
or

Code: Select all

<set_value name="this.hour" exact="({value@this.test}-{value@this.hour_okr}*60*24)/60" comment="hour"/>
and

Code: Select all

<set_value name="this.day" exact="(({value@this.test}-{value@this.day_okr}*60*24*30)/60/24+1)"/>
and

Code: Select all

<set_value name="this.ShipPrice" exact="{value@this.Price}-({value@this.Price}*(100-{object.hull@this.Gaea}/100))"/>
It seems to me that there is an extra bracket in the first two options, and one is missing in the last example.
Or is it still correct? Then explain why, if not long and not difficult.

The document opened in VS, but it doesn't show that the extra curly or parentheses, neither open nor closed , is a bug. He completely ignores them.

Post Reply

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