[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

Igec
Posts: 11
Joined: Thu, 30. Oct 08, 04:11

Post by Igec » Sat, 28. Nov 15, 17:56

Hmmm yes... but where is the download link?

Would like to try it despite the lag mentioned...

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Sat, 28. Nov 15, 20:46

Fair point :) Re-added to steam workshop but not updated.

EDIT :

Quick test after enabling visible engineers (see inline comments) one small change is required to enable engineers for job spawns in 4.0b3 :

Code: Select all

 <!-- 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>
in AddSmallShipEngineer.xml

As the vanilla engineers now wait before starting repairs you will need to test properly to see if they are working fully and fixing hulls.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

Igec
Posts: 11
Joined: Thu, 30. Oct 08, 04:11

Post by Igec » Wed, 2. Dec 15, 18:30

I tried the mod and it works as intended(4.0.0. beta 3), but on the other side it is really a cause for lag, which is unbearable and i was forced to uninstall this great addition.

I hope you'll fix it.

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Wed, 2. Dec 15, 21:37

If I remember correctly, I think the problem was the engineer script simply being too resource-intensive to run on so many small ships? Solution could be to write a relatively simple version of the engineer script, and have the astromech droids run that. Not sure if that's the best solution, though.

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

Post by Marvin Martian » Thu, 3. Dec 15, 00:21

i think it would be better to make it similar to the MICT_supp8 that Capital-Engineers repair there subordinates, or use instead simply MICT_supp8

anyway, since the repairrate without drones is only 0.1, the repairspeed will be incredible slow for smallships too

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Thu, 3. Dec 15, 08:08

@Marv, thanks for the endorsement. MICT_supp8 won't work for wings of just small ships, though.

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Thu, 3. Dec 15, 14:47

The lag isn't entierly something I can change. The problem lies with job spawned ships (ie most of them). The create_ship command will not allow engineers to be placed on small/med ships and so the mod must scan every ship in the game every X seconds to make sure they are added. The best possible solution is to increase X atm since the changes made to the engineer ai are post release of this mod and prevent what is essentially engineer tanking. (Kinda like armour tank for you eve players where the repair rate mitigates incoming damage.) As the engineers will wait before attempting repair a new spawned job ship without an engineer added wont care much if it dies before said engineer could kick in anyway.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

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

Post by Marvin Martian » Thu, 3. Dec 15, 15:30

you could link into undock script to check if an engineer is available, because this will called from any pilot at starup

in that case it might be a good choice to make your own skript thats suits your needs
so you can make a wait order with interrupt when ship get attacked, or hull is low

or skip the engineer solution completely and add into the fighting skripts an handler that have the chance (depending on skills) to fix some systems in case the ship get damaged
but the only damage you get on smallships is hull in my opinion, because most systems invisible and hull-integrated, so you simply can push the shield once and make a withdraw (with new smallship boooooost) from battle (what requires access to the pilot behavior anyway, so <handler> would be better for this)

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Thu, 3. Dec 15, 20:50

I hadn't thought about it that way. Cheers Marvin will have a tinker when home tomorrow.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

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

Unfortunately it seems creating new npcs in aiscripts is a no go, although I may be missing something.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

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

Post by Marvin Martian » Sun, 6. Dec 15, 21: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: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Sun, 6. Dec 15, 21: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: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Sun, 6. Dec 15, 21: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: 1255
Joined: Sun, 7. Dec 03, 13:03
x4

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

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

User avatar
YorrickVander
Posts: 2672
Joined: Tue, 29. Oct 13, 22:59
x4

Post by YorrickVander » Tue, 1. Mar 16, 16: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.

Post Reply

Return to “X Rebirth - Scripts and Modding”