Nice catch to all you! Indeed there is a bug for the boron ray and earlking (and that could affect modded ships that follow the same weapons mechanics of those two) that I mistakenly introduced in the latest version when i upgraded for X4 7.10, I will resolve it when i will get my hands on X4 again! Unfortunately i were not active in the last month due to rl reasons and because i am focusing on update my Rule Village mod for minecraft bedrock!
Since I completely left this bug unattended, I thank you for your reports and especially Mexmarsouin28 that found a temporary solution which i quote for you:
in fight.attack.object.destroyers.anghelos.xml remove the entire first and only line :<shoot_at object="this.ship" target="$target" missiles="false" primary="true" secondary="true" tolerance="$ToleranceWeapon1" fixedtarget="false"/>
As said other times those event condition errors are not true, as those conditions, even not being event conditions, are actually calculated. Eliminating the conditions, or using similar (not equivalent, as there are none) event conditions to those will not produce the same results and the script will not work as intended. In this state, as v7.1 of x4 the scripts work instead. For Boron and ships of other mods main guns instead a tweak must be done, as explained in the sticky post, until i will fix this after i am finishing with my other project in mcpedl.
Maybe your idea was to trigger when target destroyed OR if distance to target > mingaindistance, BUT then question is how often this condition is checked? I think checked only in the begining of movement in next tick, but I could be wrong.
Because I can see in the doc https://wiki.egosoft.com/X%20Rebirth%20Wiki/Modding%20support/Mission%20Director%20Guide/
... If a condition uses an event, it must be in the first sub-node of the <conditions> node. It is even possible to define multiple alternative events that should activate the cue. The first sub-node should be <check_any> in this case, so only one of its sub-conditions has to be met.
So this really confuse me. Seriously, i'm trying to figure out how egosoft made the engine and when it will check your conditions. And I can't believe that the condition will be checked many times without event. If checked many times (every frame?) - than this is bug that egosoft can fix any time :D
Eliminating the conditions, or using similar (not equivalent, as there are none) ...
true, I tried to find way how to check every X milliseconds condition, but I cannot find this in aiscript. Also found event_object_approaching_waypoint, but this might not help you. probably egosoft didn't do this on purpose to avoid performance problems.
You've missed the part where the attack code is encapsuled in a while structure. How much often is a while structure executed at runtime with a "language" like html you tell me. What I can say is that very structure basically makes the code run in loop once the ship is in attack range until the conditions to abort it are satisfied. So yes, those non event conditions are not calculated responding to the event, but are surely calculated often due to the while structure, every time the while is reiterated. This is not an approach I invented, it's the very same approach that egosoft uses for its attack phase scripts, you can check for example the official fighters attack script. The while structure is also the reason for the bug with the boron ray projector and the use of the shoot_at_object method, because the looping is so fast that the AI triggers that method so many times that it doesn't allow the correct discharge of weapons that have a charge mechanism, while it's perfect for weapons that have "bullets" or impulses like the terran and argon main guns.
Regarding the need to "check a condition every x milliseconds" i am not able to give a perfect solution, but a workaround can be encapsuling your code and your conditions in a while struct and put a wait at the end of the while, so you have a an arbitrary pause between each reiteration of the while. Of course take in account how and when to abort the while structure. If I recall correctly, I did this in my script and this is also how egosoft pauses a little its while structures.
Regarding the first part about object destroyed, that event condition is able to break the while loop immediately within the very same iteration if the target is destroyed, this because we do not need the looping of the attack code anymore if we have no target. The non event conditions, like for example being in the mingaindistance, are instead evaluated every time the while structure is reiterated, but those within the the while structure usually do not break the looping, they are used to differentiate when holding position to fire, when to gain distance etc. Also there are conditions for the while structure itself that are evaluated before any new iteration and if false they will break it before even making a new iteration.
Finally ,to point the importance of those non event conditions in the practical simulation of X4, without those the destroyers would basically ram the target ship as they would never stop at a specified distance, they would still attack with the main guns like a fighter would. In fact the vanilla fighters in their attack script do not have any condition for distance to maintain as they can get very very close to their target when fighting. But we absolutely need this for destroyers and larger ships unless you like your cruisers to hug the enemy ships.
Hey there, awesome mod, destroyers really are much more deadly now. The issue I currently have is that my Rays shoot in very short bursts, almost like the ship captain lightly taps the trigger once in a while instead of holding it. I have VRO and your patch installed + X4 RE and your patch for the OTAS faction.
this is not a bug, I have the same, it happens because the weapon overheats, and the AI does not allow it to cool down, it just presses the trigger. if the developer reads this, fix this or tell me how to fix the code so that there is a delay before a new series of shots (vanilla)
Couldn't you increase the damage, and lower the rate of fire, so that it does the same burst/sustained damage, it just takes longer (allowing for heat to dissipate?)
nah, I don't think that's what's going on here. To me it looks like the pilot just spools up the laser with quick tapping and then doesn't hold the trigger when the weapon fires, making a little pew and starting a reload cooldown. I dug around in files a bit and I think the VRO patch doesnt really patch anything: it only contains one XML file patching the boron laser, and the only difference from the VROs patch of this weapon is that the reload time is increased from 4.1 to 8.1. I think the actual issue here is that the AI doesn't know how to hold the trigger and I have absolutely no idea how to fix this. Maybe you could make the laser into a one tap weapon which just shoots a beam and deals damage instantly and make the beam animation just stay longer after the weapon fired? Or just make the beam into a railgun, the nose of the Ray actually looks like it has these magnetic things which are used to accelerate stuff in railguns.
P.s. woops, just saw that the author also removed all attributes associated with charging the weapon, my bad. But for some reason it still requires charging for me.
I managed to solve this in my game (playing with VRO) by removing the first instance of "shoot_at" command in "fight.attack.object" and "fight.attack.stations" xml files.
Seems the ships attack on their own anyway, and giving them the order to attack in the script behaves like the user spamming the attack button (rather than holding it down).
Nice catch! Indeed there is a bug for the boron ray that I mistakenly introduced in the latest version when i upgraded for X4 7.10, I am on it to resolve it in this weekend, unfortunately i were not active in the last month due to rl reasons so I completely left this bug unattended, thank you for your reports!
Felt like this mod would fix my boron ships, but i am have the same issue described here. Has the mod been updated yet ?
I am afraid breaking the script by removing myself the "shoot_at" from the xml files.
Especially for the fight.attack.object.destroyers.anghelos.xml as i find only one isntance of "shoot_at"
EDIT : dont have to be afraid. The fix works, so in fight.attack.object.destroyers.anghelos.xml remove the entire first and only line : <shoot_at object="this.ship" target="$target" missiles="false" primary="true" secondary="true" tolerance="$ToleranceWeapon1" fixedtarget="false"/>
Did not try for stations yet, dont have the fleet to attack one ;)
BTW, using vanilla game, this is the only mod i have.
This is great. Even Asgards use their main guns properly. It is great seeing my capital fleet properly bombarding the enemy. There's still so much basic stuff in X4 that is not working properly, even after so long.
Hi! With this mod, the OTAS Boreas ship does not slow down when it flies to attack K and rams it. This happens with 100% probability. The Earthlings' Kitsune missile frigate also behaves in a similar way. When I disable the patch on the main OTAS gun, the destroyers don't attack as effectively, but they don't ram the enemies either. The RE mod is installed
This mod causes a very weird behaviour with KUDA and VRO enabled. Enemy ships disarm their turrets when shot by the player for some reason, did testing and yeah concluded it was this mod with that combination (for some reason)
I'm getting a game crash, and this is the error the debug is kicking out (along with emergent missions, different error).
[=ERROR=] 10217.97 Error in AI script Anghelos_move.flee on entity 0x77573: Property lookup failed: $debugchance * Expression: $debugchance * Action: <do_if>, line 63 [General] 10217.97 ====================================== [General] 10229.98 ======================================
I figure it's either this, or that. Either this mod, or emergent missions. Curious if this seems like anything to you Anghelos, or it's nothing just usual debug stuff.
(Update, the crash was caused by the older version of Kuda AI).
64 comments
Since I completely left this bug unattended, I thank you for your reports and especially Mexmarsouin28 that found a temporary solution which i quote for you:
in fight.attack.object.destroyers.anghelos.xml remove the entire first and only line :<shoot_at object="this.ship" target="$target" missiles="false" primary="true" secondary="true" tolerance="$ToleranceWeapon1" fixedtarget="false"/>
extensions\ws_4747474712\aiscripts\fight.attack.stations.destroyers.anghelos.xml(369): Found non-event condition 'check_value', event condition required!
Also file name must be in lower case
anghelos_interrupt.attacked.xml
anghelos_move.flee.xml
As said other times those event condition errors are not true, as those conditions, even not being event conditions, are actually calculated. Eliminating the conditions, or using similar (not equivalent, as there are none) event conditions to those will not produce the same results and the script will not work as intended. In this state, as v7.1 of x4 the scripts work instead. For Boron and ships of other mods main guns instead a tweak must be done, as explained in the sticky post, until i will fix this after i am finishing with my other project in mcpedl.
Question: Can you help me understand or explain how you see this work?
<conditions>
<check_any>
<event_object_destroyed object="$target" />
<check_value value="@this.ship.bboxdistanceto.{$target} ge $MinGainDistance"/>
</check_any>
</conditions>
Maybe your idea was to trigger when target destroyed OR if distance to target > mingaindistance, BUT then question is how often this condition is checked? I think checked only in the begining of movement in next tick, but I could be wrong.
Because I can see in the doc https://wiki.egosoft.com/X%20Rebirth%20Wiki/Modding%20support/Mission%20Director%20Guide/
So this really confuse me. Seriously, i'm trying to figure out how egosoft made the engine and when it will check your conditions.
And I can't believe that the condition will be checked many times without event. If checked many times (every frame?) - than this is bug that egosoft can fix any time :D
Also found event_object_approaching_waypoint, but this might not help you. probably egosoft didn't do this on purpose to avoid performance problems.
Regarding the need to "check a condition every x milliseconds" i am not able to give a perfect solution, but a workaround can be encapsuling your code and your conditions in a while struct and put a wait at the end of the while, so you have a an arbitrary pause between each reiteration of the while. Of course take in account how and when to abort the while structure. If I recall correctly, I did this in my script and this is also how egosoft pauses a little its while structures.
Regarding the first part about object destroyed, that event condition is able to break the while loop immediately within the very same iteration if the target is destroyed, this because we do not need the looping of the attack code anymore if we have no target. The non event conditions, like for example being in the mingaindistance, are instead evaluated every time the while structure is reiterated, but those within the the while structure usually do not break the looping, they are used to differentiate when holding position to fire, when to gain distance etc. Also there are conditions for the while structure itself that are evaluated before any new iteration and if false they will break it before even making a new iteration.
Finally ,to point the importance of those non event conditions in the practical simulation of X4, without those the destroyers would basically ram the target ship as they would never stop at a specified distance, they would still attack with the main guns like a fighter would. In fact the vanilla fighters in their attack script do not have any condition for distance to maintain as they can get very very close to their target when fighting. But we absolutely need this for destroyers and larger ships unless you like your cruisers to hug the enemy ships.
if the developer reads this, fix this or tell me how to fix the code so that there is a delay before a new series of shots
(vanilla)
P.s. woops, just saw that the author also removed all attributes associated with charging the weapon, my bad. But for some reason it still requires charging for me.
Seems the ships attack on their own anyway, and giving them the order to attack in the script behaves like the user spamming the attack button (rather than holding it down).
Felt like this mod would fix my boron ships, but i am have the same issue described here.
Has the mod been updated yet ?
I am afraid breaking the script by removing myself the "shoot_at" from the xml files.
Especially for the fight.attack.object.destroyers.anghelos.xml as i find only one isntance of "shoot_at"
EDIT : dont have to be afraid. The fix works, so in fight.attack.object.destroyers.anghelos.xml remove the entire first and only line :
<shoot_at object="this.ship" target="$target" missiles="false" primary="true" secondary="true" tolerance="$ToleranceWeapon1" fixedtarget="false"/>
Did not try for stations yet, dont have the fleet to attack one ;)
BTW, using vanilla game, this is the only mod i have.
Fixed my beams :D
If it's a hassle for you, do you give me permission to upload this mod myself with a private listing. This way, only I will be able to see it.
Thank you.
Damn fine job!
I wonder what's going on at Egosoft X4 development team that you could do what they couldn't.
[=ERROR=] 10217.97 Error in AI script Anghelos_move.flee on entity 0x77573: Property lookup failed: $debugchance
* Expression: $debugchance
* Action: <do_if>, line 63
[General] 10217.97 ======================================
[General] 10229.98 ======================================
I figure it's either this, or that. Either this mod, or emergent missions. Curious if this seems like anything to you Anghelos, or it's nothing just usual debug stuff.
(Update, the crash was caused by the older version of Kuda AI).