Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Spicious on June 30, 2008, 05:32:24 am
-
As you may have guessed from the title, I've made a few sexps to try to allow some better control over turrets. Turrets can be set to prioritise certain ships and subsystems on those ships. Have a play (http://www.cse.unsw.edu.au/~smcn929/fs2_open.rar) and/or try this demonstration (http://www.cse.unsw.edu.au/~smcn929/turret-subsys%20test.fs2) I prepared earlier.
-
Can you post a diff of the code please? :)
-
Yes (http://www.cse.unsw.edu.au/~smcn929/turrets.patch).
-
Has anyone tried this?
-
On the list to try tonight actually. I mentioned it in a post earlier today. :)
-
Okay, had a look at the code and on the whole it seems fairly acceptable to me. I would however spin off the code for setting and copying the priorities into a function in ships.cpp if you can. First something like that really has no business being in SEXP.cpp anyway really and secondly if someone ever decides to make it possible to set priorities in FRED from the ship editor (and they should!) they'll need some way of doing what you're currently doing in the SEXP code anyway.
-
Fair enough. Have you got any preferences over the parameters? Otherwise I'll probably just go with subsystem and the appropriate target list.
-
Sounds good to me.
-
I've updated the files linked earlier.
Out of interest, would it be possible to nest subsystems within a ship in the sexp tree?
-
Not sure what you mean by that.
-
I guess making a subsystem part of another...say, OSM thruster 1-1 is part of thruster 1 which is part of engine. The problem is how to carry on damage. So if you shoot the engine subsystem the thrusters are blown....or are they?
-
That isn't just an issue with the SEXP tree though. You'd need to change the entire way the game handles subsystems to do it.
-
Something like
+ship
--subsystem
--subsystem
...
rather than
-ship
-subsystem
-subsystem
...
-
Not really. It would require that you make the ship name an operator of some sort which took subsystem arguments in order to do that.
BTW I've just noticed this but you might want to consider using OPF_SUBSYS_OR_GENERIC rather than OPF_SUBSYSTEM. The latter will cause a crash if you use the SEXP on a ship which changes class at any point before the SEXP is called (either through loadout or the change-ship-class SEXP).
It also gives you the <all turrets> subsystem which you might find useful to handle in your SEXPs. :)