[Discussion] Generic X3TC S&M questions II

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

User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Sorry, forgot to say...

All done and released already? :P
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Okey dokey. After reviewing the missions I've got one more thing to say before going to bed.

AFAIK, it's possible to run a script from the MD.

And, AFAIK, it's possible to set the MD to constantly look for a ship in, say, Null, and a script to spawn it, and you to check wares onboard etc. for passing through values.

With that so...

How long would it take a complete MD noob like me, to create all the missions I need. Most of course based of vanilla... (could I extract and edit them?) and are simple enough, just with the twist of being run by a script, and finishing with a script.

I just decided:

1. I've more or less sussed most of the SE now, why not try the MD?
2. Surely MDing the missions will be easier. Sure, I don't know how, but it's what it was built for.
3. It'll look much better and function much better.
4. AFAIK it's possible and really not too hard.


What options are there in the MD for spawning sets of ships for the missions? The whole point of the missions was to have support on your side.

Are there actually any up-to-date MD guides? If not I'll document my experiences.

Thanks for your support. I'd have never made it otherwise... being able to script something reasonable feels goood!
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

There aren't really any manuals for MD.
You kind of just have to learn by looking at how other people did it and trial and error.

Be sure to download: Microsoft Visual Web Developer 2010 Express (free)

Download organic notoriety and look at how I did it in (MD) Defend Object and (SE) plugin.organic.notoriety.missions.
Ship Hull is an easy condition trigger.

That is how to start from MD and go to SE.

However it is very difficult to start from SE and go to MD, since MD needs an object with an MD name and only MD can give an object an MD name.

That is where MD Control comes in. It allows you to skip any complex MD steps and by just applying the template at the beginning of your MD. Then use your script to send your key to md.control.key and your MD will run.

Choose any key you want, or a block of keys and post them in the thread.

You'll be the first to distribute it to the players so PM me before you do to ensure that everything is functioning invisibly.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Hm not quite sure how your control script works but I'll take a look tomorrow. I think I'll try a basic kill ship mission. Anyway, anyone else with lots of MD experience'
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

The time has come... can anyone point me to the most complete noob help/up to date MD stuff?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

Last night your thread got derailed a little, between myself, LV, and djrygar. I wonder where it went. It was very relevant to your collateral damage code.

To sum it up:
don't use sig.killed to start a task
any script called by the sig.killed object needs to end as fast as possible
use sig.killed to gather data about the object

Code: Select all

$data.array[0] = [THIS]->get size of object
$data.array[1] = [THIS]->get sector
$data.array[2] = [THIS]->get attacker
$data.array[3] = [THIS]->get position as array
$data.array[4] = [THIS]->get owner race

  = null->call script 'ej.capship.boom' : data.array=$data.array



This code can't be used in the called script:
   skip if $Ship != [THIS] 
      continue
Instead, have it check for the local variable:
   skip if not $ship->get local variable: name='ej.military.bigship.blast'
      continue

This code can't be used in the called script:
   $Range = get distance between [THIS] and $Ship
Instead, use this:
   $origin.pos = $data.array[3]
   $range = $ship -> get distance to: position array=$origin.pos

This code can't be used in the called script:
   $Ship->destroy object: killer=[THIS], show no explosion=[FALSE]
Instead, use this:
   $origin.race = $data.array[4]
   $Ship->destroy object: killer=$origin.race, show no explosion=[FALSE]
@MD question
My MD Control thread has some.
another.. let me find it after dinner.. I think it was a thread with the words "MD" and "question" in it. Use google you might find it before I get back.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

What's wrong with the sig killed...? At the moment it keeps the ship alive after death to blow it up epically.

If there's some way that messes with the game, please tell me.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

To sum it up:
don't use sig.killed to start a task
any script called by the sig.killed object needs to end as fast as possible
use sig.killed to gather data about the object
Interesting problems. But what do you mean when you say "don't use sig.killed to start a task"? Do you mean starting a task on the killed object?

The only thing that really bugs me about SIGNAL_KILLED is that it fires twice. So you have to set a local variable to catch that second emission.

As far as the complexity of SIGNAL_KILLED scripts goes, they shouldn't take too long to complete, because the object will "stay alive" as long as the SIGNAL_KILLED script runs, which can be odd if your scripts need a few seconds to complete.
However, I'll try it out this weekend, since it might have impact on future scripts of mine aswell...

Greetings,
ScRaT
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

In this case mine does need a few seconds to complete.

A good few.

And that's the purpose of it. To make the ship drift dead for a few seconds, then loads of explosions. ;D
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

I've seen a number of 0 hull invuln ships flying around with non-interruptible tasks on them. (they might be scripts or tasks) or rather I once forced all killed ships to be 0 hull invuln ships by have it call a script/task.. hah.. i don't remember.

You bring up something interesting.
It does call it twice.

Perhaps it's the second call that makes it disappear. So we should prevent anything from happening during the second call.

Example:

Code: Select all

$secondcall = [THIS]-> get local variable: name=kill.sig.secondcall
skip if not $secondcall
  return null
[THIS]->set local variable: name=kill.sig.secondcall value=[TRUE]
Perhaps keeping the first call running, temporarily, is fine.
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

Anyone have any ideas on:

Determining the amount of notoriety lost by attacking/killing a ship and when the notoriety change happens? I'm assuming it is hardcoded and if I use SE to detect the change in notoriety it will be a cpu consuming task of constantly rebuilding a notoriety array until the event happens...

Also, could someone explain:
<RetVar/IF> <RefObj> -> is <Var/Ship/Station> a enemy

Is that a shortcut which detects if <Var/Ship/Station> is in a core sector and then determines if it is Foe based on its notoriety?
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

<RetVar/IF> <RefObj> -> is <Var/Ship/Station> a enemy

Is that a shortcut which detects if <Var/Ship/Station> is in a core sector and then determines if it is Foe based on its notoriety?
Not sure about that code... if it doesn't relate to another object for it to be the enemy of, presumably it means Enemy Race or similar?


EDIT: And where are those MD resources I've seen before... got a feeling they're in R S&M but can't find them... the one with director.htm in it?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

they are hiding in the various xx.cats.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Okey dokey.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="director.xsl" type="text/xsl" ?>
<director name="Example" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="director.xsd">
  <documentation>
    <author name="JDouglas" alias="EmperorJon" contact="Forum" />
  </documentation>
  <cues>
    <cue name="cue_test">
      <check_all>
        <check_value value="{player.name}"/>
      </check_all>
      <action>
        <incoming_message popup="1" text="{player.name}"/>
      </action>
    </cue>
  </cues>
</director>
I think that's right. Therefore I reckon if you tell me why it doesn't work, I'll be on my way!
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Fixed my MD...

Now I'm gonna start on a mission.

It'll be slow, but heh.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Ok, this far so far:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="director.xsl" type="text/xsl" ?>
<director name="Example" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="director.xsd">
  <documentation>
    <author name="JDouglas" alias="EmperorJon" contact="Forum" />
  </documentation>
   <cues>
      <params>
         <param name="MilitaryRace" value="EJKILLSHIP Military.Race"/>
         <param name="EnemyRace" value="EJKILLSHIP Enemy.Race"/>
         <param name="SetDifficulty" value="EJKILLSHIP Difficulty"/>
         <param name="Target" value="EJKILLSHIP Target"/>
         <param name="TargetSector" value="EJKILLSHIP Target.Sector"/>
         <param name="MissionVersion" value="EJKILLSHIP Mission.Version"/>
         <param name="OutpostSentThrough" value="EJKILLSHIP Outpost"/>
      </params>
      <cue name="dockedatmo">
         <condition>
            <object_is_docked dockobject="{Outpost}">
         </condition>
            <run_script script="ej.military.player.mission.setup" object="{player.ship}">
      </cue>
   </cues>
</director>


Not sure how to fit the docked check as the cue to run the script. Oh, and how would I set parameters? I want to set them up from a dummy ship/station in Null, how would I set certain data as the params after 'finding' the ship/station?

This is quite fun! Briefings, conversations, etc. after I've built the main structure:

Build mission.
Add fluff.
Add notoriety and rewards.
Tweak difficulty levels and ships spawned.
Bug test.
Copypasta!



EDIT: Disregard the question on how to fix that bit... added the missing /s. Now on to the params...?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

do you have {Outpost} defined somewhere?
as it is I don't think MD will know what to do with it.
I think you will need to find all the outposts of the different types and assign them to a group:
<find_station typename="SS_DOCK_A_MILITARY" group="CueName.OutpostGroup"/>
<find_station typename="SS_DOCK_B_MILITARY" group="CueName.OutpostGroup"/>
etc

then (i don't know if this is right) check that the playership is docked at the group
<object_is_docked object="{player.ship} dockobject="CueName.OutpostGroup"/>
or
<any_object_is_docked dockobject="{player.ship}" group="CueName.OutpostGroup"/>
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Yeah, I knew it wasn't defined. Defining it now.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

Notoriety Question:
I've seen in various places and topics that when notoriety < -9999 everything becomes hostile to you.
What about just in core sectors, I have seen <-999 however ingame they boot me out at <-99.

Is <-99 a bug or is it correct that core sectors are off limits at <-99?
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Can anyone see a problem here:

Code: Select all

   <cues>
     <cue name="ShipTrig">
       <timing>
<time exact="60s"/>
       </timing>
         <action>
            <do_all>
              <incoming_message text="Started!"/>
              <find_ship name="this.triggership">
                <position x="1000km" y="1000km" z="1000km" exact="0"/>
                <sector x="0" y="0"/>
              </find_ship>
              <do_if value="{object.exists@this.triggership}" exact="0">
                <cancel_cue cue="ShipTrig"/>
                <reset_cue cue="ShipTrig"/>
                <incoming_message text="Noship!"/>
              </do_if>
              <do_if value="{object.exists@this.triggership}" exact="1">
                <set_owner race="player" object="{this.triggership}" />
                <incoming_message text="Ship transferred"/>
              </do_if>
            </do_all>
         </action>
     </cue>
Currently it seems to be transferring a random ship. Not a ship at directly 1000,1000,1000...
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______

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