Login

russian armor

on_loaded_hold_actions on a halftrack

15 Nov 2015, 14:21 PM
#1
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

I have added an MG42 to the Sd.Kfz. 250, and I want it to be crewed and functional only when a squad is garrisoned. Here's what I did to achieve that so far:

1. In combat_ext, I added a (disabled) MG42 on hardpoint one:
attributes\weapon\axis\small_arms\machine_gun\light_machine_gun\halftrack_250_dummy
(receives_attack_commands set to True. I also edited sdkfz_250.abp to make it actually visible.)

2. In crew_ext, I added another crewman in the second role:
armies\german\soldiers\vehicle_crew\vehicle_crew
(role_name set to Gunner, sync_on_create set to False.)

This gives me a 250 with an uncrewed MG42 and only a driver inside, just like I wanted. Screenshot

3. In hold_ext/on_loaded_hold_actions, I added two things:

3.1 add_crew_action, crew_name set to Gunner
(To make the second crewman actually appear.)

3.2 change_weapon, weapon set to:
attributes\weapon\west_german\small_arms\machine_gun\light_machine_gun\sdkfz_251_mg42_mp
(To make the MG42 actually functional.)

When I garrison a squad, a second crew member appears, but his position and posture is screwed up. Also, the MG42 doesn't fire at all. Screenshot
I know that both the gunner and the new weapon work properly on this vehicle when I add them permanently. So it must have something to do with step three, I guess!

Additionally, when I unload the squad, the gunner doesn't disappear like he should. Screenshot

The description of on_loaded_hold_actions says:
"Actions to execute on the HOLD when there are loadedgarrisoned troops inside These actions are reverted when troops are unloaded"

Does anyone have any experience with this? Did I do something fundamentally wrong or are these attributes just not fully functional?

Any help is greatly appreciated!
15 Nov 2015, 14:38 PM
#2
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

3.1. You should be using apply_crew_action, as that acts as a toggle.

3.2. Rather than changing weapon, you should be adding a slot item. Alternatively, you could enable/disable the weapon with modifiers (you would need to have it disabled in action_apply_ext so that it starts that way). Relic actually does this for the 251, so take a look in there.

15 Nov 2015, 17:46 PM
#3
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

I can make the gunner appear and disappear as intended now. Thanks a lot!
I'm still having some trouble with the MG though.

First, I made a slot item removing the gunner and containing the "dummy" MG42 that doesn't move or fire and gave that one to the 250 when it spawns. That's working as intended.

Then, I made another slot item adding the gunner and containing a functional MG42. on_loaded_hold_actions then removes the first slot item and adds the other one after that. This is working as well.

When the garrisoned squad unloads, I want to remove the second slot item and add the first one again. This doesn't seem to be possible though, or at least I couldn't figure out how. Do you know any way to do this, or something similar? Is there maybe a way for a unit to have two slot items, but only use one at a time?

Sorry for bothering you with these newb questions. I really appreciate your help!
15 Nov 2015, 18:39 PM
#4
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

Take a look at the 251, which does not use slot items. It uses a modifier to disable the weapon. Do that, and make sure you do not have a dummy weapon. You can just use the same modifier to disable it in action apply ext.
15 Nov 2015, 22:03 PM
#5
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

Everything works as intended now, including the animations. Thanks a lot for your help!
Dar
15 Nov 2015, 23:12 PM
#6
avatar of Dar

Posts: 84

This is awesome, I've wanted to do a 250 with MG for a long time but non of my attempts so far were successful.
I tried to reproduce your steps, just with a gunner by default on it and it shows up as intended, however when the MG is trying to fire the first shot, the game will CTD without warning and the .log holds no information on the crash. Any idea why that could be?

I've added the additional crewman, the additional mg42 (not a dummy in my case) on hardpoint 1, edited the .abp to show the weapon and applied a mg42 slot item on the entity.

EDIT: Nevermind, I fixed it. Some error in the reproduction process. Anyway, thanks for the intel on that topic.
16 Nov 2015, 10:25 AM
#7
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

Good for you! It really is a shame that the unit is so horrible by default. I think it has a lot of potential, and it doesn't take that much effort to make it useful. Would be nice if a Relic employee just took 30 minutes and gave it a try.

If you add an MG to hardpoint 1 and use a slot item as well, you basically have two guns on the unit, with (probably) only one used. If you want a permanent MG42 on it, adding it to hardpoint 1 manually is enough. You don't need to bother with a slot item in that case!
18 Nov 2015, 21:56 PM
#8
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

The only thing I never figured out is how to make the crew disappear when unmanned. They just go into a fetal position, since Relic did not really intend for them to be hidden (other than making a canopy for the 251).
20 Nov 2015, 14:39 PM
#9
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

Also, if you decrew and then recrew a vehicle, the weapon states reset for some reason - even though they are disabled.
1 Dec 2015, 22:22 PM
#10
avatar of Dreadbot
Donator 11

Posts: 94

Seems as though they didn't fully account for vehicle abandonment when updating the game engine for CoH2. Sigh...
1 Dec 2015, 23:39 PM
#11
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

It works the way they intended, which is different from what modders intend. CoH1 isn't even on the same level as CoH2 as far as decrewing/recrewing.
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

216 users are online: 3 members and 213 guests
Crecer13, NorthWeapon, Tiger Baron
17 posts in the last 24h
43 posts in the last week
97 posts in the last month
Registered members: 44644
Welcome our newest member, felayo364
Most online: 2043 users on 29 Oct 2023, 01:04 AM