Modding, Mission Design, and Coding > The Scripting Workshop
Tech Demo: Scripted missiles with collision avoidance
m!m:
I wanted to do something like this for a long time. The basic idea of this demo script is to make missiles avoid obstacles when approaching a targeted subsystem by using the model paths specified in the model file.
I created a small test mod which implements this feature for the retail Harpoon missile: http://www.mediafire.com/file/df4c4n6464rsa1v/pathScript.zip
These builds are required for using the script: http://swc.fs2downloads.com/builds/test/scriptingModelPaths/
All you need to do is target a subsytem and fire a Harpoon missile (I have included a very simple test mission in the mod above). The missile will fly towards the closest unobstructed path point and then follow the path specified in the model path. I increased the range and turn rate of the Harpoon significantly in this mod since the missile needs to make some pretty sharp turns in order to hit the target.
Let me know what you think!
Spoon:
Well the test mission was nowhere to be found.
When I tried this in a retail mission, tried to target the iceni with a harpoon and got
--- Code: ---Error: Caught std::exception in main(): 'vector<T> too long'!
File: freespace.cpp
Line: 7982
ntdll.dll! NtWaitForSingleObject + 10 bytes
KERNELBASE.dll! WaitForSingleObjectEx + 156 bytes
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
ntdll.dll! RtlRestoreContext + 739 bytes
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
fs2_open_3_8_1_scriptingModelPaths_x64_SSE2.exe! <no symbol>
kernel32.dll! BaseThreadInitThunk + 13 bytes
ntdll.dll! RtlUserThreadStart + 29 bytes
--- End code ---
Caught a STD :(
m!m:
I forgot to move the test mission to the mod folder. I updated the mod link in the first post.
I suspect that the error you encountered is caused by a subsystem not having an assigned path. It should be easy to fix if I can reproduce it.
Spoon:
Hah, that's really neat. And should make antisubsystem missile weapons seriously more useful.
I could see some potential usefulness being able to send weapons down paths like this for other senarios too.
m!m:
The basic feature of handling the homing positions of a missile from a script can be adapted freely (see weapon.OverrideHoming for more information).
What mission were you using when you encountered the uncaught exception? I would like to fix that bug before I submit the new code for review.
Navigation
[0] Message Index
[#] Next page
Go to full version