[MOD] Astromech Droids (s + m ships self repair) (10th Jan '15)

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

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

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

Post by Marvin Martian » Sun, 6. Dec 15, 20:02

i do it this way on my Repairservice mod

Code: Select all

	  <do_if value="not this.ship.engineer.exists">
		  <create_engineer name="$engineer" ship="this.ship">
			  <select race="race.argon" tags="tag.engineer"/>
			  <owner exact="this.ship.owner"/>
		  </create_engineer>
	  </do_if>
	  <do_if value="this.ship.engineer.exists">
		  <start_script object="this.ship.engineer" name="'engineer.ai.plus'"/>
	  </do_if>

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Sun, 6. Dec 15, 20:16

Addendum :

Changing the engineer check to 30s on my current gaming box (i7 6700k+980ti) i didnt see any spikes in cpu usage running vanilla 4.0b3 with this mod only active. Cpu use stayed at 6.5-7% for a full minute watching the taskmanager.

If anyone would like to test this out then replace AddSmallShipEngineers.xml contents :

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<mdscript name="AddSmallShipEngineer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <!-- main cue to add the engineer as create_ship will refuse this on non capital ship types -->
    <cue name="Yorrick_AddEngineer" instantiate="true" namespace="this">
      <conditions>
        <event_cue_signalled/>
      </conditions>
      <actions>
        <set_value name="$Ship" exact="event.param"/>

        <do_if value="$Ship.engineer" negate="true">
          <create_cue_actor name="$engineer" cue="this">
            <!-- this controls visible or invisible engineer. Any faction but xenon makes the engineer a visible listed crew member -->
            <select faction="faction.plutarch" tags="tag.engineer"/>
            <!-- then set the computer/crewman to belong to the ships owner faction-->
            <owner exact="$Ship.owner" />
          </create_cue_actor>
          <set_entity_type entity="$engineer" type="entitytype.engineer" />
        </do_if>
        <do_if value="$engineer?">
          <assign_engineer object="$Ship" actor="$engineer" />
          <do_if value="$engineer.container">
            <start_script object="$engineer" name="'engineer.ai'" />
          </do_if>

          <!--<remove_cue_actor actor="$engineer" cue="this" />
          <remove_value name="$engineer" />-->
        </do_if>
      </actions>
    </cue>
    
    <!-- cover existing games and job ship spawns  -->
    <cue name="Yorrick_AddEngineer_ExistingShips" instantiate="true" namespace="this">
      <conditions>
        <check_any>
          <event_game_loaded />
          <event_cue_signalled cue="md.Setup.GameStart"/>
        </check_any>
      </conditions>
      <actions>
        <debug_text text="'Starting timed cue for astromechs.'" filter="error" chance="100"/>

        <set_value name="$NextCheck" exact="player.age+10s"/>
      </actions>
      <cues>
        <cue name="Yorrick_AddEngineer_TimedCheck" checkinterval="30s">
          <conditions>
            <check_value value="$NextCheck lt player.age" />
          </conditions>
          <actions>
            <debug_text text="'Testing timed cue for astromechs.'" filter="error" chance="0"/>
            <find_ship groupname="$SMShips" multiple="true" class="[class.ship_s,class.ship_m]" space="player.galaxy"/>
            <do_all exact="$SMShips.count" counter="$i" >
              <do_if value="$SMShips.{$i} != player.primaryship">
                <debug_text text="'calling cue to add astromechs.'" filter="error" chance="0"/>
                <signal_cue_instantly cue="Yorrick_AddEngineer" param="$SMShips.{$i}"/>
              </do_if>
            </do_all>
            
            <set_value name="$NextCheck" exact="player.age+30s"/>
            <reset_cue cue="Yorrick_AddEngineer_TimedCheck"/>
          </actions>
        </cue>
      </cues>
    </cue>
  </cues>
</mdscript>
For reference the current AI repairs to 60% base with 0 start engineer up to 90% with 5 star.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Sun, 6. Dec 15, 20:20

@Marvin didn't see your post until after the addendum.

Interesting, the documentation for create_engineer states that it is not functional for any but l + xl ships. Guess the actual usuage has changed? Nice to know, will test it unless you are releasing another mod to do the same thing :)
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti » Tue, 1. Mar 16, 14:20

Update for this greatly needed. I'd like the skunk and mah small ships to fix themselfs slowly.

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Tue, 1. Mar 16, 15:00

Will take a look at what's needed. I guess I can just pop up a disclaimer about performance issues on lower end cpus.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
Nikola515
Posts: 3187
Joined: Fri, 4. May 12, 07:40
x4

Post by Nikola515 » Tue, 8. Mar 16, 00:42

Hey Yorrick nice mod as always ;) Do you think it would be good idea to move fixing from 75 to 90% ? They get damaged so easily and 90% would give them better fighting chance... And less micromanaging and fixing them in shipyards ? Anyway 75% is still better than nothing :D
It's not world hunger because we can't feed poor,it's because there will never be enough to feed the rich .....

User avatar
Nikola515
Posts: 3187
Joined: Fri, 4. May 12, 07:40
x4

Post by Nikola515 » Thu, 17. Mar 16, 18:38

Hey is this mod still on Steam ? I looked it up but I cant find it anywhere on workshop ?????
It's not world hunger because we can't feed poor,it's because there will never be enough to feed the rich .....

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Fri, 18. Mar 16, 11:31

Less laggy version up soon(tm)
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Post by swatti » Sun, 27. Mar 16, 18:29

Please tell me the skunk can auto-repair too!

Post Reply

Return to “X Rebirth - Scripts and Modding”