delayed jobs

The place to discuss scripting and game modifications for X4: Foundations.

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

Post Reply
Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

delayed jobs

Post by Malchar » Wed, 4. May 22, 15:26

Hi

It is obvious that, with time, player s power increase while factions stagnates.

Is it possible to script delayed jobs in jobs file ? For exemple a job which will not be active at start and ''wake up'' after a certain delay. Something else may be ?

If it cant be done in jobs file, is there a known trick to script it elsewhere ?

Dr Reed
Posts: 76
Joined: Fri, 30. Nov 18, 00:05
x4

Re: delayed jobs

Post by Dr Reed » Fri, 6. May 22, 17:45

There are a couple of ways of doing this,

One is to set a timer in the job which says when the ships will start to spawn. e.g.

Code: Select all

  <job id="timed_argon_dronecarrier_patrol_m_sector" name="{20204,5001}" >
    <modifiers commandeerable="true"/>
    <orders>
      <order order="Patrol" default="true">
        <param name="range" value="class.sector"/>
      </order>
    </orders>
    <category faction="argon" tags="[factionlogic, military, frigate]" size="ship_m"/>
    <quota galaxy="8" maxgalaxy="20" sector="2"/>
    <time start="1800"  interval="60"/>
    <location class="galaxy" macro="xu_ep2_universe_macro" faction="argon" relation="self" comparison="exact"/>
    <environment buildatshipyard="true"/>
    <ship>
      <select faction="argon" tags="[military, frigate]" size="ship_m"/>
      <loadout>
        <level min="0.4" max="1.0"/>
      </loadout>
      <units>
        <unit category="unitcategory.defence" min="8" max="12"/>
      </units>
      <owner exact="argon" overridenpc="true"/>
    </ship>
  </job>
  
You can mess around with the timer settings or instead of using the time command you can just call the job/jobs from a script by first setting the Job to inactive then calling it from a script,

Code: Select all

  <job id="timed_argon_dronecarrier_patrol_m_sector" name="{20204,5001}" startactive=false">
  
then calling the job from a script using

Code: Select all

<set_job_active job="'timed_argon_dronecarrier_patrol_m_sector'" />
 
hope this helps.

Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

Re: delayed jobs

Post by Malchar » Sun, 8. May 22, 20:10

Thanks for the answer Dr Reed.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: delayed jobs

Post by BlackRain » Tue, 10. May 22, 01:03

It isn't that simple. Yes, you can activate jobs on a timer, but the issue is that they won't always get built. I played around with it a lot when I was initially making FOCW but I decided to go a different way with forcing ships to get built. I noticed that even though I was activating the jobs, they wouldn't necessarily be built. I think there is something hardcoded that basically cancels ship orders if the shipyards are not often well stocked which usually happens often and then you have a universe with fewer and fewer ships. I don't know exactly though, this is just some speculation from my own experience.

Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

Re: delayed jobs

Post by Malchar » Tue, 10. May 22, 18:10

Interresting feedback Blackrain.

Otherwise, what means interval="60". Is it a mandatory parameter ?

KalisaFox
Posts: 174
Joined: Sun, 4. Aug 13, 05:58
x4

Re: delayed jobs

Post by KalisaFox » Thu, 12. May 22, 22:39

Question related to this, instead of tieing it to time, is it possible to tie jobs to certain plots? examples would be segaris pioneers when they finish with Terra Nova, or with the yaki. In effect delaying jobs but instead of timer, tieing it to certain progress of the player.

Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

Re: delayed jobs

Post by Malchar » Thu, 12. May 22, 22:57

For interval I will presume the job will be check every 60 minutes.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: delayed jobs

Post by BlackRain » Fri, 13. May 22, 00:51

KalisaFox wrote:
Thu, 12. May 22, 22:39
Question related to this, instead of tieing it to time, is it possible to tie jobs to certain plots? examples would be segaris pioneers when they finish with Terra Nova, or with the yaki. In effect delaying jobs but instead of timer, tieing it to certain progress of the player.
Yes, you can tie job activation to plots, etc. However, I still question how good the game rebuilds its ships. Hence the reason I made FOCW. In a vanilla game, I always felt that ships decrease over time and don't ever seem to reach the same levels as when the game first started. I don't know 100% yet why this is. It seems that those ships are activated when the game starts but then after that it relies on md scripts to order ships when needed. It may be that the jobs only get activated once or something else going on as I mentioned in my prior post.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: delayed jobs

Post by BlackRain » Fri, 13. May 22, 00:52

Malchar wrote:
Thu, 12. May 22, 22:57
For interval I will presume the job will be check every 60 minutes.
It should be seconds I think but you can set it up to be minutes or seconds.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

Re: delayed jobs

Post by DeadAirRT » Fri, 13. May 22, 03:05

BlackRain wrote:
Fri, 13. May 22, 00:51
KalisaFox wrote:
Thu, 12. May 22, 22:39
Question related to this, instead of tieing it to time, is it possible to tie jobs to certain plots? examples would be segaris pioneers when they finish with Terra Nova, or with the yaki. In effect delaying jobs but instead of timer, tieing it to certain progress of the player.
Yes, you can tie job activation to plots, etc. However, I still question how good the game rebuilds its ships. Hence the reason I made FOCW. In a vanilla game, I always felt that ships decrease over time and don't ever seem to reach the same levels as when the game first started. I don't know 100% yet why this is. It seems that those ships are activated when the game starts but then after that it relies on md scripts to order ships when needed. It may be that the jobs only get activated once or something else going on as I mentioned in my prior post.
has to do with the ships spawning up to galaxy even if it doesn't meet all requirements I think

Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

Re: delayed jobs

Post by Malchar » Fri, 13. May 22, 04:48

It should be seconds I think but you can set it up to be minutes or seconds.
So I can presume the delay is also in seconds.
I still question how good the game rebuilds its ships. Hence the reason I made FOCW. In a vanilla game, I always felt that ships decrease over time and don't ever seem to reach the same levels as when the game first started. I don't know 100% yet why this is
You speak about normal jobs ? or jobs you created and which were supposed to activate under special conditions ?

If it is normal jobs, for what I experienced, and as long as owner have enough facilities and ressources, it stay stable. At least it stay stable for games I use to play and which dont excees 200 to 250 hours.

Testing mods, involving xenons as important criteria, I use to save regulary, then edit the save and count the number or K and I. One of the last exemple I have gave this result.

Hour 9 ; 11 I 75 K
hour 27 ; 11 I 92 K
Hour 55 ; 11 I 92 K
hour 85 ; 11 I 89 K
Hour 118 ; 11 I 86 K
hour131 ; 11 I 89 K
hour154 ; 11 I 89 K

In this game xenon were in fast expansion during the first two days, then it slowdown up to a stagnante situation. It means roughly that their facilities and supply lines had never be threatened. At least 2 I and a dozen of k were set to stay in sector and not allowed to leave.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: delayed jobs

Post by BlackRain » Sat, 14. May 22, 01:02

DeadAirRT wrote:
Fri, 13. May 22, 03:05
BlackRain wrote:
Fri, 13. May 22, 00:51
KalisaFox wrote:
Thu, 12. May 22, 22:39
Question related to this, instead of tieing it to time, is it possible to tie jobs to certain plots? examples would be segaris pioneers when they finish with Terra Nova, or with the yaki. In effect delaying jobs but instead of timer, tieing it to certain progress of the player.
Yes, you can tie job activation to plots, etc. However, I still question how good the game rebuilds its ships. Hence the reason I made FOCW. In a vanilla game, I always felt that ships decrease over time and don't ever seem to reach the same levels as when the game first started. I don't know 100% yet why this is. It seems that those ships are activated when the game starts but then after that it relies on md scripts to order ships when needed. It may be that the jobs only get activated once or something else going on as I mentioned in my prior post.
has to do with the ships spawning up to galaxy even if it doesn't meet all requirements I think
I am not so sure about that. I haven't played vanilla in a very long time and haven't played without FOCW in a long time, but I remember that as the game progressed, the number of ships steeply decreased. I mean it may be that maxgalaxy sets a maximum allowed, but it seemed as if it never reached those numbers. This led me to believe there might be something else at play. For example, ship ordered being canceled due to some other reasons. Like I said, it is why I force ships to be built in FOCW using a somewhat unintended way of doing things. Just setting it to activate and setting a max galaxy always gave me problems before I started forcing ships to be built. I could be wrong though and maybe things have changed or there is some other explanation. I don't have the time to do more testing.

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: delayed jobs

Post by BlackRain » Sat, 14. May 22, 01:06

Malchar wrote:
Fri, 13. May 22, 04:48
It should be seconds I think but you can set it up to be minutes or seconds.
So I can presume the delay is also in seconds.
I still question how good the game rebuilds its ships. Hence the reason I made FOCW. In a vanilla game, I always felt that ships decrease over time and don't ever seem to reach the same levels as when the game first started. I don't know 100% yet why this is
You speak about normal jobs ? or jobs you created and which were supposed to activate under special conditions ?

If it is normal jobs, for what I experienced, and as long as owner have enough facilities and ressources, it stay stable. At least it stay stable for games I use to play and which dont excees 200 to 250 hours.

Testing mods, involving xenons as important criteria, I use to save regulary, then edit the save and count the number or K and I. One of the last exemple I have gave this result.

Hour 9 ; 11 I 75 K
hour 27 ; 11 I 92 K
Hour 55 ; 11 I 92 K
hour 85 ; 11 I 89 K
Hour 118 ; 11 I 86 K
hour131 ; 11 I 89 K
hour154 ; 11 I 89 K

In this game xenon were in fast expansion during the first two days, then it slowdown up to a stagnante situation. It means roughly that their facilities and supply lines had never be threatened. At least 2 I and a dozen of k were set to stay in sector and not allowed to leave.
Yeah but you can't use Xenon as an example because their economy functions completely different from the npc factions. They only need to build their own ships and they can more easily stock their shipyards. Also, it depends on whether fleets are being destroyed or not. If it is a mostly stale game, there wouldn't be many getting destroyed so the numbers might stay stable. However, with factions like Paranid and HOP constantly at war, the numbers never seem to get back to what they were at the beginning. I mean, maybe things have changed a lot since I tested that though and it might be different now. When I was first making FOCW and using the normal way of jobs, hardly any ships were built from the ones I added.

Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

Re: delayed jobs

Post by Malchar » Sat, 14. May 22, 01:27

I paid attention for xenons, because they are the only one it is important to check.

There is players 's shipyard to supply NPC s factions with ships. These factions just print money without out limit and pick up their ship from the player. You can say and what about factions who are not friendly with players ? --> Most players seems to like easy game, so I thinks ennemies factions would have trouble and it will satisfy players :twisted: Anyway players make the sun shine or make it rain, usually at day 4 or 5, so it dont change a lot of things.
They only need to build their own ships and they can more easily stock their shipyards.
I m not sure about that. How many time have we see xenoos send all their mining ships to suicide, trying to cross or mine in ennemy sectors, until all raw was wasted in the shipyard and xenons will be unable to build miner type S anymore ? Result is usually fade and death after that.

If I cross what you experienced ; ships decline for normal npc faction, and what I experienced with xenons ships, it seems the problen, could be related to a lack of ressources, no ? Usually in my games npc shipyard are in constant shortage of hull parts, then turrets components, weapons coponents and advanced electronic.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

Re: delayed jobs

Post by DeadAirRT » Sat, 14. May 22, 03:41

BlackRain wrote:
Sat, 14. May 22, 01:02
I am not so sure about that. I haven't played vanilla in a very long time and haven't played without FOCW in a long time, but I remember that as the game progressed, the number of ships steeply decreased. I mean it may be that maxgalaxy sets a maximum allowed, but it seemed as if it never reached those numbers. This led me to believe there might be something else at play. For example, ship ordered being canceled due to some other reasons. Like I said, it is why I force ships to be built in FOCW using a somewhat unintended way of doing things. Just setting it to activate and setting a max galaxy always gave me problems before I started forcing ships to be built. I could be wrong though and maybe things have changed or there is some other explanation. I don't have the time to do more testing.
Galaxy is the number they try to maintain, not maxgalaxy. Maxgalaxy defaults to 2x galaxy if not set. Any ships above galaxy will move.die after some time and are only ever ordered when logic orders them via the factionlogic tag.

DeadAirRT
Posts: 1008
Joined: Fri, 25. Jan 19, 03:26
x4

Re: delayed jobs

Post by DeadAirRT » Sat, 14. May 22, 03:45

Malchar wrote:
Sat, 14. May 22, 01:27
There is players 's shipyard to supply NPC s factions with ships. These factions just print money without out limit and pick up their ship from the player. You can say and what about factions who are not friendly with players ? --> Most players seems to like easy game
With that, I'm out of this thread. Good luck.

Malchar
Posts: 395
Joined: Wed, 7. Apr 21, 00:56
x4

Re: delayed jobs

Post by Malchar » Sat, 14. May 22, 07:46

DeadAirRT wrote:
Sat, 14. May 22, 03:45
With that, I'm out of this thread. Good luck.
I would have regret it, if you had ever been helpful. Have a good day.

Post Reply

Return to “X4: Foundations - Scripts and Modding”