Login

russian armor

"prefer vehicles" for infantry anti-tank weapons?

15 Nov 2021, 06:29 AM
#1
avatar of trigg

Posts: 139

I hacked an existing prefer-vehicles ability to apply to bazookas, piats, and shreks, but didn't get any change in behavior. Maybe I did something wrong. Has anyone made this work?
15 Nov 2021, 07:23 AM
#2
avatar of Sie_Sayoka
Modmaker Badge

Posts: 100 | Subs: 1

Override_weapon_target_prereq_action will only attack the target unit types within the requirement_table. The name is misleading as there are no priorities involved and any unit types that are not in the requirements will be ignored. This action is bugged and will not work when in garrisons.

Possible reasons why it's not working for you is that the squad_caster or target is incorrect, the requirements are not met for the ability, or the ability is applied in an incorrect way. Can you share how you modified the ability and what you put it on?
15 Nov 2021, 13:09 PM
#3
avatar of trigg

Posts: 139

Thanks. I'm going to post the xml so you can plug it in somewhere and view it with the attribute editor.

The "!" comments are to highlight various sections so I can find them easily. Hopefully I flagged all the changes that way.

Let's see how well this posts...


<instance description="" template="abilities">
<group name="ability_bag">
<group name="action_list" comment="!">
<list name="end_self_actions">
</list>
<list name="end_target_actions">
</list>
<list name="start_self_actions">
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
<template_reference name="required" value="requirements\required_unit_type">
<enum name="reason" value="usage" />
<locstring name="ui_name" value="0" />
<enum name="unit_type" value="vehicle" />
<template_reference name="qualify_option" value="options\requirements\required_unit_type_option\any">
<int name="min_count" value="1" />
</template_reference>
<bool name="search_load_out" value="True" />
<bool name="owned_by_player_only" value="False" />
</template_reference>
</list>
<instance_reference name="weapon_to_override" value="weapon\aef\ballistic_weapon\infantry_anti_tank_weapon\m9_bazooka_mp" mod="57e9a3417cc349c4be018ad7a00e2b03" />
<uniqueid name="id" value="1073780543" />
<bool name="auto_attack_only" value="True" />
<bool name="persist_on_weapon_change" value="True" />
</template_reference>
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
<template_reference name="required" value="requirements\required_unit_type">
<enum name="reason" value="usage" />
<locstring name="ui_name" value="0" />
<enum name="unit_type" value="vehicle" />
<template_reference name="qualify_option" value="options\requirements\required_unit_type_option\any">
<int name="min_count" value="1" />
</template_reference>
<bool name="search_load_out" value="True" />
<bool name="owned_by_player_only" value="False" />
</template_reference>
</list>
<instance_reference name="weapon_to_override" value="weapon\aef\ballistic_weapon\infantry_anti_tank_weapon\m9_bazooka_paratrooper_mp" mod="57e9a3417cc349c4be018ad7a00e2b03" />
<uniqueid name="id" value="1073780544" />
<bool name="auto_attack_only" value="True" />
<bool name="persist_on_weapon_change" value="True" />
</template_reference>
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
<template_reference name="required" value="requirements\required_unit_type">
<enum name="reason" value="usage" />
<locstring name="ui_name" value="0" />
<enum name="unit_type" value="vehicle" />
<template_reference name="qualify_option" value="options\requirements\required_unit_type_option\any">
<int name="min_count" value="1" />
</template_reference>
<bool name="search_load_out" value="True" />
<bool name="owned_by_player_only" value="False" />
</template_reference>
</list>
<instance_reference name="weapon_to_override" value="weapon\axis\ballistic_weapon\infantry_anti_tank_weapon\panzerschreck_atw_mp" mod="57e9a3417cc349c4be018ad7a00e2b03" />
<uniqueid name="id" value="1073780545" />
<bool name="auto_attack_only" value="True" />
<bool name="persist_on_weapon_change" value="True" />
</template_reference>
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
<template_reference name="required" value="requirements\required_unit_type">
<enum name="reason" value="usage" />
<locstring name="ui_name" value="0" />
<enum name="unit_type" value="vehicle" />
<template_reference name="qualify_option" value="options\requirements\required_unit_type_option\any">
<int name="min_count" value="1" />
</template_reference>
<bool name="search_load_out" value="True" />
<bool name="owned_by_player_only" value="False" />
</template_reference>
</list>
<instance_reference name="weapon_to_override" value="weapon\aef\ballistic_weapon\infantry_anti_tank_weapon\m9_bazooka_mp" mod="57e9a3417cc349c4be018ad7a00e2b03" />
<uniqueid name="id" value="1073780546" />
<bool name="auto_attack_only" value="True" />
<bool name="persist_on_weapon_change" value="True" />
</template_reference>
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
<template_reference name="required" value="requirements\required_unit_type">
<enum name="reason" value="usage" />
<locstring name="ui_name" value="0" />
<enum name="unit_type" value="vehicle" />
<template_reference name="qualify_option" value="options\requirements\required_unit_type_option\any">
<int name="min_count" value="1" />
</template_reference>
<bool name="search_load_out" value="True" />
<bool name="owned_by_player_only" value="False" />
</template_reference>
</list>
<instance_reference name="weapon_to_override" value="weapon\west_german\ballistic_weapon\infantry_anti_tank_weapon\panzerschreck_54_atw_mp" mod="57e9a3417cc349c4be018ad7a00e2b03" />
<uniqueid name="id" value="1073780547" />
<bool name="auto_attack_only" value="True" />
<bool name="persist_on_weapon_change" value="True" />
</template_reference>
</list>
<list name="start_target_actions" comment="!">
</list>
</group>
<enum name="activation" value="always_on" comment="!" />
<bool name="can_interrupt" value="True" />
<bool name="can_target_in_fow" value="False" />
<float name="caster_close_in_distance" value="2" />
<bool name="casters_can_evacuate" value="False" />
<group name="cost">
<float name="action" value="0" />
<float name="command" value="0" />
<float name="fuel" value="0" />
<float name="manpower" value="0" />
<float name="munition" value="0" />
<float name="popcap" value="0" />
</group>
<string name="cursor_ghost_blueprint" value="" />
<float name="cursor_ghost_blueprint_angle" value="0" />
<bool name="disable_combat" value="False" />
<bool name="disable_when_active" value="True" />
<float name="duration_time" value="-1" comment="!" />
<bool name="enable_in_building" value="True" comment="!" />
<bool name="enable_in_vehicle" value="True" comment="!" />
<bool name="engage_combat" value="False" />
<float name="entity_busy_time" value="0" />
<float name="facing_angle" value="5" />
<bool name="facing_ignore" value="False" />
<float name="final_close_in_distance" value="0" />
<bool name="fire_and_forget" value="False" />
<bool name="garrison_target" value="False" />
<bool name="has_speech_code" value="False" comment="!" />
<float name="initial_delay_time" value="0" />
<bool name="initial_recharge" value="False" />
<bool name="is_default_action" value="False" />
<bool name="move_back" value="False" />
<float name="move_back_distance" value="10" />
<float name="range" value="0" />
<bool name="range_ignore" value="True" />
<float name="recharge_time" value="0" />
<bool name="refundable" value="True" />
<bool name="require_no_shot_block" value="False" />
<enum name="shared_timer" value="" />
<bool name="shared_timer_player_wide" value="False" />
<group name="speech_code_2">
<string name="code_1" value="hf" />
<string name="code_2" value="" />
<string name="code_3" value="" />
</group>
<group name="speech_code_3">
<string name="code_1" value="" />
<string name="code_2" value="" />
<string name="code_3" value="" />
</group>
<enum name="squad_caster" value="one_entity" />
<enum name="target" value="tp_squad" />
<group name="target_special_validation">
<template_reference name="target_special_validation" value="type_ability_target_type\all">
</template_reference>
</group>
<float name="toggled_recharge_time_off" value="0" />
<float name="toggled_recharge_time_on" value="1" />
<group name="ui_cursor">
<string name="cursor_bad" value="modal_ability_cancel" />
<string name="cursor_good" value="modal_ability" />
<string name="cursor_nonmodal_good" value="" />
</group>
<group name="ui_info">
<locstring name="extra_text" value="11077803" />
<locstring name="help_text" value="11077804" />
<string name="hotkey_name" value="H" />
<icon name="icon_name" value="Icons_abilities_ability_aef_priority_targeting_on" />
<string name="overlay_name" value="" />
<bool name="reveal_for_decryption" value="False" />
<locstring name="screen_name" value="11077806" />
<icon name="icon_alternate_name" value="Icons_abilities_ability_aef_priority_targeting_off" />
<locstring name="brief_text" value="0" />
<locstring name="help_text_alternate" value="11077805" />
<locstring name="screen_name_alternate" value="11077807" />
<locstring name="screen_name_short" value="0" />
</group>
<locstring name="ui_usage_txt" value="0" />
<bool name="validate_actions" value="True" />
<list name="global_self_actions">
</list>
<list name="requirements">
</list>
<enum name="ability_super" value="tp_none" />
<int name="ui_position" value="24" comment="!" />
<bool name="ui_mini_map_capture" value="False" />
<bool name="facing_ignore_during_active" value="False" />
<instance_reference name="ui_range" value="" />
<instance_reference name="ui_reticule" value="" />
<float name="ui_reticule_radius_min" value="1" />
<float name="ui_reticule_radius_max" value="1" />
<enum name="pending_ability_out_of_range_behaviour" value="stop" comment="!" />
<enum name="ui_group" value="group_primary" />
<string name="ui_targetable_sm_key" value="" />
<string name="ui_targetable_on_key" value="" />
<string name="ui_targetable_off_key" value="" />
<enum name="ui_targetable_receiver" value="local" />
<enum name="ui_combine_type" value="intersection" />
<enum_table name="ui_modal_highlight">
<bool name="world_sector" value="False" />
<bool name="map_sector" value="False" />
<bool name="map_sector_hq_link_extender" value="False" />
</enum_table>
<enum name="ui_group_cast_type" value="multi" />
<list name="requirements_target">
</list>
<template_reference name="targeted_ability_option" value="options\none">
</template_reference>
<enum name="ui_direction_requirement" value="nondirectional" />
<instance_reference name="cursor_ghost_ebp" value="" />
<bool name="can_cast_whilst_constructing" value="True" />
<list name="requirements_self_recharge">
</list>
<bool name="can_cast_outside_active_battle_field" value="True" />
<bool name="ability_super_event_cue" value="False" />
</group>
<uniqueid name="pbgid" value="1073741869" />
</instance>
15 Nov 2021, 15:00 PM
#4
avatar of Sie_Sayoka
Modmaker Badge

Posts: 100 | Subs: 1

What is the purpose of having 5 identical override actions? Also, many of these commented changes don't work with always_on as far as I know.

If I'm reading this right you want an always_on ability that will only target vehicles. Luckily I use one of these within my mod although it targets a different unit type and is only an entity without a squad. I don't think it should matter though.

<instance description="vehicle hold fire Ability specific to the OKW Raketenwerfer" template="abilities">
<group name="ability_bag">
<group name="action_list">
<list name="end_self_actions">
</list>
<list name="end_target_actions">
</list>
<list name="start_self_actions">
<template_reference name="action" value="action\ui_unit_modifier_action">
<bool name="die_with_creator" value="True" />
<template_reference name="ui_info" value="tables\ui_info">
<locstring name="screen_name" value="0" />
<locstring name="help_text" value="0" />
<icon name="icon_name" value="Icons_abilities_hold_fire_on" />
<string name="hotkey_name" value="" />
</template_reference>
<uniqueid name="id" value="1073754249" />
</template_reference>
</list>
<list name="start_target_actions">
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
<template_reference name="required" value="requirements\required_unit_type">
<enum name="reason" value="usage" />
<locstring name="ui_name" value="0" />
<enum name="unit_type" value="bangalore" />
<template_reference name="qualify_option" value="options\none">
</template_reference>
<bool name="search_load_out" value="False" />
<bool name="owned_by_player_only" value="True" />
</template_reference>
</list>
<instance_reference name="weapon_to_override" value="" />
<uniqueid name="id" value="1073754250" />
<bool name="auto_attack_only" value="True" />
<bool name="persist_on_weapon_change" value="True" />
</template_reference>
</list>
</group>
<enum name="activation" value="always_on" />
<bool name="can_interrupt" value="True" />
<bool name="can_target_in_fow" value="False" />
<float name="caster_close_in_distance" value="2" />
<bool name="casters_can_evacuate" value="False" />
<group name="cost">
<float name="action" value="0" />
<float name="command" value="0" />
<float name="fuel" value="0" />
<float name="manpower" value="0" />
<float name="munition" value="0" />
<float name="popcap" value="0" />
</group>
<string name="cursor_ghost_blueprint" value="" />
<float name="cursor_ghost_blueprint_angle" value="0" />
<bool name="disable_combat" value="False" />
<bool name="disable_when_active" value="False" />
<float name="duration_time" value="3" />
<bool name="enable_in_building" value="False" />
<bool name="enable_in_vehicle" value="False" />
<bool name="engage_combat" value="True" />
<float name="entity_busy_time" value="0" />
<float name="facing_angle" value="5" />
<bool name="facing_ignore" value="False" />
<float name="final_close_in_distance" value="0" />
<bool name="fire_and_forget" value="False" />
<bool name="garrison_target" value="False" />
<bool name="has_speech_code" value="False" />
<float name="initial_delay_time" value="10" />
<bool name="initial_recharge" value="False" />
<bool name="is_default_action" value="False" />
<bool name="move_back" value="False" />
<float name="move_back_distance" value="10" />
<float name="range" value="0" />
<bool name="range_ignore" value="True" />
<float name="recharge_time" value="0" />
<bool name="refundable" value="True" />
<bool name="require_no_shot_block" value="False" />
<enum name="shared_timer" value="" />
<bool name="shared_timer_player_wide" value="False" />
<group name="speech_code_2">
<string name="code_1" value="hf" />
<string name="code_2" value="" />
<string name="code_3" value="" />
</group>
<group name="speech_code_3">
<string name="code_1" value="" />
<string name="code_2" value="" />
<string name="code_3" value="" />
</group>
<enum name="squad_caster" value="one_entity" />
<enum name="target" value="tp_squad" />
<group name="target_special_validation">
<template_reference name="target_special_validation" value="type_ability_target_type\all">
</template_reference>
</group>
<float name="toggled_recharge_time_off" value="0" />
<float name="toggled_recharge_time_on" value="1" />
<group name="ui_cursor">
<string name="cursor_bad" value="modal_ability_cancel" />
<string name="cursor_good" value="modal_ability" />
<string name="cursor_nonmodal_good" value="" />
</group>
<group name="ui_info">
<locstring name="extra_text" value="0" />
<locstring name="help_text" value="0" />
<string name="hotkey_name" value="P" />
<icon name="icon_name" value="Icons_abilities_ability_common_face_team_weapon" />
<string name="overlay_name" value="" />
<bool name="reveal_for_decryption" value="False" />
<locstring name="screen_name" value="0" />
<icon name="icon_alternate_name" value="Icons_abilities_ability_common_cancel_face_team_weapon" />
<locstring name="brief_text" value="0" />
<locstring name="help_text_alternate" value="0" />
<locstring name="screen_name_alternate" value="0" />
<locstring name="screen_name_short" value="0" />
</group>
<locstring name="ui_usage_txt" value="0" />
<bool name="validate_actions" value="False" />
<list name="global_self_actions">
</list>
<list name="requirements">
</list>
<enum name="ability_super" value="tp_none" />
<int name="ui_position" value="23" />
<bool name="ui_mini_map_capture" value="False" />
<bool name="facing_ignore_during_active" value="False" />
<instance_reference name="ui_range" value="" />
<instance_reference name="ui_reticule" value="" />
<float name="ui_reticule_radius_min" value="1" />
<float name="ui_reticule_radius_max" value="1" />
<enum name="pending_ability_out_of_range_behaviour" value="chase" />
<enum name="ui_group" value="group_primary" />
<string name="ui_targetable_sm_key" value="" />
<string name="ui_targetable_on_key" value="" />
<string name="ui_targetable_off_key" value="" />
<enum name="ui_targetable_receiver" value="local" />
<enum name="ui_combine_type" value="intersection" />
<enum_table name="ui_modal_highlight">
<bool name="world_sector" value="False" />
<bool name="map_sector" value="False" />
<bool name="map_sector_hq_link_extender" value="False" />
</enum_table>
<enum name="ui_group_cast_type" value="multi" />
<list name="requirements_target">
</list>
<template_reference name="targeted_ability_option" value="options\none">
</template_reference>
<enum name="ui_direction_requirement" value="nondirectional" />
<instance_reference name="cursor_ghost_ebp" value="" />
<bool name="can_cast_whilst_constructing" value="False" />
<list name="requirements_self_recharge">
</list>
<bool name="can_cast_outside_active_battle_field" value="False" />
<bool name="ability_super_event_cue" value="False" />
</group>
<uniqueid name="pbgid" value="1073741940" />
</instance>


This is a modified clone of the okw_ratken_vehicle_hold_fire_mp toggle ability. You can change the bangalore unit type to vehicle. I believe the only changes are the requirements, start_self_actions, and activation. I'm not entirely sure what the exact issue of your ability is but ensure that it is given to the entity that is holding the RPG.
17 Nov 2021, 09:19 AM
#5
avatar of trigg

Posts: 139

Thanks.

The overrides are supposed to be weapon-specific. I see that I got the bazooka in the list twice.

I'll have to figure out how to assign it to the entity holding the rocket launcher. The rl comes to the squad via an upgrade, and I want the rest of the squad to still shoot at non-vehicles.

As a different matter, I also want to stop squads from shooting at things they can't hurt, e.g. flamethrowers and small arms vs. tanks.
17 Nov 2021, 13:59 PM
#6
avatar of Sie_Sayoka
Modmaker Badge

Posts: 100 | Subs: 1

I think you can put the ability on the entity then have the slot item as a requirement on that ability. If that doesn't work you can make a clone of the infantry unit and have it be the only one that spawns with a bazooka.

To have infantry not target tanks you can use not>required_unit_type. Of course this wouldn't actually check if the unit can be damaged or not so you'll have to make sure that the penetration and armor values of the things you want affected are accounted for.
N/A
19 Nov 2021, 14:41 PM
#7
avatar of N/A

Posts: 29

To perform the team toggle ability on a team with plural entities, try to divide the toggle ability into two parts

Your need is to hold Infantry squad at weapon and use prefer-vehicles ability
1. copy "usf_vehicle_hold_fire_mp"
2. Modify squad_caster => squad
target => tp_squad
3. Remove Override_weapon_target_prereq_action of start_target_actions
4. Add an "upgrade_add" to squad in start_self_actions
"Upgrade_remove" in end_self_actions
5. Add "required_any_in_list"/required_slot_item (the weapon slot_item set to use) in the requirements (if not limited to a specific weapon to use, don't need this item)
6. Put this ability in squad_ability_ext
Then build another ability
1. Create an "aways_on_ability" (can copy "medic_auto_heal")
2. Modify squad_caster => ont_entity
target => tp_entity
3. Remove the content of action_list, and add "Override_weapon_target_prereq_action" to start_target_actions
4. Add"required_any_in_list"/required_active_weapon/hardpoint_name=>hardpoint_01 in requirements
weapon => (the weapon you set to use)
Add required_squad_upgrade(toggle ability upgrade_add)
5. Put this ability in the entity ability_ext of the squad

When the squad uses the toggle ability, it will get an upgrade, and the entity also has required_squad_upgrade and required_active_weapon to perform aways_on_ability

WWII MOD

The infantry squad in this mod is made using the above-mentioned method. With M9 Bazooka, PIAT Launcher, and Panzerschreck, will get a toggle ability, which can restrict these three weapons to target vehicle.

Dividing the toggle ability into two parts can solve the problem of the team losing the toggle ability after Reinforce (for example, the commando squad uses Hold Fire to fail after Reinforce) aways_on_ability will be executed once after Reinforce.

My English is not good, and I may not be able to express it correctly.
5 Dec 2021, 09:24 AM
#8
avatar of trigg

Posts: 139

Thanks. My first attempt at implementing it didn't work, but I'll try again when I have time to work on the mod.
0 user is browsing this thread:

Ladders Top 10

  • #
    Steam Alias
    W
    L
    %
    Streak
Data provided by Relic Relic Entertainment

Replay highlight

VS
  • U.S. Forces flag cblanco ★
  • The British Forces flag 보드카 중대
  • Oberkommando West flag VonManteuffel
  • Ostheer flag Heartless Jäger
uploaded by XXxxHeartlessxxXX

Board Info

698 users are online: 698 guests
0 post in the last 24h
8 posts in the last week
37 posts in the last month
Registered members: 49098
Welcome our newest member, Coh2_Relaxed
Most online: 2043 users on 29 Oct 2023, 01:04 AM