May I suggest some small improvements to the script-code:
- You should probably put the code in the updateTick() method, instead of the update() method, as I guess it is not required to update the target-node at _every_ frame-update (i.e. many-many-many times per second). The updateTick() method is called less times per second, but should suffice for your mod's purpose.
- Probably also verify that the 'self.fillAutoAimTargetNode' has a value, and is not nil. So only when it has a value, the get/setTranslation() can be called, without causing errors.
- You could use some 'elseif' to make an 'if ... then .. elseif ... then ... elseif ... then ... end', as when the first expression testing against 'loadInPercent' is true, there would be no need to test the remaining 'if statements'.
- There are some "gaps" in your 'loadInPercent' if-expression tests. What happens when 'loadInPercent' has a value of 20.5 or 40.2 or 68.99? None of the 'if statements' will then match as I see it.
3 Comments for AdvancedFillAutoAimTargetNode
hello it s possible to put this script in trailers direct? it s for surprise^^
If i want to unload a combine, with mod installed, the game is stopping.
May I suggest some small improvements to the script-code:
- You should probably put the code in the updateTick() method, instead of the update() method, as I guess it is not required to update the target-node at _every_ frame-update (i.e. many-many-many times per second). The updateTick() method is called less times per second, but should suffice for your mod's purpose.
- Probably also verify that the 'self.fillAutoAimTargetNode' has a value, and is not nil. So only when it has a value, the get/setTranslation() can be called, without causing errors.
- You could use some 'elseif' to make an 'if ... then .. elseif ... then ... elseif ... then ... end', as when the first expression testing against 'loadInPercent' is true, there would be no need to test the remaining 'if statements'.
- There are some "gaps" in your 'loadInPercent' if-expression tests. What happens when 'loadInPercent' has a value of 20.5 or 40.2 or 68.99? None of the 'if statements' will then match as I see it.