Nexus Modding > Scripting
Scripting Issues
Mularac:
A question:
I've been making a cinematic scene that would show a couple hundred of ships appearing out of nowhere.
To be able to do that I've been turning them into wrecks the minute they appear, by changing their behaviour to 4. However, that didn't work, they still behave and more importantly, count as normal ships, so when I hit 20 or so the game crashes.
These ships appeared with the CreateShip command, they weren't part of the entities section.
My question:
How can I bypass this? any ideas?
Arparso:
Tried it out and found a simple workaround: simply make the newly spawned ship disappear and immediately let it appear again. Of course, set behaviour to 4 before making the ship disappear or else you'll still run into the unit limit:
--- Code: ---E.newShip := CreateShip(#styp_gtc_fenris, #race_player, "DynamicShip");
E.newShip:behaviour := 4;
E.disappearedShip := Disappear(E.newShip);
Appear(E.disappearedShip);
--- End code ---
My interpretation of what happens internally:
* spawning the ship with CreateShip() will make it count for the ship limit, because it starts with behaviour 0
* setting behaviour to 4 makes it behave like an asteroid or wreck, but it still counts for the ship limit
* it will not count anymore, if you remove it from the scene using Disappear() on it
* upon returning to the scene with Appear(), it will still not count - because it enters the mission with behaviour 4 as an asteroid/wreck
* ???
* Profit!
Actually... I've got to thank you for that question, because experimenting with the solution I may have managed to work around the ship limit altogether :)
I made a separate thread for that, so that it won't get buried (and not found later) in this general purpose scripting thread.
Navigation
[0] Message Index
[*] Previous page
Go to full version