Nexus Modding > Scripting
Problem with new Command
The Old Dragon:
Hi Folks,
Currently trying to write a new command and have run into a problem, was wondering if anyone could help while I'm banging my head against a brick wall.
The problem I've got is that when I adjust the power bar on the right to speed up or slow down the ship, the tick in my command gets stopped, I need to find a way of capturing the cause and either stopping it or reactivating the command afterwards.
Any ideas...
GeoModder:
You can't put a 'tick' check on your first 'tick' command if its still working?
What is the tick supposed to do? Monitoring speed of a ship's velocity?
The Old Dragon:
Hi Geo,
Been a while, hope things have been good for you. Getting down to business...
I've put a debug comment on the tick to see if it's running, but even without that, it's blatently obvious that the command stops working as soon as you adjust the power levels :(
As for the command itself; this part of it is for the 'defensive' command behaviour. What the tick is supposed to do is check for any detected hostiles and if any are found, plot a new course based on vectors from the main ship to it's destination and from the main ship to the nearest hostile. This new course should take it around the hostile and towards the target (eventually) without engaging the hostile.
At this time, as soon the slider is adjusted, the main ship goes to the last plotted point and stops.
As a work around, I suppose I could use the command that marks when you reach your destination. If a certain variable is set, it could re-enable the tick...
Possibly a bit clunky, but I'll work on it. Would welcome further ideas though.
GeoModder:
All is well at my end, and I hope 't will be too at your end. ;)
If I read you correctly, you want a ship to stay simulteneously outside weapon range from a hostile while still moving towards a predetermined point. But once you give a manual command (like adjusting power levels), it stops working. Have you tested if the same happens when for instance charging weapons or shields or enabling/disabling support devices like ECM and Sensor?
I recon the game AI is designed to stop running 'automated' commands like your tick once input from the player is detected, if said ticks directly involve an action done by the object it keeps tabs on.
Does the command stops only if you manually adjust on the right side (by the engine tabs), or also on the more general commands on the left side where you can only adjust to 100-150-200% power output for the engines?
If only adjusting power levels causes your command to fail:
If changing power levels is something that need to happen, perhaps a few extra lines in the command under an 'if' tree to start the tick back/reset when certain power level conditions are met? But that could run up your machine by ten or so lines (one for each selectable power level).
The Old Dragon:
Good to hear Geo,
Apologies for the prolonged absence, my poor old laptop fell over in a rather major way so I had to get another :(
Then I ended up playing The Witcher 2 to test new machine (my old one stuggled, this beastie made it fun again).
Back to business at hand though, the general commands on the left (behaviour, how much power to assign to systems) don't affect the command, but all the manual commands along the centre (the bit to turn on specific devices or target weapons, etc) and those on the right interupt the tick so we proceed to the last set destination.
So I'd go along with your assumption of manual command interuption is correct.
So the question then becomes 'How to capture these manual events?' if it's at all possible.
Navigation
[0] Message Index
[#] Next page
Go to full version