[Work In Progress] Functional Trader + stable supply/demand (0.22 final WIP)

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

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

User avatar
ThalonMook
Posts: 1296
Joined: Tue, 3. Feb 04, 12:11
x4

Post by ThalonMook »

Hi,

I use V 20 with 1.18 Beta when I installed it the Game will crash.

I put the -prefersinglefiles into the loadcommands

Have I use the older verions first or is there all in the 20?

I don't use a fresh game I play the plot and use a save game cause I don't want to restart the game over and over :-)

I tryed out the V 15 and it will start without a crash.


CU
Thalon
User avatar
Stealthman
Posts: 30
Joined: Wed, 25. Feb 04, 13:10
x3tc

Post by Stealthman »

ThalonMook wrote:Hi,

I use V 20 with 1.18 Beta when I installed it the Game will crash.

I put the -prefersinglefiles into the loadcommands

Have I use the older verions first or is there all in the 20?

I don't use a fresh game I play the plot and use a save game cause I don't want to restart the game over and over :-)

I tryed out the V 15 and it will start without a crash.


CU
Thalon

Try a new game and see if it still crashes.
Oh and have you any other mods installed?
Show me your skills please...
no seriously, show me your skills, now!
--------------------------------------------------
Welcome to Forums: You will never find a more wretched hive of scum and villainy. We must be cautious.
User avatar
ThalonMook
Posts: 1296
Joined: Tue, 3. Feb 04, 12:11
x4

Post by ThalonMook »

Hi,

with a new game it will not crash.

Yes I have some mods installed.

It seems I have to start a new game if I want to use this version 20 :-(

CU
Thalon
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

Yes, as i said, the WIP make no effort to be compatible for old saves. The real mod will be compatible with vanilla, but thats a lot of work just to achieve.
whitehall1212
Posts: 4
Joined: Tue, 26. Nov 13, 17:58

Post by whitehall1212 »

jey thank you so much for your time and effort on this WIP and the others mods you have already created.
I would you ask is the WIP[ v20] better tested on 1.17 or 1.18 beta?
also with or with out mods? or add mods over the course of time into a new game to if any bad things happen re the mods you have added.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

I wouldnt recommend investing too much time until i make it in a real mod. Since each version can break the previous universe version (keeping compatibility on structural changes is complex and add a lot of crap to the code, which make testing implementation and the likes quite tedious).

Thats one of the main reason why i did not make it an official mod yet, once i do, ill have to keep save compatibility between the mod and vanilla and between the mod and any update.
spartanheyho
Posts: 162
Joined: Sun, 24. Nov 13, 16:06

Post by spartanheyho »

No offense to players but perhaps that may be asking too much from you? There is such a thing as getting burnt out ... and hardcore. Perhaps it is more realistic to simply maintain compatibility between each iteration of your mod and official updates? Here is to hoping I am wrong and being too negative but on the safe side I don't think its beneficial to have one of this communities stalwart champions and saviors burnt to a crisp from a never-ending blitz on making sure EVERYONE is happy. Just my 2 cents.
mrowka
Posts: 128
Joined: Tue, 30. Jun 09, 19:50
x4

Post by mrowka »

There is a workaround of making own commands and a loop that cancels any command that isnt tag as yours or needed, shouldnt break the game, this is just a theory thrugh :D
MK3 Optimization "If you get stinky rich its his fault"
IEX - Sector Visual Enhancement "Dont enjoy the view navigating thrugh asteroid field, Seriously!"
Marine Repair 2 "Tip 19: Modern coffie cup`s are made of hull plating, beware"
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

As for the testing. The wip version 20 is tested to work perfectly fine on both vanilla 1.17 and 1.18, it is a full replace of many files, so it might not play nice with mods touching any files provided in the archive. Altho the cleaned version wont have nearly as much files changed, mainly because, many are just debug traces used to help me track where stuff get stuck.
flatbush71

Post by flatbush71 »

Phase one of Crystal Plant complete.
Adding all weapons systems available at this point and moving on to Phase two.

Good Job J !!!

http://i690.photobucket.com/albums/vv26 ... c8e6d3.jpg
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

mrowka wrote:There is a workaround of making own commands and a loop that cancels any command that isnt tag as yours or needed, shouldnt break the game, this is just a theory thrugh :D
I'm not sure how i could go around doing that, i would need some way to retrieve the original params from trade.ship and then launch my own custom version of it. But i have no idea how to get the script name or the params value from an entity externally (command is not the script and could lead to serious issues if for whatever reason, another script decide to use the same command (like trade))
JamesJB
Posts: 358
Joined: Wed, 6. Nov 02, 20:31
x4

Post by JamesJB »

Hi is this the only one I need to download or do i need the others too?

http://www.jeypc.com/dl/tradeship_fix_wip_0.20.zip
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

the others are only here for people who had better success with them. You only need the most recent one (they all contain every files), altho if you installed an older one, i recommend deleting the aiscripts folder first.
noheton
Posts: 2
Joined: Fri, 29. Nov 13, 20:15
xr

Post by noheton »

Jey123456 wrote:the others are only here for people who had better success with them. You only need the most recent one (they all contain every files), altho if you installed an older one, i recommend deleting the aiscripts folder first.
Hi Jey,

First of all thanks for all your work. In X its always the modders who save the day. ;)

I know you said you did not care about savegame compatibility, but I would like to ask, if you know why saves from the old versions are not compatible with the new one. In my case if i delete the old aiscripts folder (all pck files) and replace it with the new 0.20 version the game crashes on load.

If you know any details i would love to try to fix them myself and might even implement a small cleaner tool (if it is as easy as deleting / modifing some xml tags from the savegame).

Thanks in advance.

Regards
noheton
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

you would need to bring all ai running trade.ship as a root script, back to trade.ship (instead of whatever subscript they are running). Offcourse, this could also break docked status and other things, but generally those fix themself over a few mins

If i could figure a way to read what scripts (scripts not command), an entity contain, i could make them all compatible using an md command that just restart everything when the version change. But i have yet to figure that out ><.



-= version 0.22 =-

http://www.jeypc.com/dl/tradeship_fix_wip_0.22.zip
* each trader now have a watcher that keep an eye on them, if they stop moving / executing trades attempt (frozen in whatever state) for more than 20 minutes, they get a force reset done on them, which should keep everything moving quite nicely (freezes are pretty rare now, since most are either handled by my changes with interrupts, or fixed with 1.18 beta), but well, a few still happen, and until i catch them all, that at least, let the universe run (and in debug, give me info on where the ai was frozen).
* player trade should now be fully functional. Altho still need some esthetic work (some dock are hard to reach using collision, so if they cant get to the park withing acceptable time (5mins once the docking actually start), they disable the collision and just get to the destination.
** fixed the docking, the notification and 3 different case of trading getting stuck.


- As with all my other WIP there is no garantee the save will be compatible, altho an universe from 0.20 should since most changes in between are compatible or player trade related (which you can generally reset easily by removing / adding to your squad).

The compatibility doesnt go the other way tho. a save from 0.22 definitly wouldnt work in 0.20, and chances are very high that vanilla universe wont work properly on it either (need a new game).

Assuming all the issues i wanted to fix are fixed (assuming player trade work properly, i did not test it extensively, only did a few transaction both while watching and while not watching).

Next step will be to finish the cleanup to make it compatible with vanilla.
Making it work when applied to a vanilla universe would be somewhat simple, but its a lot more complicated to go back to vanilla after (ill need to figure a way to catch command without using an npc communication kind of thing. Debug console maybe, no idea xD).
noheton
Posts: 2
Joined: Fri, 29. Nov 13, 20:15
xr

Post by noheton »

Jey123456 wrote:you would need to bring all ai running trade.ship as a root script, back to trade.ship (instead of whatever subscript they are running). Offcourse, this could also break docked status and other things, but generally those fix themself over a few mins

If i could figure a way to read what scripts (scripts not command), an entity contain, i could make them all compatible using an md command that just restart everything when the version change. But i have yet to figure that out ><.
So i am working on the aidirector tag - as far as i can tell, this is where the magic happens...

This is just a short snippet of one contained entity.

Code: Select all

<entity id="[0x38c24]">
<script id="1" name="engineer.ai" label="checkforrepair" time="132037" index="1">
<command type="repair"/>
<vars>
<value name="$NumofElements" type="integer" value="4"/>
<value name="$baserepairrate" type="integer" value="10"/>
<value name="$damagedelements" type="group" value="1031"/>
<value name="$debugoutputchance" type="integer"/>
<value name="$hulldamagelimit" type="integer" value="75"/>
<value name="$operationalelements" type="group" value="1032"/>
<value name="$repairfrequency" type="time" value="1"/>
<value name="$wreckedelements" type="list" value="713"/>
</vars>
</script>
</entity>
<entity id="[0x38c23]">
<script id="2" name="trade.ship" version="1" label="perform trade run" time="131214" index="5">
<command type="freetrade"/>
<vars>
<value name="$buyoffer"/>
<value name="$debugchance" type="integer"/>
<value name="$idletime" type="time" value="23.5075"/>
<value name="$range" type="component" value="[0x34714]"/>
<value name="$selloffer" type="trade" value="[0x2cd9]"/>
<value name="$success" type="integer" value="1"/>
<value name="$traderunscript" type="string" value="1739"/>
<value name="$warelist" type="list" value="1645"/>
</vars>
</script>
<script id="2985" name="trade.performtraderun" version="8" label="move to target object" time="131578" index="2">
<command type="trade">
<param type="component" value="[0x38ccc]"/>
</command>
<vars>
<value name="$amount" type="integer"/>
<value name="$buyoffer"/>
<value name="$debugchance" type="integer"/>
<value name="$debugchance2" type="integer"/>
<value name="$failreason" type="string" value="7036"/>
<value name="$maxamount" type="integer" value="10625"/>
<value name="$reserved" type="integer"/>
<value name="$selloffer" type="trade" value="[0x2cd9]"/>
<value name="$targetobject" type="component" value="[0x38ccc]"/>
<value name="$tradeoffer" type="trade" value="[0x2cd9]"/>
<value name="$tradeware" type="ware" value="refinedmetals"/>
</vars>
</script>
<script id="3119" name="move.park" label="start" time="131984" index="1">
<vars>
<value name="$debugchance" type="integer"/>
<value name="$debugchance2" type="integer"/>
<value name="$destination" type="component" value="[0x38ccc]"/>
<value name="$freeslot"/>
<value name="$parked"/>
<value name="$starttime" type="time" value="131578"/>
<value name="$tradeoffer" type="trade" value="[0x2cd9]"/>
</vars>
</script>
</entity>
In my opinion i think i would have to change someting in the

Code: Select all

<script id="2" name="trade.ship" version="1" label="perform trade run" time="131214" index="5">
...

and the

Code: Select all

<script id="2985" name="trade.performtraderun" version="8" label="move to target object" time="131578" index="2">
...
tags.
I am not yet sure if this one would be actually fine when upgrading ... I might have to find a list of subscripts of trade ship.

Btw, could you explain why in the old version there were pck (containing xml) files and in the new version its plain xml?

Thanks.

Regards
noheton
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

you would need to bring its position back to the begining (index0 would be enough probably), of trade.ship (cancelling any sub scripts since everything past trade.ship is overriden).

But the mission director doesnt seem to give me the list of script being ran in the entity, only the command (which isnt precise enough). I would need ideally, the root script (trade.ship in this case, alongside the params that were used to launch it).

The data is here, in the save, i just dont know how to access it from the mission director as of now
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

If everything else fails, it wouldn't be too hard to make a small utility that would edit a savefile.

It could even use the same syntax as the patch files, for example:

Code: Select all

<replace sel="//script[@name='engineer.ai'][@label="checkforrepair"]/@index">0</replace>
would set all indexes of engineer scripts whose last label was "checkforrepair" to the beginning of that label.


But I was thinking of something else, really.
If you want to make it so that you can remove a mod without problems, you have to check out the original ai file for all blocking actions and count them, identify the wait block for the main loop (as that is where you probably want to be as the safest place), then go to your script file and count the blocking calls. At the position of the wait of the original script you insert something like

<do_if value="global.$saferemove">
<wait exact="5h"/>
</do_if>

You could even insert some kind of counter that counts how many entities have gone into 'sleep mode', and compare it to the entities currently running (separate counter) and if all entities sleep, display a message that it's safe to shutdown now.

Sounds like a bit of a hassle compared to a simple "upgrade tool", but I think it would work.
Streaming while writing mods: twitch.tv/fumblesneeze
User avatar
Mokonzi
Posts: 928
Joined: Sat, 27. Mar 04, 09:15
x3tc

Post by Mokonzi »

I'm struggling to get anything to work with selling the plot items to stations... I've got the materials on board... couldn't get it to work with vanilla stuff on 1.17, and still not with this trading script installed.

Any suggestions?
User avatar
werewolves?
Posts: 1166
Joined: Tue, 31. Jan 12, 00:58
x4

Post by werewolves? »

Sweet the AI booster fix might be good for moving captured ships, just been watching my freighters sitting there getting shot to about 15% hull at a jump beacon before engaging booster and continuing their orders...

Return to “X Rebirth - Scripts and Modding”