• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

How to do unit weapon swaps?

Golf33

Member
I'm working on an army for 40K and having some trouble as I'm new at this.

Here's what I'm trying to do.

A particular unit normally comes with a pistol and sword.
The whole unit can swap the pistol and sword for a rifle for free.
For every ten members of the unit, one member can swap their pistol or rifle for a machine gun (keeping the sword if they still had one), for x pts per machine gun.

So if we take the simplest example using a unit size of 10, the valid options are:

10 with rifle
OR 9 with rifle plus 1 with MG
OR 10 with pistol and sword
OR 9 with pistol and sword plus 1 with MG and sword

With a unit size of 20, the valid options would be:

20 with rifle
OR 18-19 with rifle plus 1-2 with MG
OR 20 with pistol and sword
OR 18-19 with pistol and sword plus 1-2 with MG and sword

I've been able to implement the 1 per 10 limit on MGs by creating a new unit stat (NoOfMGs) in the AUG file, an exclusion group (ExMGs) with the range of 0-@NoOfMGs, and using the unit pre-link script to set NoOfMGs for the unit.

I can also use remainders to make the number of pistols decrease when the use adds MGs to the unit.

I can also use remainders and exclusion groups to allow the user to replace pistol & sword with rifle one at a time (which is annoying for the user and leads to an illegal unit with a mix of pistol & sword and rifle). However when the user does this, the number of rifles seems to count against the number of MGs allowed so they have to reduce the number of rifles in order to add MGs.

What I would like to do and can't figure out is provide the user with a single option that they can select to choose between pistol/sword (with the MGs reducing the number of pistols but not the number of swords) or rifle for all squad members at once.

Regards & be nice to the newbie!
 
At 06:26 AM 11/13/2007, you wrote:
What I would like to do and can't figure out is provide the user with a single option that they can select to choose between pistol/sword (with the MGs reducing the number of pistols but not the number of swords) or rifle for all squad members at once.
I think you just outlined exactly the solution you need in the above sentence. :-) Simply create a new option that is named something like "Use Rifles". This option assigns a tag to the parent unit to indicate when it's selected. Have separate options for Rifles and Pistol/Sword that are of type "auto". Each of these options should based its visibility on the presence or absence of the tag. Let the user select machine guns as you already have working. Then you can have the count of Rifles or Pistols/Swords be based on the remainder count after the machine guns have been selected.

The only special requirement of this approach is that the optoin to select "Use Rifles" must occur at an earlier priority than all the other options. That way, the tag will be assigned properly before subsequent options test for its existence.
 
Thanks Rob. I actually did get this working about a week ago, pretty much as you describe.

The unit starts with a tag that says it has pistols, with an Option to 'Swap to rifles' which deletes the pistol tag.

Two exclusion groups, 'combat' and 'shooting', both #-#.
Then there's an option for pistols, remainder 'shooting' and live expression testing for the pistols tag; an option for swords, remainder 'combat', and live expression also testing for the pistols tag; and an option for the rifles, remainder 'shooting' and testing for the absence of the pistol tag.

The machine guns then count as 1 against the 'shooting' exclusion group, so taking them decrements the count of pistols without affecting the count of swords.

I also had to do a little work to get the 1-per-10 restriction working for MGs. I made up a unit stat ('MGs') with a third exclusion group 'heavies' which was 0-@MGs. In the prelink script for the unit I set stat MGs to the max number of MGs based on the unit effective count, and made the MG option count as 1 against the 'heavies' exclusion group.
 
Back
Top