Login

russian armor

AEF Sniper Help with Targeting Please.

25 Dec 2016, 22:20 PM
#1
avatar of GizmoX64

Posts: 52

A while back before the Brit expansion came out, I made a US Sniper unit based on the pathfinder model, and created a sniper weapon.
Now recently I've been going over my mod and I'd like to make the sniper ignore all vehicles, and only target Infantry.

I've looked over the weapon, but don't see where I could add target type, same with the projectile.

I've tried to add the "usf_vehicle_hold_fire_mp" but that does the reverse of what I want to do.
Now I think I could make it "unit_type = infantry" BUT I don't really want it as an ability you toggle, I just want the sniper to target infantry by default (no ability, as in not taking up a UI Position)

Any help please.

In short: I'd like my Sniper to Target Infantry only all the time.

25 Dec 2016, 22:35 PM
#2
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

Adding an override_weapon_target_prereq_action to the sniper entity's action_apply_ext should do it.

Did you manage to get a tracer effect and loud firing sound similar to the other sniper rifles?
25 Dec 2016, 23:20 PM
#3
avatar of GizmoX64

Posts: 52


Did you manage to get a tracer effect and loud firing sound similar to the other sniper rifles?


Just checked and yep it has the tracer and sniper "pop" sound.

Interesting how it all came about, if I remember right...

I just copied the soviet sniper squad over to the aef, slapped him in a building and done.
But... my buddies like hey you know that's a russian sniper. yea so what.
Well he wanted it to be us, so I just changed the icon and the character image to us Pathfinder.
He didn't like that, cause the model was still russian in game model. oye..
So I pointed the squad file to use the pathfinder model, but then the gun wouldn't show up.
It'd still shot but no actual gun. So I copied the soviet sniper weapon and pointed its model to the pathfinder carbine. Worked from there and my buddy was happy :)

I added the code:

<template_reference name="squadexts" value="sbpextensions\squad_action_apply_ext">
<list name="squad_entity_actions">
</list>
<list name="actions">
<template_reference name="action" value="action\override_weapon_target_prereq_action">
<list name="requirement_table">
</list>
<instance_reference name="weapon_to_override" value="" />
<uniqueid name="id" value="1073745832" />
<bool name="auto_attack_only" value="False" />
<bool name="persist_on_weapon_change" value="False" />
</template_reference>
</list>
</template_reference>

Not sure how it works, is there something I'm missing?
26 Dec 2016, 01:03 AM
#4
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

As I said, add it to the entity. Then, set "auto_attack_only" and "persist_on_weapon_change" to True, insert your weapon into "weapon_to_override" and add a required_unit_type to the requirement_table, with the value set to "infantry".

I've been experimenting with an AEF Sniper using the Lieutenant model with a scoped Garand, but it didn't have any sound or tracers. Gonna have to take a look at that again!
27 Dec 2016, 18:15 PM
#5
avatar of ZombiFrancis

Posts: 2742

You can also play with target prioritization by making the sniper heavily disfavor targetingany unit it can't penetrate. This will still have it target vehicles is there is no other targets. Alternately you could edit the hold fire toggle to also limit the target pool. For instance, you could make hold fire remain hold fire, but have the off toggle setting act like the 'target vehicles only' toggle for tanks but set for only infantry.
31 Dec 2016, 22:42 PM
#6
avatar of Mr.Smith

Posts: 2636 | Subs: 17

You can also play with target prioritization by making the sniper heavily disfavor targetingany unit it can't penetrate. This will still have it target vehicles is there is no other targets. Alternately you could edit the hold fire toggle to also limit the target pool. For instance, you could make hold fire remain hold fire, but have the off toggle setting act like the 'target vehicles only' toggle for tanks but set for only infantry.


If you are referring to setting the over-penetration-penalty to False or something, I think this may have a knock-on effect on what happens when you right-click a garrisoned house. The sniper might actually elect to shoot at the house rather than the people inside the house.

The flag was literally the one thing that was causing the UKF sniper to have exactly that behaviour. It doesn't make sense at all, but toggling that flag was all it took to fix it.
1 Jan 2017, 12:00 PM
#7
avatar of ZombiFrancis

Posts: 2742

That was what I was suggesting with the first part.

Personally I think the second suggestion with a modified hold fire/tanks only setting would work better.
1 Jan 2017, 12:37 PM
#8
avatar of Mr.Smith

Posts: 2636 | Subs: 17

Note that override_weapon_target_prereq_action gets messed up every time the affected unit gets garrisoned.

i.e., your sniper will be targeting just about anything (even infantry casualties). Giving a direct-face command (such as the ability bound to A for HMGs, etc) will restore the override_weapon-target_prereq actions.

It doesn't make any logical sense, and I've no idea how to fix this, but that's how it is.
1 Jan 2017, 15:05 PM
#9
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

Note that override_weapon_target_prereq_action gets messed up every time the affected unit gets garrisoned.

i.e., your sniper will be targeting just about anything (even infantry casualties). Giving a direct-face command (such as the ability bound to A for HMGs, etc) will restore the override_weapon-target_prereq actions.

It doesn't make any logical sense, and I've no idea how to fix this, but that's how it is.


That's lame - another bug that needs fixing.

As a workaround, you could put the override_weapon_target_prereq_action into an interval_action to execute it every few seconds. That might help, but it's probably not very efficient. Better than nothing, though!
5 Feb 2017, 18:35 PM
#10
avatar of GizmoX64

Posts: 52

Man sorry for the delay in responding. I was able to get it working by combining your suggestions.

I took the Target Tanks ability code for "action_list" and changed "unit type = infantry"

Then took that and put it in the sniper squad file:

<template_reference name="squadexts" value="sbpextensions\squad_action_apply_ext">
<list name="squad_entity_actions">
</list>
<list name="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="infantry" />
<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="1073745832" />
<bool name="auto_attack_only" value="False" />
<bool name="persist_on_weapon_change" value="False" />
</template_reference>
</list>
</template_reference>

Works like a charm, thank ya guys.
7 Feb 2017, 17:54 PM
#11
avatar of ZombiFrancis

Posts: 2742

Don't apologise, the mod forum expects delays. ;) But thanks for following up anyway it's good to know what works for future reference!
adx
22 Feb 2017, 01:26 AM
#12
avatar of adx

Posts: 2

Hi GizmoX64. Is there any chance you can share the details of your mod? I'm looking to do something similar and having your work to start with would be helpful :)

Thanks!
22 Feb 2017, 19:15 PM
#13
avatar of WangTangManPro

Posts: 8

hey there
Is there still this bug with units that go into garrison state?
If so maybe i can help.
I made a toggle ability with this override action which is also available in buildings.
(Might work with an always_on ablity too)
22 Feb 2017, 23:27 PM
#14
avatar of GizmoX64

Posts: 52

jump backJump back to quoted post22 Feb 2017, 01:26 AMadx
Hi GizmoX64. Is there any chance you can share the details of your mod? I'm looking to do something similar and having your work to start with would be helpful :)

Thanks!


I've made a ton of changes, it's currently only for friends.
I can upload just my sniper file as raw files, that you can incorporate into your mod by changing the MOD ID string.
adx
23 Feb 2017, 07:46 AM
#15
avatar of adx

Posts: 2



I've made a ton of changes, it's currently only for friends.
I can upload just my sniper file as raw files, that you can incorporate into your mod by changing the MOD ID string.


Thanks. I finally got my own pathfinder mode working but I'd like to see what differences you have as well :) Any chance you can post it on github somewhere?
23 Feb 2017, 13:17 PM
#16
avatar of GizmoX64

Posts: 52

jump backJump back to quoted post23 Feb 2017, 07:46 AMadx


Thanks. I finally got my own pathfinder mode working but I'd like to see what differences you have as well :) Any chance you can post it on github somewhere?


Here's a snapshot of the entire mod, no source, just a playable mod where you can see what you like and incorporate your take on it into your mod.
It's all AEF changes cause I only play US forces, and they are pretty OP, so play the AI on Hard or Expert modes. Or easy to see what I changed. I used to keep a change log of everything but it just got to big and I spent more time updating the change log then I did modding.

Overall, the US can build about everything, and I've grabbed other faction units and made them Allied Unit Here, or Captured Unit Here. Take anything you like.

Sent you link.
If you like the Pathfinder Sniper Squad (2nd building, 1st icon) you'll love the Special Forces Squad I made (Forward HQ Allied Tent [buildable by Assault Engineers], 2nd row, 4th icon)
Have fun :)
26 Feb 2017, 00:10 AM
#17
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

hey there
Is there still this bug with units that go into garrison state?
If so maybe i can help.
I made a toggle ability with this override action which is also available in buildings.
(Might work with an always_on ablity too)

I think it does still exist, so I'd be very interested in how you did that!
26 Feb 2017, 12:26 PM
#18
avatar of Mr.Smith

Posts: 2636 | Subs: 17

hey there
Is there still this bug with units that go into garrison state?
If so maybe i can help.
I made a toggle ability with this override action which is also available in buildings.
(Might work with an always_on ablity too)


Give!

We could also use your toggle ability to fix the raketenwerfer bug.
26 Feb 2017, 18:12 PM
#19
avatar of WangTangManPro

Posts: 8

its very simple
just make a toggle ability
add the action\override_weapon_target_prereq_action
with your prefered target

and change "enable_in_building" to "True"
you might also want to change "enable_in_vehicle" to "True"

the ability will stay put when the unit enter a building or a vehicle and you can turn it off and on from inside

PS: it might be possible to make it a passiv ability too
gonna test it


ok tested it. as Passiv its not working. but maybe im doing something wrong
26 Feb 2017, 21:18 PM
#20
avatar of Mr.Smith

Posts: 2636 | Subs: 17

Even if you enable the ability to work in a garrison, you're only making the toggle visible. However, I think there's some hardcoded behaviour that takes over when squads enter garrisons; they no longer respect prioritisation etc.

In fact, they start auto-attacking casualties, etc.

The only way I've managed to get those squads to respect prioritization in the building is if I'm using force facing (A + click command for MGs).
1 user is browsing this thread: 1 guest

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

791 users are online: 791 guests
0 post in the last 24h
5 posts in the last week
33 posts in the last month
Registered members: 49149
Welcome our newest member, Yeatonks
Most online: 2043 users on 29 Oct 2023, 01:04 AM