JohnS26
Registered:1470232187 Posts: 36
Posted 1634003864
Reply with quote
#1
Hello all. I am trying to create a neutral ship that just sits in one spot. How can I do this? Can I use a generic mesh and put a ship skin over it?
__________________Adm. John Scales Lord Commander of His Imperial Majesty's Fleet
Terran Stellar Navy Imperial Fleet
ryleyra
Registered:1399599588 Posts: 3,214
Posted 1634065670
· Edited
Reply with quote
#2
That is a possibility. This is actually a well known problem, and there are a few solutions that have been suggested, none of them perfect. 1) Create an event that every few cycles, resets the neutral ships' location to the required coordinates. The ship will "jump" around, and you have to balance how far it gets per event to how sluggish the game gets with too many events, but Comms will be able to interact with the neutral ship as normal. A good event to test for is the ship getting outside of a small circle. 2) Add a POINT_THROTTLE to the ship's AI and set the throttle to 0 or close to 0. As above, this won't stop the ship from moving totally, and you may have to experiment to get it to work, but it won't run the risk of lagging down the script. As a note, make sure you define the AI in a different event that the one that creates the neutral. 3) Create a generic mesh and put the ship "inside" the mesh. You can use the first method above to "rubber band" the ship back inside the mesh every so often, but you won't see the ship moving if the mesh is big enough. This is good for planets, bases, or "freighters" that are much bigger than the ship. If the ship can be destroyed (by the players or enemy ships) destroy the mesh when the ship is destroyed. 4) Go your route and create a generic mesh that uses ship files as the model and texture. You will have to manually implement a method for Comms or other consoles to interact with it. Enemy ships won't be able to interact with it at all. If it's a dead ship, though, which isn't intended to respond to hails, this is probably the best solution. Also, make sure the ship's existing AI isn't interfering with your intention. If you want the ship to wait until a player ship tells it what to do, but it should respond to Comms, you might want to use solution 2. But if the ship shouldn't respond to Comms at all, be sure to clear the AI and reprogram it with just the POINT_THROTTLE command.
HaydenBarca
Registered:1537152273 Posts: 455
Posted 1634081793
Reply with quote
#3
I've done this with the actual neutral ship by setting the top_speed of the ship to 0.00001 (if you set to actual zero it breaks things). If you need it to also not rotate (such as when responding to other ships), then clear the AI stack and give it the command Dir_Throttle toward the heading you want as its sole command and it will keep pointing that way (similar to the point_throttle that ryleyra mentioned). If you want it to resume normal movement later (like after the players repair it), be sure to first record the top speed of the ship into a variable so that you can restore it later. Then clear and rebuild the AI stack to restore its normal function (remember the last command in the AI stack has first priority since each command "overwrites" the previous ones).
Another option (if the ship is supposed to scan as damaged) is to cycle an event to happen every 19 seconds to manually damage Maneuvering and Impulse systems. Note that this will make it actually damaged and will die quicker if enemy ships start shooting it. I would avoid using Generic Meshes if you can help it since they tend to defy expectations in several ways (can't be targeted, can't be destroyed, etc.).
Mike Substelny
Administrator
Registered:1375273622 Posts: 2,990
Posted 1634156196
Reply with quote
#4
I love generic meshes, but hardly anyone ever sees them because most crews keep the main screen on Long Range Scan 99% of the time. HaydenBarca's technique of setting the AI ship's top speed to a very small number is my favorite, but it depends on what other behaviors you want. Do you want the ship to swivel to face things? Do you want it to defend itself? Unfortunately your choices of what to do about the Comms messages to and from the AI ship are pretty limited.
__________________"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight." - Winston Churchill
JohnS26
Registered:1470232187 Posts: 36
Posted 1634177725
Reply with quote
#5
I am trying to make a bone yard of decommissioned ships as scenery only. They don't move and no interaction needed. Dead ships in space waiting to be scrapped.
__________________Adm. John Scales Lord Commander of His Imperial Majesty's Fleet
Terran Stellar Navy Imperial Fleet
Darrin
Registered:1518310287 Posts: 434
Posted 1634256097
· Edited
Reply with quote
#6
This is an excerpt from my "Kobayashi Maru" script:<create type="neutral" x="50000.0" y="0.0" z="30000.0" angle="180" name="Kobayashi Maru" raceKeys="Terran" hullKeys="Bulk Cargo" sideValue="2" fleetnumber="1" /> <clear_ai name="Kobayashi Maru" /> <add_ai type="POINT_THROTTLE" value1="50000.0" value2="0.0" value3="30000.0" value4="0.0" name="Kobayashi Maru" /> <set_object_property property="topSpeed" value="0.0" name="Kobayashi Maru" /> <set_object_property property="throttle" value="0.0" name="Kobayashi Maru" /> <set_object_property property="steering" value="0.0" name="Kobayashi Maru" />
But yeah, the trick is to clear the AI, set the topSpeed/throttle/steering to 0.0, and then use POINT_THROTTLE to tell the ship to go to whatever coordinates it's currently at. I haven't tried setting the throttle to 0.00001, but if that works better, use that. If you want the ship to be "disabled" as in "smoking", then you can set the systemDamageImpulse and systemDamageWarp to 100.0, but you need to set a recurring tick (as HaydenBarca suggested) or the ship's autorepair will fix the damaged systems.
__________________ Call Sign (EF/TSN): Bassellope
Mike Substelny
Administrator
Registered:1375273622 Posts: 2,990
Posted 1634566469
Reply with quote
#7
Quote:
Originally Posted by JohnS26 I am trying to make a bone yard of decommissioned ships as scenery only. They don't move and no interaction needed. Dead ships in space waiting to be scrapped.
Dead ships waiting to be scrapped could have no AI behavior. Just clear the AI stack and se max front and rear shields to zero and they will behave as dead ships. They will look like dead ships to Science, but they might still respond to Comms messages. You could try building generic meshes using the models and skins in the game. You might try putting the wrong skins on models to make them look beat up. This will make them look like dead ships to Comms, but they won't scan as ships for Science.
__________________"The Admiralty had demanded six ships; the economists offered four; and we finally compromised on eight." - Winston Churchill