Login

russian armor

Random MGs for German factions

14 Nov 2016, 20:28 PM
#1
avatar of TheWise

Posts: 31

Actually, topic.

Managed to make the MGs, obtained by Grenadiers and Panzergrenadiers via respective upgrades, random - either MG-34 or MG-42 with 50/50 probability (using the add_slot_item as action_choice in random_action).

But my attempt to do the same trick with HMG teams (i.e. to make them having the MG-34 or MG-42 HMG randomly) using the add_to_squad_loadout as action_choice part of random_action failed - the team merely appeared on the battlefield without any HMG, with just their MP-40. Have already tried playing around with .abp files - still nothing.

Any ideas? Have anybody done this successfully?
15 Nov 2016, 10:07 AM
#2
avatar of Mr.Smith

Posts: 2636 | Subs: 17

I have no idea about this. However, I think that the MG team needs to "attach" themselves to the MG the moment they spawn. Thus I don't think you can give them a randomized MG that way.

The easy way to fix this is replace the unit-building option with an upgrade. For this, you can draw on the way the Captain is fielded for inspiration: When the captain upgrade finishes, the captain appears on the battlefield.

In your case, you can make it that your upgrade has a 50% chance of spawning an MG-34 team or a 50% chance of spawning an MG-42 team.

A downside of going for the upgrade-only route is that the player cannot see the progress bar of the MG being made (on the top right). However, this is way easier to implement, and it should always work.

Otherwise (and if you have the time to spare), your solution could look like this:
- Create a dummy squad with the MG icon and everything, that the player has to build to get access to MGs
- The moment the dummy squad spawns, you execute an action that spawns your real squad and deletes the dummy squad
To make the real squad spawn from the production building, you need to make it into a filter action (for hq_mp)
- For an example of how to implement a filter action look for the OKW Medic upgrade. Just make sure you remove the "apply to future units" flag
- Inside the filter action, you will have your 50/50 chance thing, and you can spawn your real MG in the same way that the Captain spawns

Note that I am not sure whether the spawned MG squad will respect the rally point set by the production building.

I hope that works!
21 Nov 2016, 18:43 PM
#3
avatar of kwok

Posts: 60

One workaround maybe is to have two different types of squads and make it a call in ability randomizing which of the two come out.
21 Nov 2016, 18:59 PM
#4
avatar of Vuther
Senior Moderator Badge

Posts: 3103 | Subs: 1

jump backJump back to quoted post21 Nov 2016, 18:43 PMkwok
One workaround maybe is to have two different types of squads and make it a call in ability randomizing which of the two come out.

That's a great idea which should work. Instead of making it a spawner item, make it a call-in ability within the building.
21 Nov 2016, 19:10 PM
#5
avatar of TheWise

Posts: 31

jump backJump back to quoted post21 Nov 2016, 18:59 PMVuther

That's a great idea which should work. Instead of making it a spawner item, make it a call-in ability within the building.


Hmmm ... really, it could work. Just let me itemize - "call-in ability inside the building" is like one for dispatching the Captain or Major for USF?
21 Nov 2016, 19:19 PM
#6
avatar of Vuther
Senior Moderator Badge

Posts: 3103 | Subs: 1

jump backJump back to quoted post21 Nov 2016, 19:10 PMTheWise


Hmmm ... really, it could work. Just let me itemize - "call-in ability inside the building" is like one for dispatching the Captain or Major for USF?

I haven't tried it myself, but I suppose you should be able to adapt the method for it from that by removing the parts that relate giving you an upgrade that makes you able to access the Platoon/Company/Battalion Company Posts and, of course, changing the LT/Capt/Major to the HMG teams. Take a look at the Mobile Defense Doctrine's Osttruppen call-in ability to see if that'll help you implement in the randomization you want - or it just might be easier to start from that ability and add the random HMG ability to the building you want to build random HMGs out of.
22 Nov 2016, 16:25 PM
#7
avatar of sage1337

Posts: 87

"Mobile Defense Doctrine's Osttruppen call-in ability"
But that's just doctrine ability, so OP can do it only in one doctrine - from what I understand, he wants to have it with every doctrine, in the building.
BTW did anyone try to add USF's-officer-like units? I mean, for example I build OKW's Flaktrack building and the moment it builds, Sturm offizier is dispatched. How to do it?
22 Nov 2016, 20:04 PM
#8
avatar of Planet Smasher
Senior Modmaker Badge

Posts: 632 | Subs: 1

"Mobile Defense Doctrine's Osttruppen call-in ability"
But that's just doctrine ability, so OP can do it only in one doctrine - from what I understand, he wants to have it with every doctrine, in the building.

It's an ability, so it doesn't matter if the button appears in a building or the command bar. It's only a commander ability because of its requirements.

BTW did anyone try to add USF's-officer-like units? I mean, for example I build OKW's Flaktrack building and the moment it builds, Sturm offizier is dispatched. How to do it?

Unlocking USF tiers works via abilities as well - have a look at how they work. Or you could just add a reinforcements_action to the Flak HQ's on_construction_actions (in construction_ext).
1 user is browsing this thread: 1 guest

Livestreams

Germany 11

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

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