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

Title: Slightly less random turrets
Post 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.
Title: Re: Slightly less random turrets
Post by: karajorma on June 30, 2008, 06:53:37 am
Can you post a diff of the code please? :)
Title: Re: Slightly less random turrets
Post by: Spicious on June 30, 2008, 07:10:56 am
Yes (http://www.cse.unsw.edu.au/~smcn929/turrets.patch).
Title: Re: Slightly less random turrets
Post by: Spicious on July 07, 2008, 05:06:28 am
Has anyone tried this?
Title: Re: Slightly less random turrets
Post by: karajorma on July 07, 2008, 05:49:46 am
On the list to try tonight actually. I mentioned it in a post earlier today. :)
Title: Re: Slightly less random turrets
Post by: karajorma on July 08, 2008, 03:24:05 pm
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.
Title: Re: Slightly less random turrets
Post by: Spicious on July 09, 2008, 04:34:35 am
Fair enough. Have you got any preferences over the parameters? Otherwise I'll probably just go with subsystem and the appropriate target list.
Title: Re: Slightly less random turrets
Post by: karajorma on July 09, 2008, 04:50:22 am
Sounds good to me.
Title: Re: Slightly less random turrets
Post by: Spicious on July 09, 2008, 09:19:42 am
I've updated the files linked earlier.

Out of interest, would it be possible to nest subsystems within a ship in the sexp tree?
Title: Re: Slightly less random turrets
Post by: karajorma on July 09, 2008, 10:35:45 am
Not sure what you mean by that.
Title: Re: Slightly less random turrets
Post by: Flaser on July 09, 2008, 01:52:07 pm
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?
Title: Re: Slightly less random turrets
Post by: karajorma on July 09, 2008, 01:57:44 pm
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.
Title: Re: Slightly less random turrets
Post by: Spicious on July 09, 2008, 06:21:42 pm
Something like
Code: [Select]
+ship
--subsystem
--subsystem
...

rather than
Code: [Select]
-ship
-subsystem
-subsystem
...
Title: Re: Slightly less random turrets
Post by: karajorma on July 10, 2008, 01:59:11 am
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. :)