EDIT4 : Added more information about possible cause of problem
EDIT3 : Added possible fix i hope. Please check my work and make sure i'm not doing something stupid that makes it appear to fix the bug.
EDIT2 : Removed extra /code tag cause im noob
EDIT1 : Added Stack Information
I started a new game using 0.30b and ran into a problem that i can reproduce. I haven't looked into the script to see if i can find the problem yet but that will be step 2.
// UPDATE 1
I did some more checking and a single fighter will dock correctly using the same commands. But when the same fighter is added to a wing it will exhibit the bug. Revised steps to cause the bug to happen.
1) spawn Cerberus or any MT i assume will work.
2) spawn a rapier fighter and make sure it has fight-command software mk1 and 2
3) add fighter to blue wing
4) set there command to attack target nearest the Cerberus
//Steps to cause problem - Vanilla install patched to 3.1 with 0.30b and LV's //cheat scripts
//1) spawn Cerberus or any MT i assume will work.
//2) spawn 8 rapier fighters and make sure they have fight-command software mk1 and 2
//3) add all 8 fighters to blue wing
//4) set there command to attack target nearest the Cerberus
The fighters will attempt to dock with the Cerberus and there active command will switch between attack nearest target and dock at Cerberus. This will cause the ships to stutter back and forth and never dock at the Cerberus when there are no bad guys around.
If you dock the ships manually and then set them to attack nearest target of the Cerberus they will stay docked. So my very uneducated guess is the error happens because the docking script is returning before the ships actually dock and are going into the idle state of the attack nearest target command before they dock. I am going to take a look at the scripts and see if i can locate the problem.
If someone else can reproduce this error i would be grateful. That way i know i'm not screwing it up myself somehow.
Stack States for the states they are swapping between
// Fighter State 1
Code: Select all
---Script Task ID = 0 ------
PID = 428508
Prio = 0
Interrupts = Enabled
IntReq = no
Stack Depth = 2
Current Stack: [script at bottom runs]
1: !ship.cmd.attacknearest.pl prio=0
2: !ship.cmd.attacknearest.std prio=0
3: !move.follow.template prio=0
// Fighter State 2
Code: Select all
--- Script Task ID = 0 -----
PID = 426805
Prio = 0
Interrupts = enabled
IntReq = no
Stack Depth = 4
Current Stack: [script at bottom runs]
1: !ship.cmd.attacknearest.pl prio=0
2: !ship.cmd.attacknearest.std prio=0
3: !move.follow.template prio=0
4: !ship.cmd.movestation.std prio=0
5: !move.movetostation prio=0
// Stack state for Cerberus
Code: Select all
---Script Task ID = 587 ----
PID = 279273
Prio = 10
Interrupts = enabled
IntReq = no
Stack Depth = 0
Current Stack: [script at bottom runs]
1: Lib.Cmd.LeadShipWingMonitor prio=10
// Update 2
Reset scripts folder back to default and installed version 0.26b to create a log file just in case it helps. Problem occurred in .26b using same steps as above.
http://pastebin.com/qP5Ef5Ni Log file was bigger then paste-bin site allowed so i copied only the entries that occurred once my ship showed up in the log.
// Update 3
Either i fixed the bug or i broke the game so badly that it now works correctly. So if i packed the script correctly (my first time making a pck file) then this fixed the bug. Not sure why invoking the base function directly fixed it while calling the wrapper didn't work correctly. Please check my work.
!move.follow.template
Code: Select all
if [THIS]->has same environment as $Lead
if $Lead->is docking possible of [THIS]
= [THIS]->call script '!move.movetostation' : targetstation=$Lead <-- changed it to this line instead of the one below.
* mod= [THIS]->call script '!ship.cmd.movestation.std' : object=$Lead
if [ENVIRONMENT] == $Lead
[THIS]->set pirate cover state to [FALSE]
= wait 999999 ms
end
continue
end
[THIS]->set pirate cover state to [FALSE]
= [THIS]->escort ship $Lead
end
// Update 4
I think i found the line of code that causes the problem with the wrapper function.
!ship.cmd.movestation.std
Code: Select all
[THIS]->set command: {COMMAND_DOCKAT} target=$object target2=null par1=null par2=null
[THIS]->set destination to $object
= [THIS]->call script '!move.movetostation' : targetstation=$object
[THIS]->set destination to null
return null
The first line of code [THIS]->set command: {COMMAND_DOCKAT} target=$object target2=null seems to be the problem.
If i comment out this line and repack the file and use the original 0.30b scripts everything works perfectly. I don't know enough about the system to make a informed decision as to why this line of code causes a problem. But calling the base function seems to solve the problem so no need to change this really. Who knows what might break if it gets changed.
From the MSCIHandbook the set command function is really for information purposes only so why is it affecting the state of the object??!