Nexus Modding > Scripting
Working around the ship limit finally possible?
Arparso:
Thanks to Mularac's question about making wrecked ships appear in a mission I may have stumbled upon something awesome:
* If you create a new ship with CreateShip(), it'll count against the ship limit
* It'll still count, if you set the behaviour to 4 afterwards, making it an "asteroid" from the game's perspective
* It'll not count anymore, if you make it leave the scene by calling Disappear() on it
* It'll still not count, if you make it reappear later or immedeately by calling Appear() on it (it'll still behave like an asteroid/wreck, though)
* And now the magic: It'll still not count, if you set its behaviour back to 0, to make it usable as a ship again
I just created around 50 Fenris-class cruisers and successfully ordered all of them to move somewhere - worked like a charm, although the performance wasn't all that great... but that's not the point. Using that trick we could finally be able to make missions involving much more than just the standard 20-something ships until the game crashes.
Really wonderful for something like my experimental warfare mini-mod, where by using that technique you could "build" truly massive fleets in-game without making the game crash so soon. :)
I obviously haven't done a lot of testing, though. The game may bug out in certain situations with this many ships present - only prolonged testing will tell, if it's really a viable path to take. In any case, here's a quick code snippet to spawn a ship that way:
--- Code: ---RULE event Cheat1
:action
// calculate random spawn position and spawn ship
E.newShipPosition := VMul(Rnd() * 3000, VRandomDir());
E.newShip := CreateShip(#styp_gtc_fenris, #race_player, "DynamicShip");
PutShip(E.newShip, E.newShipPosition, 0, 0, 0, 0, 0);
// make ship visible to player
MakeFullyKnown(E.newShip);
FreezeReconState(E.newShip, 1);
// make ship behave like an asteroid, disappear/appear and return back to normal
E.newShip:behaviour := 4;
E.disappearedShip := Disappear(E.newShip);
Appear(E.disappearedShip);
E.newShip:behaviour := 0;
// debug stuff - print the number of spawned ships in console
count := count + 1;
Debug("created ship", count);
:end
END
--- End code ---
Lt.Brandon:
I find this interesting, but do the ships show on the UI selection area if they are on the players team?
Arparso:
Yeah, they do - just like regular ships.
Lt.Brandon:
That's nice to know, and now that I think about it I did need a bit more then the nexus ship limit for some later missions. The last few missions I have planned have a rather large(Aka HUGE[And I mean HUGE]) battle with multiple pirate fleets etc.
Off Topic
I have yet to get the skirmisher to work with my mod. I've tried a lot of things, but nothing seems to have any affect on it, I don't even get an error when it crashes it just closes. I know the problem is related to the tacticstypes.ini, however, nothing I did worked :(
List of things I tried(That I remember doing at least)
Removing and re-adding ships/devices(Didn't get me anywhere with the skirmisher, but I fixed the nexus mod tools with that)
Rewriting the majority of my ships and devices.
Removing smaller automatic weaponry.
Using normal nexus effects/sounds instead of my custom ones.
Decreasing the amount of weapons on ships.
And likely a few other things I forgot.
Arparso:
Sent you an email about the issue :)
Navigation
[0] Message Index
[#] Next page
Go to full version