View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002447 | FSSCP | AI | public | 2011-05-30 02:39 | 2012-12-18 16:54 |
Reporter | SDM | Assigned To | Valathil | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.12 | ||||
Summary | 0002447: When telling Friendly to disarm Target, Friendly will not fire Secondaries | ||||
Description | Tried 3.6.12, Antipodes 8 7108, and 3.6.13 7211. Friendly will not fire Stilleto IIs or any secondaries (tried Tempests and Hornets as well) at a cruiser with turrets. Ransom's Windmills campaign depends on this feature, so it must've worked at one point. | ||||
Tags | No tags attached. | ||||
|
Added test mission |
|
|
|
Uploaded fixed mission that works on current builds. This is still a problem. Alpha 2 in this mission has no primary weapons and has a bank of Stillettos which it should be firing after you order it to disarm the Mentu. |
|
This happens because $Protected on cripple: ships instantly get protected if you order your guys to attack a subsystem, disable or disarm them and fighters don't shoot missiles on protected ships. This was previously an ai_profile flag that was removed in commit 5961 march 2010. This is what killed the Windmills campaign. 3 ways to "fix": 1) change the auto protection behaviour which kinda seems weird anyway (Retail compat?) 2) override the missile lockdown if its antisubsystem missiles 3) people need to remove the cripple flag no code change. EDIT: ok 1) is out because if you only order a part of your forces to disable the rest would still try to destroy the target. 3) is also wobbly because its an objecttypes.tbl flag and would change the whole shipclass |
|
2447.patch (6,735 bytes)
Index: code/ai/aibig.cpp =================================================================== --- code/ai/aibig.cpp (revision 9440) +++ code/ai/aibig.cpp (working copy) @@ -20,6 +20,7 @@ #include "mission/missionparse.h" #include "iff_defs/iff_defs.h" #include "math/staticrand.h" +#include "ai/aigoals.h" @@ -721,71 +722,75 @@ if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f) // Don't select a bomb if enemy moving fast relative to distance priority1 = WIF_BOMB; - if (!(En_objp->flags & OF_PROTECTED)) { + if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) { //ai_select_secondary_weapon(Pl_objp, tswp, priority1, priority2); // Note, need to select to get weapon speed and lifetime - + if(aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) { + priority1 = WIF_PUNCTURE; + } ai_choose_secondary_weapon(Pl_objp, aip, En_objp); int current_bank = tswp->current_secondary_bank; weapon_info *swip = &Weapon_info[tswp->secondary_bank_weapons[current_bank]]; - // If ship is protected and very low on hits, don't fire missiles. - if ((current_bank > -1) && (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) { - if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) { - if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) { - swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f)); + if(!(En_objp->flags & OF_PROTECTED) || ((aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) && swip->wi_flags & WIF_PUNCTURE )) { //override lockdown on protected ships when using anti subsystem weapons - Valathil + // If ship is protected and very low on hits, don't fire missiles. + if ((current_bank > -1) && (!(En_objp->flags & OF_PROTECTED) || (En_objp->hull_strength > 10*swip->damage))) { + if (aip->ai_flags & AIF_UNLOAD_SECONDARIES) { + if (timestamp_until(swp->next_secondary_fire_stamp[current_bank]) > swip->fire_wait*1000.0f) { + swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (swip->fire_wait*1000.0f)); + } } - } - if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) { - float firing_range; - if (swip->wi_flags2 & WIF2_LOCAL_SSM) - firing_range=swip->lssm_lock_range; - else - firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range); - // reduce firing range of secondaries in nebula - extern int Nebula_sec_range; - if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) { - firing_range *= 0.8f; - } + if (timestamp_elapsed(swp->next_secondary_fire_stamp[current_bank])) { + float firing_range; + if (swip->wi_flags2 & WIF2_LOCAL_SSM) + firing_range=swip->lssm_lock_range; + else + firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range); + // reduce firing range of secondaries in nebula + extern int Nebula_sec_range; + if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) { + firing_range *= 0.8f; + } - float t = 0.25f; // default delay in seconds until next fire. + float t = 0.25f; // default delay in seconds until next fire. - if (dist_to_enemy < firing_range*1.0f) { + if (dist_to_enemy < firing_range*1.0f) { - //vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed); - //if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) { - if (ai_fire_secondary_weapon(Pl_objp)) { - if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) { - if (swip->burst_shots > swp->burst_counter[current_bank]) { - t = swip->burst_delay; - swp->burst_counter[current_bank]++; - } else { - t = swip->fire_wait; - if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) { - swp->burst_counter[current_bank] = myrand() % swip->burst_shots; + //vm_vec_scale_add(&future_enemy_pos, enemy_pos, enemy_vel, dist_to_enemy/swip->max_speed); + //if (vm_vec_dist_quick(&future_enemy_pos, firing_pos) < firing_range * 0.8f) { + if (ai_fire_secondary_weapon(Pl_objp)) { + if ((aip->ai_flags & AIF_UNLOAD_SECONDARIES) || (swip->burst_flags & WBF_FAST_FIRING)) { + if (swip->burst_shots > swp->burst_counter[current_bank]) { + t = swip->burst_delay; + swp->burst_counter[current_bank]++; } else { - swp->burst_counter[current_bank] = 0; + t = swip->fire_wait; + if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) { + swp->burst_counter[current_bank] = myrand() % swip->burst_shots; + } else { + swp->burst_counter[current_bank] = 0; + } } - } - } else { - if (swip->burst_shots > swp->burst_counter[current_bank]) { - t = set_secondary_fire_delay(aip, temp_shipp, swip, true); - swp->burst_counter[current_bank]++; } else { - t = set_secondary_fire_delay(aip, temp_shipp, swip, false); - if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) { - swp->burst_counter[current_bank] = myrand() % swip->burst_shots; + if (swip->burst_shots > swp->burst_counter[current_bank]) { + t = set_secondary_fire_delay(aip, temp_shipp, swip, true); + swp->burst_counter[current_bank]++; } else { - swp->burst_counter[current_bank] = 0; + t = set_secondary_fire_delay(aip, temp_shipp, swip, false); + if ((swip->burst_shots > 0) && (swip->burst_flags & WBF_RANDOM_LENGTH)) { + swp->burst_counter[current_bank] = myrand() % swip->burst_shots; + } else { + swp->burst_counter[current_bank] = 0; + } } } + swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f)); } - swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f)); - } - //} + //} + } + swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f)); } - swp->next_secondary_fire_stamp[current_bank] = timestamp((int) (t*1000.0f)); } } } |
|
I attached a patch that uses solution 2) as in when a ship is protected, AI with the disable or disarm order are still allowed to fire their subsystem attacking secondaries. But since this an AI bug I'd like for some tests before this goes in if its even the thing we want. |
|
I'm pretty sure the $Protected on cripple flag should only be affecting ships which had the previous always-on system of protection. I couldn't remove this because of retail compatibility. It is there for a reason though, without it, unless the FREDder takes care of it, the AI will quite happily blow away a ship you've ordered them to disable. If Windmills used the old AI_Profile flag then that was a large mistake on Ransom's part as that flag was part of a deal between me and the Wing Commander Saga team. Where I'd add the flag as a temporary measure in order to allow them to continue development while I coded up a more permanent solution. It was never meant to be used in releases. I think the patch would actually break a lot of missions, especially any where subsystem damage is then passed on to the underlying ship. I had planned to one day code in a ship based override but since no one ever seemed to need it, it slid down the priorities table. |
|
they will still stop on ships with low health |
|
To be honest, I'm not a fan of this solution. If as a FREDder I want to protect a ship, I should be reasonably certain I can do so without having the player come along and order the ship to continue to be attacked. More importantly, pretty much every mission built to date has been made with the above assumption. I can see this breaking numerous missions where the player has to disable a ship. Once the ship is disabled the AI would continue to attack it even though the mission designer had set the ship to be protected. Secondly, there's no off switch for this addition. It will always be on for every mod regardless of what they desired. I think the behaviour in the patch should depend on an objecttypes.tbl flag. This means that once Wanderer's objecttypes code is in trunk not only can the behaviour be switched from the tables but also via FRED. |
|
I talked with kara and we came to the conclusion to commit because attacking is allowed on protected ships when disabling/disarming so secondary behaviour should be the same as primary. |
|
Fix committed to trunk@9447. |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-05-30 02:39 | SDM | New Issue | |
2011-05-30 02:39 | SDM | Status | new => assigned |
2011-05-30 02:39 | SDM | Assigned To | => Sushi_CW |
2011-05-30 03:26 | SDM | File Added: disarm order.fs2 | |
2011-05-30 03:26 | SDM | Note Added: 0012696 | |
2012-12-15 19:45 | MjnMixael | File Deleted: disarm order.fs2 | |
2012-12-15 19:45 | MjnMixael | File Added: disarm order.fs2 | |
2012-12-15 19:46 | MjnMixael | Note Added: 0014474 | |
2012-12-15 20:18 | Sushi_CW | Assigned To | Sushi_CW => |
2012-12-16 18:42 | Valathil | Note Added: 0014486 | |
2012-12-16 18:58 | Valathil | Note Edited: 0014486 | |
2012-12-16 19:55 | Valathil | Note Edited: 0014486 | |
2012-12-16 19:58 | Valathil | Note Edited: 0014486 | |
2012-12-16 22:42 | Valathil | File Added: 2447.patch | |
2012-12-16 22:42 | Valathil | Assigned To | => Valathil |
2012-12-16 22:45 | Valathil | Note Added: 0014489 | |
2012-12-16 22:45 | Valathil | Status | assigned => code review |
2012-12-17 00:58 | karajorma | Note Added: 0014493 | |
2012-12-17 01:03 | Valathil | Note Added: 0014494 | |
2012-12-18 09:45 | karajorma | Note Added: 0014510 | |
2012-12-18 16:53 | Valathil | Note Added: 0014514 | |
2012-12-18 16:54 | Valathil | Changeset attached | => fs2open trunk r9447 |
2012-12-18 16:54 | Valathil | Note Added: 0014515 | |
2012-12-18 16:54 | Valathil | Status | code review => resolved |
2012-12-18 16:54 | Valathil | Resolution | open => fixed |