AI Weapon Linking

Moderators: GSH, VSMIT, Red Devil, Commando

User avatar
Vadam
Thunderbolt
Posts: 104
Joined: Sat May 18, 2013 3:02 pm

AI Weapon Linking

Post by Vadam »

Just curious to know if there is a more reliable way to get the AI firing multiple weapons at the same time, other than fidgeting with the aiNames in the odf files.

Usually I just put in RocketTankFriend/Enemy in the Ai name but that isn't very reliable. I tried mashing all of the weapons into one weapon slot, and that worked, but its one big ugly mess that I'd rather avoid.
Starfleet 0.8 - Almost done!
User avatar
Red Devil
Recycler
Posts: 4398
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains

Re: AI Weapon Linking

Post by Red Devil »

from pb4 changelog:


- Added support for explicitly specifying weapon groups (mantis #513):

[GameObjectClass]
weaponGroup<#> = <group> // group number, -1 for automatic

Hardpoints with automatic grouping join the group of the most recently
assigned similar hardpoint, regardless of how that hardpoint got there.

Mixed-type groups act like permanent multi-selection, though the weapon
status indicator only lists the last weapon in the group. [Ken]

example:


weaponMask = 00011

weaponGroup1 = 0
weaponHard1 = "HP_ROCKET_1"
weaponName1 = "gshadow_c"
weaponAssault1 = 0

weaponGroup2 = 1
weaponHard2 = "HP_ROCKET_3"
weaponName2 = ""
weaponAssault2 = 0

weaponGroup3 = 0
weaponHard3 = "HP_ROCKET_2"
weaponName3 = "gshadow_c"
weaponAssault3 = 0

weaponGroup4 = 2
weaponHard4 = "HP_SPECIAL_1"
weaponName4 = "gproxmin"
weaponAssault4 = 0
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA
User avatar
Vadam
Thunderbolt
Posts: 104
Joined: Sat May 18, 2013 3:02 pm

Re: AI Weapon Linking

Post by Vadam »

Well that was easy.

I usually avoid the changelogs because of how confusing they can be to understand sometimes.
Thanks for slipping that edit with the example in
Starfleet 0.8 - Almost done!
User avatar
General BlackDragon
Flying Mauler
Posts: 2408
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: AI Weapon Linking

Post by General BlackDragon »

There is a new, better way, that doesnt force the ships weapons all into one group.

[CraftClass]
UseSelectWeapon = 1 // If > 0, enable SelectWeapon

Disabling SelectWeapon restores the original weapon selection and firing
logic that carried over from BZ1. The unit aims with a representative
weapon and fires every weapon in its weaponMask. [Ken]


So, under craftclass you set that to 0, or false, and then the ship will respect weaponmask, no matter the AI type.

This way, the ships weapons remain normal so if a player hops in, they can still use them properly.
Battlezone Classic Public Forums
*****General BlackDragon*****
User avatar
Vadam
Thunderbolt
Posts: 104
Joined: Sat May 18, 2013 3:02 pm

Re: AI Weapon Linking

Post by Vadam »

What does weaponMask even do? I have yet to figure that out on my own.

Also is it possible to have a ship selectively fire two weapons and then switch to a third assault weapon when facing an assault enemy?

Say I had a ship with a combat cannon, a combat rocket, and an assault rocket. I want to know if it can be made to fire its combat cannon and combat rocket at normal units and then switch to the assault rocket when appropriate. Preferably retaining the weapon status indicator when a player hops in so if the player just wants to use the cannon that would work too, otherwise I would just use the first method.
Starfleet 0.8 - Almost done!
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: AI Weapon Linking

Post by Zero Angel »

WeaponMask is a feature that was previously only available on a few AI types (e.g. MorphTankFriend/Enemy, RocketTankFriend/Enemy, GuntowerFriend/Enemy). Setting this will specify what weapon hardpoints the AI will use when attacking.

For example:
11111 means use all 5 available hardpoints
00011 means use first 2 available weapons hardponts
11110 means use the second, third, fourth and fifth available hardpoints.

Most AI types ignore weaponmask, unless you set useSelectWeapon to 1.

However, the AI will now completely disregard switching to combat/assault weapons depedent on the target and will simply use whatever weapons you specify it to use in the weaponMask. This can be used to counter some unpleasant side effects of the combat/assault weapon setup such as assault tanks which attack combat targets with mortars (if so equipped) instead of their cannon.
Regulators
Regulate any stealin' of this biometal pool, we're damn good, too
But you can't be any geek off the street
Gotta be handy with the chains if you know what I mean
Earn your keep
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: AI Weapon Linking

Post by MrTwosheds »

Is there a way to force combat/assault switching in units that don't traditionally use it? eg a tank.
The Silence continues. The War Of Lies has no end.
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: AI Weapon Linking

Post by Zero Angel »

To my knowledge, no. This would be a nice feature to integrate into MPI. For example having a blast/chain tank attack an extractor with its chaingun, while it uses blast against combat vehicles, but even if you could -- it would require some kind of workaround that's heavily DLL driven, or you must fudge around with combat/assault hardpoints which can make things behave a bit strangely if a human ever gets his hands on an AI unit and tries to drop powerups.

I had at one point proposed a system whereas weapon selection was based on ODF flags, for example

gblast_c.odf

Code: Select all

combatPriority = 90
assaultPriority = 5
weaponBlastDist = 155
gchain_c.odf

Code: Select all

combatPriority = 60
assaultPriority = 80
weaponBlastDist = 80
Of course an overhaul like this is a rather big thing to request, and probably even bigger to implement in DLL. I'll have to wait for word from Blackdragon to see if something like this is even possible in DLL.
Regulators
Regulate any stealin' of this biometal pool, we're damn good, too
But you can't be any geek off the street
Gotta be handy with the chains if you know what I mean
Earn your keep
User avatar
Red Devil
Recycler
Posts: 4398
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains

Re: AI Weapon Linking

Post by Red Devil »

for AIP's, in pb2:

- Added some new AIP plan chunk parameters

[Plan#]
planType = "Attacker" // for this type only
attackMode = -1 // -1 = auto, 0 = combat, 1 = assault

If this is specified, and the attacker is a deployable (not just a
morphtank), it will force the mode. If the unit is stolen by another
task or the idle dispatcher, the mode may stick. [NM]
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: AI Weapon Linking

Post by Zero Angel »

Interesting find, RD.
Regulators
Regulate any stealin' of this biometal pool, we're damn good, too
But you can't be any geek off the street
Gotta be handy with the chains if you know what I mean
Earn your keep
User avatar
Ded10c
Recycler
Posts: 3815
Joined: Sun Feb 20, 2011 11:05 am
Location: Stoke-on-Trent
Contact:

Re: AI Weapon Linking

Post by Ded10c »

Horrendously simplified, but would something like this do the trick? You'd probably need a few new callbacks, I'm not up-to-date on what's available to DLL.

Code: Select all

if(target.isAssault == 1 && weapon.isAssault == 1) 
{
    //use the weapon
}
battlezone.wikia.com needs your help!
User avatar
Vadam
Thunderbolt
Posts: 104
Joined: Sat May 18, 2013 3:02 pm

Re: AI Weapon Linking

Post by Vadam »

How do units switch from combat to assault normally?

How does something like an assault tank know to use its assault weapon when you can't just slap an assault weapon on a sabre and expect it to do the same
Starfleet 0.8 - Almost done!
User avatar
Red Devil
Recycler
Posts: 4398
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains

Re: AI Weapon Linking

Post by Red Devil »

that's due to the isAssault = true/false setting in the unit's ODF and in the weapon's ODF. the one in the weapon ODF is for determining which slot it matches up with in the unit.
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA
User avatar
Vadam
Thunderbolt
Posts: 104
Joined: Sat May 18, 2013 3:02 pm

Re: AI Weapon Linking

Post by Vadam »

Okay, so to recap

In order to have a unit fire its assault weapon I have to set the unit itself and the weapon as assault.

Going back to the previous topic, then I would have to tie the combat and assault rocket into one group so the combat rocket would fire along with the assault rocket.

Which would allow a player to switch between just using the cannon or using both rockets while not having the AI fire all of the weapons, as opposed to using the weaponMask method instead.

However that would permanently fuse the rockets so it would be impossible to use the combat or assault one individually.

What did I miss?
Starfleet 0.8 - Almost done!
User avatar
Red Devil
Recycler
Posts: 4398
Joined: Fri Feb 18, 2011 5:10 pm
Location: High in the Rocky Mountains

Re: AI Weapon Linking

Post by Red Devil »

the isAssault = true in the weapon ODF is just so that it "knows" to go in the slot when a powerup crate is picked up by that unit.

a player can use weapon linking to temporarily link multiple weapons to the fire action.
If given the truth, the people can be depended upon to meet any national crisis. The great point is to bring them the real facts - and beer.
Abraham Lincoln

Battlestrat, FE, G66, In The Shadows, Starfleet, Uler, & ZTV

Lifetime member of JBS and NRA
Post Reply