[Official Mod Development Bug Reports] A Thread for Mod Creators

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

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

Clownmug
Posts: 190
Joined: Wed, 11. Dec 13, 03:39

Post by Clownmug » Tue, 9. Aug 16, 22:50

UniTrader wrote:regarding Create Station: not using it directly, but using create_ship instead to create a CV first, and then attach my current mod Station to an Buildspot there - and the created Zone always has 7 buildspots, which is an unique property of Temp Zones and i assume this is the same for Creating Stations in a Sector
That makes sense. I noticed that the temp zones work correctly with <create_lockbox> as well. I'm guessing that most objects will spawn with a temp zone correctly but for some reason a station will cause the zone to spawn as a map zone.
UniTrader wrote:regarding presentation Cluster: it is just a workaround, but if you save and reload this should be resolved because presentation clusters are not Save-Persistent (except you say explicitly they are) - found this out the hard way...
I'm not trying to make presentation clusters though, I'm just adding clusters to the map the normal way. However, it seems that a side effect of adding these clusters is that with my mod the game will freeze for 2-3 seconds every time a presentation cluster is created or destroyed. The object cutscenes used by the encyclopedia and certain missions are doing this constantly whenever they're opened or closed. The cutscenes normally only cause a brief stutter in an unmodded game.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Tue, 9. Aug 16, 23:19

Clownmug wrote:
UniTrader wrote:regarding presentation Cluster: it is just a workaround, but if you save and reload this should be resolved because presentation clusters are not Save-Persistent (except you say explicitly they are) - found this out the hard way...
I'm not trying to make presentation clusters though, I'm just adding clusters to the map the normal way. However, it seems that a side effect of adding these clusters is that with my mod the game will freeze for 2-3 seconds every time a presentation cluster is created or destroyed. The object cutscenes used by the encyclopedia and certain missions are doing this constantly whenever they're opened or closed. The cutscenes normally only cause a brief stutter in an unmodded game.
do you add a new cluster at 0/0/0 by chance? if yes try move it away from there - pesentation clusters are created there and it may be possible objects may be checking wheter they should change cluster context since they are nearby physically... just an idea though..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Clownmug
Posts: 190
Joined: Wed, 11. Dec 13, 03:39

Post by Clownmug » Wed, 10. Aug 16, 01:04

UniTrader wrote:
Clownmug wrote:
UniTrader wrote:regarding presentation Cluster: it is just a workaround, but if you save and reload this should be resolved because presentation clusters are not Save-Persistent (except you say explicitly they are) - found this out the hard way...
I'm not trying to make presentation clusters though, I'm just adding clusters to the map the normal way. However, it seems that a side effect of adding these clusters is that with my mod the game will freeze for 2-3 seconds every time a presentation cluster is created or destroyed. The object cutscenes used by the encyclopedia and certain missions are doing this constantly whenever they're opened or closed. The cutscenes normally only cause a brief stutter in an unmodded game.
do you add a new cluster at 0/0/0 by chance? if yes try move it away from there - pesentation clusters are created there and it may be possible objects may be checking wheter they should change cluster context since they are nearby physically... just an idea though..
Yeah, there was one cluster at (0,0,0). I just tried changing its coordinates but the freezing problem is still there.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Fri, 26. Aug 16, 00:06

just solved a Mistake in my Scripts which could have been found far easier if the Game printed some kind of Debug message in this case:

i had a Script which used the line:

Code: Select all

<attention min="visible">
but this was the only Attention Node present. wondered for a long time why it refued to Start in many cases..
it would be really helpful if when someone attempts to Start a Script somewhere, but said Script has no Code for that Attention (or the Attention switches to some not covered Level) an [=ERROR=]-Message would be printed to the Log - because usually this shouldnt happen...
currently it fails silently (or prints an Error on a higher debug level than general, didnt check) and just exits the Script..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Sat, 10. Sep 16, 15:33

i think this falls into unforseen limitations: me and Assailer need some more (standard) String Operations, best both for lua and AI/MD: (just Copied a lua syntax description from the Internet, should be obvoius how the AI/MD Syntax is meant; parameters in italics are optional, with their default as value)

LUA: strfind (str, substr, [init, [end]])
AI/MD: <get_position_of_substring result="$result" string="$string" substring="$substring" start="0" end="$string.length"/>
Receives two string arguments, and returns a number. This number indicates the first position where the second argument appears in the first argument. If the second argument is not a substring of the first one, then strfind returns nil . A third optional numerical argument specifies where to start the search. Another optional numerical argument specifies where to stop it.

LUA: strlen (s)
AI/MD: $string.length (as expression)
Receives a string and returns its length.

LUA: strsub (s, i, [j])
AI/MD: <get_substring_of_string result="$result" string="$string" start="0" length="$string.length" end="$string.length"
Returns another string, which is a substring of s , starting at i and runing until j . If j is absent, it is assumed to be equal to the length of s . Particularly, the call strsub(s,1,j) returns a prefix of s with length j , while the call strsub(s,i) returns a suffix of s , starting at i .
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Andy_MB
Posts: 70
Joined: Fri, 24. Jul 15, 17:47

Post by Andy_MB » Tue, 20. Sep 16, 14:09

Bug: some times repared ship is not undocks.
"given for repairs to the shipyard , new boarded Ship.
Resources for repair everything, but Shiptreyder it does not let them go for several hours. I do not remember how, but this ship came with a sequence of four trade routes.
As it docked, routes can not be reseted."

It was required to write a script with the addition button "Give my ship" to NPC_Shiptrader

Code: Select all

 <diff>
<add sel="/mdscript/cues/cue[@name='Base']/cues/cue[@name='DefaultComm']/actions/do_else/do_else/do_if[@value='$ship?']">
  <add_player_choice_sub text="'Give me my ship back!'" position="bottom_left" section="cArch_BackMyShip" choiceparam="[0, 0, $actor, $BuildModule, $ship, $ship.macro.id]"/>
  </add>
  <add sel="/mdscript[@name='NPC_Shiptrader']/cues/cue[@name='Base']/cues">

    <cue name="Clear_Bild_Module_And_Release_Ship" instantiate="true">
      <conditions>
        <event_conversation_next_section section="cArch_BackMyShip" actor="$actor" />
      </conditions>
      <actions>
        <signal_cue_instantly cue="BuildFinished" param="$BuildModule" />
      </actions>
    </cue>
  </add>
</diff>
fixes for broken savegames(in NPC_Shiptrader.xml) dosent work in this case!
Needs a new fix which checks (Repair Finised?) and (not $actor.buildmodule.freedockslot?) or similar.
_____________

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Sun, 2. Oct 16, 15:44

and encountered one more thing, requires some explaination though:

i made some Movement Scrtipts from Scratch (i think you already know them ^^ ) and to keep Movement as fluent as possible i wrote everything in such a way that the next movement command ( <move_to/> ) is given shortly before the current one is finished (to avoid complete Stops)
There is one odd case with this: When a Ship is currently boosting and approaching its Destination Position it usually slows down - but the moment i give the next movement Order (which is without boosting, since its IZ movement) it immediately speeds up to top speed again until it reaches the Waypoint where the Boosters are switched off and it quickly slows down. it seems for Boost Slowdown only the presence of further Waypoints is used, but its irrelevant if they are also for boosting or not.
So i request a small change for Boost End Behavior: take into account whether the next Waypoint is also with boosting (no slowdown) or if its regular movement (with slowdown).
Dont forget about the case where a Ship already slows down and then further waypoints are added.

Really low priority imo since it doesnt happen in Vanilla (yet). wanted to report it anyway :)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
Marvin Martian
Posts: 2602
Joined: Sun, 8. Apr 12, 09:40

Post by Marvin Martian » Tue, 22. Nov 16, 17:04

that crazy stuff you need to find primarypurpose of an macro, because ES doesn't add anything to check for :roll:

Code: Select all

<substitute_text text="$testmacro" source="$macro.id">
	<replace string="'builder'" with="'match'" />
</substitute_text>
<do_if value="$testmacro != $macro.id">
	<set_value name="$primarypurpose" exact="'build'"/>
</do_if>
<do_else>
	<substitute_text text="$testmacro" source="$macro.id">
		<replace string="'mine'" with="'match'" />
		<replace string="'collect'" with="'match'" />
	</substitute_text>
	<do_if value="$testmacro != $macro.id">
		<set_value name="$primarypurpose" exact="'mine'"/>
	</do_if>
	<do_else>
		<substitute_text text="$testmacro" source="$macro.id">
			<replace string="'cargo'" with="'match'" />
			<replace string="'contain'" with="'match'" />
			<replace string="'energ'" with="'match'" />
			<replace string="'liquid'" with="'match'" />
			<replace string="'bulk'" with="'match'" />
			<replace string="'ship_04'" with="'match'" />
			<replace string="'transpo'" with="'match'" />
		</substitute_text>
		<do_if value="$testmacro != $macro.id">
			<set_value name="$primarypurpose" exact="'trade'"/>
		</do_if>
		<do_else>
			<set_value name="$primarypurpose" exact="'fight'"/>
		</do_else>
	</do_else>
</do_else>

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Tue, 22. Nov 16, 17:15

currently cannot check, but isnt there a .primarypurpose property for macros? (which results in an objectpurpose, not a string)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
Marvin Martian
Posts: 2602
Joined: Sun, 8. Apr 12, 09:40

Post by Marvin Martian » Tue, 22. Nov 16, 17:25

.primarypurpose is invalid

.purposename returs for everything "Fracht" (since 4 some strings get converted into translated text like factionnames instead of faction.factionid - thats not good in every situation), except of builderships here any longer string gets returned
but that also not match to (for example) objectpurpose.trade or objectpurpose.{$macro.purposename} as it looks like

.purposemacro also not really helpfull and returns in case a storage_macro (fuelstorage maybe :P)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Tue, 22. Nov 16, 18:19

ok, just could check: a macro doesnt have primarypurpose, that one is only available to objects. you could create a temp object in a presentation cluster to check it (that would be cleaner than your method, but is also a workaround - and dont worry about leaving data behind, presentation clusters must explicitly set to be persistent or they wont make it into the savegame and clean themselves up)

and i wonder what you want to achieve? why cannt you use a live object but you have to depend on a macro? (i guess its for the independent factions for the CWIR follow-up? )
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

User avatar
Marvin Martian
Posts: 2602
Joined: Sun, 8. Apr 12, 09:40

Post by Marvin Martian » Wed, 23. Nov 16, 09:22

in that case i want to select a macro from the shipyard macrolist, so i can't create each time >20 Ships only to check what primarypurpose they have

ok, i could work with lists like a boss, but because of the dickey XR.exe with here potential DEP 3,5GB cap i'd like to reduce such data graves

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13817
Joined: Sun, 20. Nov 05, 23:45

Post by UniTrader » Wed, 23. Nov 16, 21:02

ah, ok.. you want to order fitting ships from a Shipyard..
well, instead of creating them you could also search for them in the existent universe.. doesnt cost as much memory, but a few more cpu cycles instead.. and use creation as fallback..

example code:

Code: Select all

        <create_presentation_cluster name="$tempcluster"/>
        <find_zone name="$tempzone" space="$tempcluster"/>
        <do_all exact="$macrolist.count" counter="$i" reverse="true">
          <find_ship name="$tempship" macro="$macrolist.{$i}" space="$station.cluster" multiple="false"/>
          <do_if value="not $tempship.exists">
            <create_ship name="$tempship" macro="$macrolist.{$i}" zone="$tempzone"/>
          </do_if>
          <set_value name="$purpose" exact="$tempship.primarypurpose"/>
          <!-- you get the purpose for every Ship here - either filter the macrolist here by removing unfitting entries or save the result for later usage -->
        </do_all>
        <destroy_object object="$tempcluster"/>
        <remove_value name="$tempzone"/>
        <remove_value name="$tempship"/>
only works in MD though since AI cannt create clusters. there somewhere in the existent universe has to be used...
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

lqvinh
Posts: 74
Joined: Sun, 1. Dec 13, 10:17

Post by lqvinh » Mon, 16. Jan 17, 11:01

Hi,

Where do you all find those functions for modding (e.g. find_zone, create_ship,...) ?

And how do you change Update trade offers of stations by fly by them?

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

Post by alexalsp » Tue, 17. Jan 17, 14:06

Good afternoon, everybody. Long I thought where to write, and decided to write on this topic.

I use mod for placing the station, in Albion, at the start of a new game.

Simply show the video. To attach two videos with a bug.

1) Ship builder disappears.
2) All the dismissed NPC, located in the administrative dock.

1) https://youtu.be/X2eTSHye7O8

2) https://youtu.be/w2Q8JRUXIGU

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mdscript name="two_stations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
		
		<cue name="station_1">
			
      <conditions>
        <event_cue_signalled cue="md.Setup.GameStart" /> 
      </conditions>

			<actions>
	
		<find_zone name="$BuildZone" macro="macro.tzoneCluster_B_Sector07_Zone02_macro" required="true"/>
		    <create_station name="$Station" macro="macro.struct_bt_alb_fuelstation_macro" zone="$BuildZone" owner="faction.player">
             <position x="14502.0" y="0" z="27705.0"/>

			 <buildsequence sequence="'a'" stage="1"/>
			 <buildsequence sequence="'a'" stage="2"/>
			 <buildsequence sequence="'a'" stage="3"/>
			 <buildsequence sequence="'a'" stage="4"/>
			 <buildsequence sequence="'b'" stage="1"/>
			 <buildsequence sequence="'b'" stage="2"/>
			 <buildsequence sequence="'b'" stage="3"/>
			 <buildsequence sequence="'b'" stage="4"/>
			 <buildsequence sequence="'b'" stage="5"/>
			 <buildsequence sequence="'c'" stage="1"/>
			 <buildsequence sequence="'c'" stage="2"/>
			 <buildsequence sequence="'c'" stage="3"/>
			 <buildsequence sequence="'c'" stage="4"/>
			 <buildsequence sequence="'d'" stage="1"/>
			 <buildsequence sequence="'d'" stage="2"/>
			 <buildsequence sequence="'d'" stage="3"/>
			 <buildsequence sequence="'d'" stage="4"/>
			 <buildsequence sequence="'e'" stage="1"/>
			 <buildsequence sequence="'e'" stage="2"/>
			 <buildsequence sequence="'f'" stage="1"/>
			 <buildsequence sequence="'f'" stage="2"/>
			 <buildsequence sequence="'f'" stage="3"/>
			 <buildsequence sequence="'g'" stage="1"/>
			 <buildsequence sequence="'g'" stage="2"/>
			 <buildsequence sequence="'h'" stage="1"/>
			 <buildsequence sequence="'i'" stage="1"/>	
         </create_station>

		 <find_dock_location name="$AdminDock" container="$Station" multiple="false" dockpopulationtype="dockpopulationtype.administrative" />
              <create_platform_actor name="$Manager" type="entitytype.manager" dockingbay="$AdminDock.component" ref="manager_omicron_lyrae_random">
                <owner exact="faction.player"/>
				<skills>
                  <skill type="boarding" min="3" max="4" />
                  <skill type="combat" min="3" max="5" />
                  <skill type="engineering" min="3" max="5" />
                  <skill type="leadership" min="5" max="5" />
                  <skill type="management" min="5" max="5" />
                  <skill type="morale" min="5" max="5" />
                  <skill type="navigation" min="5" max="5" />
                  <skill type="science" min="5" max="5" />
                  </skills>
              </create_platform_actor>
              <create_platform_actor name="$DefenceNPC" type="entitytype.defencecontrol" dockingbay="$AdminDock.component" ref="fighter_omicron_lyrae_random">
                <owner exact="faction.player"/>
				<skills>
                   <skill type="boarding" min="4" max="4" />
                   <skill type="combat" min="5" max="5" />
                   <skill type="engineering" min="2" max="5" />
                   <skill type="leadership" min="5" max="5" />
                   <skill type="management" min="1" max="4" />
                   <skill type="morale" min="5" max="5" />
                   <skill type="navigation" min="1" max="4" />
                   <skill type="science" min="5" max="5" />
                   </skills>
              </create_platform_actor>
              <assign_trade_manager object="$Station" actor="$Manager"/>
              <assign_defence_manager object="$Station" actor="$DefenceNPC"/>
              <set_actor_account actor="$Manager" />
              <start_script object="$Manager" name="'trade.station.player'"/>
              <start_script object="$DefenceNPC" name="'fight.station.player'"/>            

		<!-- add engineer -->

              <create_platform_actor name="$engineer" type="entitytype.engineer" dockingbay="$AdminDock.component" ref="engineer_albion_random">
                <owner exact="faction.player"/>
			 <skills>
				<skill type="boarding" exact="1"/>
				<skill type="combat" exact="3"/>
				<skill type="engineering" exact="5"/>
				<skill type="leadership" exact="2"/>
				<skill type="management" exact="4"/>
				<skill type="morale" exact="4"/>
				<skill type="navigation" exact="3"/>
				<skill type="science" exact="5"/>
			 </skills>
              </create_platform_actor>
			<set_entity_type entity="$engineer" type="entitytype.engineer"/>
			<assign_engineer actor="$engineer" object="$Station"/>
			<set_value name="$engineer.$control"/> 
            <start_script object="$engineer" name="'engineer.ai'"/>

             <create_platform_actor name="$Actor" dockingbay="$AdminDock.component" type="entitytype.specialistpowerstorage"> 
               <owner exact="faction.player"/> 
                <select faction="[faction.plutarch,faction.heartofalbion,faction.argongovernment,faction.canteran,faction.jonferson,faction.familyryak,faction.teladi].random" tags="tag.specialistpowerstorage"/> 
                   <skills> 
                       <skill type="boarding" min="1" max="1" /> 
                       <skill type="combat" min="2" max="2" /> 
                       <skill type="engineering" min="5" max="5" /> 
                       <skill type="leadership" min="4" max="4" /> 
                       <skill type="management" min="5" max="5" /> 
                       <skill type="morale" min="4" max="4" /> 
                       <skill type="navigation" min="3" max="3" /> 
                      <skill type="science" min="2" max="2" /> 
                  </skills> 
            </create_platform_actor> 
       <assign_control_entity  actor="$Actor" object="$Station"/>
	   <set_skills_visible entity="$Actor" visible="true" /> 

			<!-- Дроны для защиты станции -->		 

            <set_value name="$Unitcapacity" exact="$Station.units.maxcount" />
			<add_units object="$Station" category="unitcategory.welder" mk="1" exact="0.2*$Unitcapacity" /> 
			<add_units object="$Station" category="unitcategory.transport" mk="1" exact="0.2*$Unitcapacity" />  
			<add_units object="$Station" category="unitcategory.defence" mk="2" exact="0.15*$Unitcapacity" />  
			<add_units object="$Station" category="unitcategory.defence" mk="4" exact="0.15*$Unitcapacity" />  
			<add_units object="$Station" category="unitcategory.defence" mk="6" exact="0.15*$Unitcapacity" />  
		
			
			<!-- Затариваем станцию товаром -->		 
			<add_default_production_wares object="$Station" lowerlimit="80" upperlimit="95"/> 
            <add_ammo object="$Station" macro="macro.missile_turret_dumbfire_macro" amount="1000" />			



         </actions>
        </cue>

	 </cues> 
</mdscript>

Post Reply

Return to “X Rebirth - Scripts and Modding”