Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: zookeeper on November 27, 2011, 12:23:34 pm
-
By default, turrets will keep shooting even when the ship is already in the process of dying which I think doesn't really make much sense, so this patch adds an ai_profiles.tbl flag which prevents that from happening.
Index: ai/ai_profiles.cpp
===================================================================
--- ai/ai_profiles.cpp (revision 8049)
+++ ai/ai_profiles.cpp (working copy)
@@ -481,6 +481,7 @@
}
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
+ set_flag(profile, "$disable turrets on ship death:", AIPF2_DISABLE_TURRETS_ON_SHIP_DEATH, AIP_FLAG2);
// if we've been through once already and are at the same place, force a move
if ( saved_Mp && (saved_Mp == Mp) )
Index: ai/ai_profiles.h
===================================================================
--- ai/ai_profiles.h (revision 8049)
+++ ai/ai_profiles.h (working copy)
@@ -62,6 +62,7 @@
#define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
#define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
#define AIPF2_NO_WARP_CAMERA (1 << 10)
+#define AIPF2_DISABLE_TURRETS_ON_SHIP_DEATH (1 << 11)
// AI Path types
#define AI_PATH_MODE_NORMAL 0
Index: ship/shiphit.cpp
===================================================================
--- ship/shiphit.cpp (revision 8049)
+++ ship/shiphit.cpp (working copy)
@@ -1347,6 +1347,20 @@
ship_stop_fire_primary(objp); //mostly for stopping fighter beam looping sounds -Bobboau
+ if (The_mission.ai_profile->flags2 & AIPF2_DISABLE_TURRETS_ON_SHIP_DEATH) {
+ // Lock all turrets so they won't keep firing while the ship is dying
+
+ ship_subsys *subsys = GET_FIRST(&sp->subsys_list);
+
+ while ( subsys != END_OF_LIST(&sp->subsys_list) ) {
+ if (subsys->system_info->type == SUBSYSTEM_TURRET) {
+ subsys->weapons.flags |= SW_FLAG_TURRET_LOCK;
+ }
+
+ subsys = GET_NEXT(subsys);
+ }
+ }
+
sp->flags |= SF_DYING;
objp->phys_info.flags |= (PF_DEAD_DAMP | PF_REDUCED_DAMP);
delta_time = (int) (sip->death_roll_base_time);
EDIT: Actually, on second thought, I think this would be even more trivial to script instead. So, if someone else wants to have this feature then great, but I guess I won't need it myself after all. :lol:
-
I personally like how turrets these days completely lose their accuracy and fire off in empty space when the ship is going down.
'cept for beams, those just remain spot on, even capable of firing their beams when the ship is almost half way done vaporising in some cases.
In other words, could there be an option to just only disable beam turrets from firing when the ship is going down?
-
I personally like how turrets these days completely lose their accuracy and fire off in empty space when the ship is going down.
'cept for beams, those just remain spot on, even capable of firing their beams when the ship is almost half way done vaporising in some cases.
In other words, could there be an option to just only disable beam turrets from firing when the ship is going down?
Yeah...
#Conditional Hooks
$Object type: Ship
$On Death: [
mn.runSEXP("beam-lock-all !" .. hv.Self.Name .. "!")
]
#End
-
Yes, this can be done (and has been done before) with sexps. Just beam-lock or turret-lock any ships you don't want to fire while they're blowing up. We don't need a flag for this.
-
I kinda agree. When a scripted workaround is this simple, it's probably better to avoid an engine-side addition. At least it didn't take all too long to write. ;)
-
Yes, this can be done (and has been done before) with sexps. Just beam-lock or turret-lock any ships you don't want to fire while they're blowing up. We don't need a flag for this.
But if you want to do this for a whole campaign, you'll have to beam/turret lock eveerrrry damn capital ship in every mission.
Your argument here is: "We don't need an easy available option because we already have a painfully time consuming hard way available to do this." :blah:
What's the harm in having an extra ai_profile.tbl flag available to modders? I for one would gladly use this for beam locking capital ship turrets. But I sure as hell won't manually do it for 20+ missions.
-
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
-
But if you want to do this for a whole campaign, you'll have to beam/turret lock eveerrrry damn capital ship in every mission.
#Conditional Hooks
$Object type: Ship
$On Death: [
mn.runSEXP("beam-lock-all !" .. hv.Self.Name .. "!")
]
#End
Doesn't this do that?
-
Doesn't this do that?
Yes, just shoving that piece of code into whatever-sct.tbm should cause all beams on all ships get locked the moment they begin to blow up.
I agree that doing it via mission events would be very annoying when you'd have to do it in every mission (I don't think you'd need to do it on a ship by ship basis), but a simple script like this shouldn't be a problem unless I'm missing something.
-
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
A million times this.
SCP needs at least a couple of meta-arguments for things such as <all friendly>, <all ships>, <all [class]> and such. This would make when-argument much easier to use for large amount of ships.
-
Doesn't this do that?
Yes, just shoving that piece of code into whatever-sct.tbm should cause all beams on all ships get locked the moment they begin to blow up.
I agree that doing it via mission events would be very annoying when you'd have to do it in every mission (I don't think you'd need to do it on a ship by ship basis), but a simple script like this shouldn't be a problem unless I'm missing something.
I'm scripting inept but that sounds easy enough.
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
A million times this.
SCP needs at least a couple of meta-arguments for things such as <all friendly>, <all ships>, <all [class]> and such. This would make when-argument much easier to use for large amount of ships.
I wouldnt mind seeing this at all
-
Hang on. I think what would be better would be to introduce a sort of meta-argument like "<all ships>" or something.
A million times this.
SCP needs at least a couple of meta-arguments for things such as <all friendly>, <all ships>, <all [class]> and such. This would make when-argument much easier to use for large amount of ships.
Indeed. :yes:
-
You guy do realise that would basically involve manually changing every single SEXP that can take a ship as an argument, right?
-
Does it? I thought we could do it in the argument-evaluation stage, take the meta argument and expand it before firing off the actual event...
But then, I haven't looked too deeply into the argument code...
-
Hmmmmm. I suppose doing it that way might work. It would mean you could only use <all ships> in the argument list and not as an argument to the SEXP itself. I was assuming you mean making it possible for the SEXPs to take the meta-argument the same way many of them currently take arguments like <any wingman> or <any hostile>.
Doing it to the argument list might not be that hard.
One problem would be deciding if <all ships> means "all ships in the mission file" or "all ships currently in the mission" as many SEXPs have different actions for ships not in the mission.
-
Not to mention the fiasco with ships in wings...
-
You guy do realise that would basically involve manually changing every single SEXP that can take a ship as an argument, right?
You do realize that I did this over 2 years ago and it's still waiting code review.
-
No, this is quite different from what you did. What they're talking about is having this.
when-argument
-any-of
--<all ships>
-etc