[Help - Solved] MD Objects & Variables

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

User avatar
Createse
Posts: 58
Joined: Fri, 20. Mar 09, 23:28
x4

Post by Createse » Wed, 5. Mar 14, 18:11

dillpickle wrote:Can't help anymore at present, as have no facility to unpack .pck, until I get home Friday... xml I can look at OK.
Re-download, they're uncompressed for you now. If you've no means to play-test however, then the XML posted previously should be enough to work with I would've thought, unless of course it isn't in which case the download probably won't help much either :D.

User avatar
Createse
Posts: 58
Joined: Fri, 20. Mar 09, 23:28
x4

Post by Createse » Fri, 7. Mar 14, 14:57

I've determined it's not a syntax issue by outputting the calculated values to a message log. None the wiser as to why it's not populating the two ships with the dynamic values though.

{object.maxshieldcount@this.Aran} (for example) will be populated with the correct value but for some reason isn't used or is ignored (value = 0) when I try to equip this.Aran in Start.xml.
Last edited by Createse on Thu, 20. Mar 14, 19:57, edited 1 time in total.

User avatar
Createse
Posts: 58
Joined: Fri, 20. Mar 09, 23:28
x4

Post by Createse » Thu, 20. Mar 14, 19:56

Has anyone encounter this before?

dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle » Thu, 20. Mar 14, 21:47

It may be that it adds all the wares etc... to the ship and then assigns the object name, which is why it can't find the 'object' - but that's only a guess.

If you take the cargo/equipment that relies on '@object' out of the actual ship creation part and put them after the reward_player, thus:

Code: Select all

</reward_player>
<add_cargo object ="this.Aran">
  <!-- Marines -->
  <ware typename="SS_WARE_SOLDIER_1" exact="{object.marines.maxcount@this.Aran}" comment="Mercenary" />
</add_cargo>
<add_equipment object="this.Aran">
  <!-- Shields -->
  <ware typename="SS_SHIELD_F" exact="{object.maxshieldcount@this.Aran}" comment="2 GJ Shield" />
  <!-- Upgrades -->
  <ware typename="SS_WARE_TECH213" exact="{object.equipment.SS_WARE_TECH213.maxcount@this.Aran}" comment="Engine Tunings" />
  <ware typename="SS_WARE_TECH246" exact="{object.equipment.SS_WARE_TECH246.maxcount@this.Aran}" comment="Rudder Optomisation" />
  <ware typename="SS_WARE_TECH251" exact="{object.equipment.SS_WARE_TECH251.maxcount@this.Aran}" comment="Cargo Bay Extension" />
</add_equipment>
<add_cargo object ="this.Ozias">
  <!-- Marines -->
  <ware typename="SS_WARE_SOLDIER_1" exact="{object.marines.maxcount@this.Ozias}" comment="Mercenary" />
</add_cargo>
<add_equipment object="this.Ozias">
  <!-- Shields -->
  <ware typename="SS_SHIELD_D" exact="{object.maxshieldcount@this.Ozias}" comment="200 MJ Shield" />
  <!-- Upgrades -->
  <ware typename="SS_WARE_TECH213" exact="{object.equipment.SS_WARE_TECH213.maxcount@this.Ozias}" comment="Engine Tunings" />
  <ware typename="SS_WARE_TECH246" exact="{object.equipment.SS_WARE_TECH246.maxcount@this.Ozias}" comment="Rudder Optomisation" />
  <ware typename="SS_WARE_TECH251" exact="{object.equipment.SS_WARE_TECH251.maxcount@this.Ozias}" comment="Cargo Bay Extension" />
</add_equipment>
Then shields/engine tunings/etc... get added to your ships.

User avatar
Createse
Posts: 58
Joined: Fri, 20. Mar 09, 23:28
x4

Post by Createse » Thu, 20. Mar 14, 21:56

dillpickle wrote:It may be that it adds all the wares etc... to the ship and then assigns the object name, which is why it can't find the 'object' - but that's only a guess.
Perhaps it does the ship creation (tag to tag) in a single pass like Batch/Bash scripts do, or something similar. Point is, the object obviously doesn't exist at that stage, which is what you or JonfersonSDD said previously - or something.
dillpickle wrote:If you take the cargo/equipment that relies on '@object' out of the actual ship creation part and put them after the reward_player
Haha! That's exactly what I just did after having a short discussion with Bullwinkle. It works as intended. I'll need to use a different variable for marines though, {object.marines.maxcount@object} doesn't work.

dillpickle
Posts: 1159
Joined: Mon, 3. Nov 08, 14:25
x3tc

Post by dillpickle » Thu, 20. Mar 14, 22:04

Createse wrote:I'll need to use a different variable for marines though, {object.marines.maxcount@object} doesn't work.
Are you sure? I had twenty marines added to both the Aran and the Ozias, admittedly only tested a couple of times.

Though you might as well put it back in with the ship creation part with:

Code: Select all

<ware typename="SS_WARE_SOLDIER_1" exact="20" comment="Mercenary" />
As it's a fixed (hard coded) amount that each ship type can carry...

User avatar
Createse
Posts: 58
Joined: Fri, 20. Mar 09, 23:28
x4

Post by Createse » Thu, 20. Mar 14, 22:14

dillpickle wrote:Are you sure? I had twenty marines added to both the Aran and the Ozias, admittedly only tested a couple of times.
Yep, no marines were spawned.

Code: Select all

<reward_player>
    <property>
        <ship typename="SS_SH_GO_MSY" name="this.Aran">
    </property>
</reward_player>
<add_cargo object="this.Aran">
    <ware typename="SS_WARE_SOLDIER_1" exact="{object.marines.maxcount@this.Aran}" />
</add_cargo>
dillpickle wrote:Though you might as well put it back in with the ship creation part . . . As it's a fixed (hard coded) amount that each ship type can carry
I agree. The rest of my cargo is hardcoded too, in the XML.

Post Reply

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