Overwriting scripts
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Overwriting scripts
hi,
im new to this, but read tutorials etc. I'm trying to modify the mining.collect.drone.xml script, to fix some mining drone faults on player ships.
I made a new version of this script and put it into Extensions/mymod/aiscripts. Content.xml is correct and the extensions is shown in settings.
But somehow the new script seems not to be executed. To test, (bad tast method) i added at start label <destroy_object object="this.ship" explosion="true" />
so every mining drone should explode, but nothing happens.
Looks like i'm on a wrong way. Any ideas?
im new to this, but read tutorials etc. I'm trying to modify the mining.collect.drone.xml script, to fix some mining drone faults on player ships.
I made a new version of this script and put it into Extensions/mymod/aiscripts. Content.xml is correct and the extensions is shown in settings.
But somehow the new script seems not to be executed. To test, (bad tast method) i added at start label <destroy_object object="this.ship" explosion="true" />
so every mining drone should explode, but nothing happens.
Looks like i'm on a wrong way. Any ideas?
Re: Overwriting scripts
If a script is already running then a new version will not do anything. Try to purchase a miner or at least a few mining drones. Your script should run on those.
Cheers Euclid
Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Re: Overwriting scripts
Thank you! But after trying many things, it still doesn't work. I did read, there is a console command to reload ai scripts, could this reduce testing time?
Another question: i did manage to create logs of the game, but there are no script entries visible, is for default scripts debug_to_file needed?
For existing log commands in scripts like <debug_text text="'input destination, %s %s %s, does not exist.'.[$destination.{1}.class, $destination.{1}.knownname, $destination.{1}]" filter="error"/>
where goes this "debug_text" in which file?
Another question: i did manage to create logs of the game, but there are no script entries visible, is for default scripts debug_to_file needed?
For existing log commands in scripts like <debug_text text="'input destination, %s %s %s, does not exist.'.[$destination.{1}.class, $destination.{1}.knownname, $destination.{1}]" filter="error"/>
where goes this "debug_text" in which file?
Re: Overwriting scripts
Scripts run on NPCs, board computers etc. and leave a corresponding trace in you saved game. To run a modified script you would need to restart the existing. For example, if you run a script on the captain of a ship you need to stop it and then start it again. This can be tricky in your case as the mining script is running on many NPCs.
Concering the debug output, you should find it in the document folder where your saved games are stored. Personally I prefer the "debug_to_file" command as it provides a better overview. For example
which is executed over a loop over "$k". It will generate a directory "Euclid" in the debug folder with a file "$name" and append all outputs into it. However, in any case you need an extended executable to enable the debug output which should look like this
Hope that helps,
Cheers Euclid
Concering the debug output, you should find it in the document folder where your saved games are stored. Personally I prefer the "debug_to_file" command as it provides a better overview. For example
Code: Select all
<debug_to_file name="$name" directory="'Euclid'" text="'Number of Stations:' + $Twares.count + ' faction:' + $factions.{$k} " output="false" append="true" />
Code: Select all
"E:\Games\Steam\SteamApps\common\X4 Foundations\X4.exe" -logfile debuglog.txt -scriptlogfiles
Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Re: Overwriting scripts
Did you format the edited script as a full replacement diff patch?
Re: Overwriting scripts
Oh no, i didnt use the diff style. Sorry for asking a question that is discussed here for years. I said i'm new to it
With diff i could replace the whole script with my version, drones are exploding like fireworks now
Now i can debug why sometimes drones disappear when they try to land on an occupied pad.
With diff i could replace the whole script with my version, drones are exploding like fireworks now
Now i can debug why sometimes drones disappear when they try to land on an occupied pad.
Re: Overwriting scripts
Thank you for your help, i found the reason for the bug, why mining drones sometimes vanish (from ship inventory too) whey they land on a captial ship pad.
This happens when the ship is player controlled.
I'm not sure how to properly fix it, should i start new thread about this or discuss it here?
This happens when the ship is player controlled.
I'm not sure how to properly fix it, should i start new thread about this or discuss it here?
Re: Overwriting scripts
If it's an issue with a vanilla game then you should post a bug report it in the Public Test Forum. But please follow the formal requirements (game version, steps to reproduce etc.). Otherwise feel free to open a new post here.
Cheers Euclid
Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Re: Overwriting scripts
There are now other people discovered this bug:
https://www.reddit.com/r/X4Foundations/ ... ng_in_410/
I got a fix for that (not sure i did it the properly way) so i'll post it as mod.
https://www.reddit.com/r/X4Foundations/ ... ng_in_410/
I got a fix for that (not sure i did it the properly way) so i'll post it as mod.