Make tank shoot at inf with mg

Information and discussion for custom maps and mods.
Post Reply
pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Make tank shoot at inf with mg

Post by pointbreak » Mon Jul 23, 2018 10:57 am

Hi, just played around with the yaml files a bit but had no real success, so I'm asking, how do I make let's say the heavy tank shoot at inf with an mg but at vehicles and buildings with the cannons? I added

Armament@SECONDARY:
Name: secondary
Weapon: M60mg
MuzzleSequence: muzzle
LocalOffset: 128,0,43
ValidTargets: Infantry

But then found out ValidTargets and InvalidTargets is only for autotargetting and it now shoots with both weapons at the same time. I looked at how the Mammoth does it but couldn't find anything out either. Thx

User avatar
MustaphaTR
Posts: 184
Joined: Mon Aug 04, 2014 6:38 am
Location: Kastamonu, Turkey

Re: Make tank shoot at inf with mg

Post by MustaphaTR » Mon Jul 23, 2018 11:42 am

Target vaildity is defined at the weapon itself, not on unit's Armament trait.

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Mon Jul 23, 2018 11:51 am

Thanks.

I tried to make a new weapon as well. I copied the m60mg and called it m60mgTANK. I put it into the rules.yaml but then the map couldn't be started. Any idea how to solve that?

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Mon Jul 23, 2018 12:21 pm

I also tried to put the vehicles into vehicles.yaml and weapons into weapons.yaml but I think the point is, when I try to use m60mgTANK it doesn't let me play the map. Perhaps vehicles.yaml doesn't know weapons.yaml? But it didn't work in the same file either.

EDIT: Tried to put the stuff into a vehicles.yaml and weapons.yaml in my oramap file without a rules.yaml. It simply ignores the changes now.

EDIT: Ok so if I put it all in rules.yaml, it won't let me launch, if I put it into vehicles.yaml and weapons.yaml, the changes don't take effect. So far I've only succeeded in adding secondary weapons but not the behaviour I intend. I did follow the tutorial so this is weird.

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Mon Jul 23, 2018 1:44 pm

Ok maybe it's easier for you to help me (pls) if I show you my files.

So to my map.yaml I added this:

Code: Select all

Weapons: weapons.yaml
		
Vehicles: vehicles.yaml 
Then in weapons.yaml I got these weapons, copied over and renamed:

Code: Select all

M60mgTANK:
	Inherits: ^LightMG
	ReloadDelay: 30
	Range: 4c0
	Report: pillbox1.aud
	Burst: 5

M1CarbineTANK:
	Inherits: ^LightMG
	ReloadDelay: 20
	Range: 5c0
	Report: gun11.aud
	Warhead@1Dam: SpreadDamage
		Versus:
			Wood: 30

25mmTANK:
	Inherits: ^Cannon
	ReloadDelay: 21
	Range: 4c0
	Report: cannon2.aud
	Projectile: Bullet
		Speed: 853
		Image: 50CAL
	Warhead@1Dam: SpreadDamage
		Damage: 2500
		Versus:
			None: 32
			Wood: 52
			Light: 116
			Heavy: 48
			Concrete: 32
	-Warhead@2Smu: LeaveSmudge
	Warhead@3Eff: CreateEffect
		-ImpactSounds:
	Warhead@4EffWater: CreateEffect
		-ImpactSounds:

90mmTANK:
	Inherits: ^Cannon
	Warhead@1Dam: SpreadDamage
		Versus:
			Heavy: 115

105mmTANK:
	Inherits: ^Cannon
	ReloadDelay: 70
	Burst: 2
	BurstDelays: 4
	Warhead@1Dam: SpreadDamage
		Versus:
			Heavy: 115 
And this is my vehicles.yaml

Code: Select all

MCV:
	Chronoshiftable:
		ExplodeInstead: yes

1TNK:
	Armament@PRIMARY:
		Weapon: 25mmTANK
		Recoil: 85
		RecoilRecovery: 25
		LocalOffset: 768,0,90
		MuzzleSequence: muzzle
	Armament@SECONDARY:
		Name: secondary
		Weapon: M1CarbineTANK
		MuzzleSequence: muzzle
		LocalOffset: 128,0,43
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 50
		Prerequisites: ~vehicles.allies, ~techlevel.low
		Description: Fast tank, good for scouting.\n  Strong vs Light armor 

2TNK:
	Armament@PRIMARY:
		Weapon: 90mmTANK
		Recoil: 128
		RecoilRecovery: 38
		LocalOffset: 720,0,80
		MuzzleSequence: muzzle
	Armament@SECONDARY:
		Name: secondary
		Weapon: M60mgTANK
		MuzzleSequence: muzzle
		LocalOffset: 128,0,43
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 110
		Prerequisites: fix, ~vehicles.allies, ~techlevel.medium
		Description: Allied Main Battle Tank.\n  Strong vs Vehicles

3TNK: 
	Armament@PRIMARY:
		Weapon: 105mmTANK
		Recoil: 128
		RecoilRecovery: 38
		LocalOffset: 768,85,90, 768,-85,90
		MuzzleSequence: muzzle
	Armament@SECONDARY:
		Name: secondary
		Weapon: M60mgTANK
		MuzzleSequence: muzzle
		LocalOffset: 128,0,43
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 120
		Prerequisites: fix, ~vehicles.soviet, ~techlevel.medium 
		Description: Soviet Main Battle Tank, with dual cannons\n  Strong vs Vehicles 
Right now it doesn't accept the changes at all. Starts the map but doesn't do anything.

abcdefg30
Posts: 280
Joined: Mon Aug 18, 2014 6:00 pm

Re: Make tank shoot at inf with mg

Post by abcdefg30 » Mon Jul 23, 2018 1:48 pm

"Vehicles: vehicles.yaml" won't work, the game doesn't expect a "Vehicles" category. Try putting those changes in the "Rules" section,
i.e. "Rules: vehicles.yaml" (in case you haven't defined other rules yet).

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Mon Jul 23, 2018 2:23 pm

Thanks abcdefg that worked. But it still shoots with cannon and mg at the inf now both at the same time. How can I make the cannon not fire at inf and the mg only fire at inf?

EDIT: Cannon only on structures and vehicles works, but at inf it still shoots with both. Hm. I'm using ValidTargets and InvalidTargets.. the latter doesn't seem to work?

abcdefg30
Posts: 280
Joined: Mon Aug 18, 2014 6:00 pm

Re: Make tank shoot at inf with mg

Post by abcdefg30 » Mon Jul 23, 2018 4:38 pm

pointbreak wrote:
Mon Jul 23, 2018 2:23 pm
EDIT: Cannon only on structures and vehicles works, but at inf it still shoots with both. Hm. I'm using ValidTargets and InvalidTargets.. the latter doesn't seem to work?
Do you mind sharing your yaml here as well?
Maybe those examples are helpful:
The 120mm cannons of mammoth tanks don't shoot infantry: https://github.com/OpenRA/OpenRA/blob/8 ... s.yaml#L72
The sniper can only shoot infantry (and the ground): https://github.com/OpenRA/OpenRA/blob/d ... er.yaml#L3

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Mon Jul 23, 2018 9:46 pm

I believed it worked, thanks a lot. Will test it some more.

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Tue Jul 24, 2018 8:58 am

After some testing and closer inspection, I think it actually doesn't work. They still use cannons+mg. But maybe I can treat it as a feature, unless someone has an idea. Here's my yaml stuff:

Rules.yaml which puts weapons on tanks

Code: Select all

1TNK:
	Armament@PRIMARY:
		Weapon: 25mmTANK
		Recoil: 85
		RecoilRecovery: 25
		LocalOffset: 768,0,90
		MuzzleSequence: muzzle
	Armament@SECONDARY:
		Name: secondary
		Weapon: M1CarbineTANK
		MuzzleSequence: muzzle
		LocalOffset: 128,0,43
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 50
		Prerequisites: ~vehicles.allies, ~techlevel.low
		Description: Fast tank, good for scouting.\n  Strong vs Light armor 

2TNK:
	Armament@PRIMARY:
		Weapon: 90mmTANK
		Recoil: 128
		RecoilRecovery: 38
		LocalOffset: 720,0,80
		MuzzleSequence: muzzle
	Armament@SECONDARY:
		Name: secondary
		Weapon: M60mgTANK
		MuzzleSequence: muzzle
		LocalOffset: 128,0,43
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 110
		Prerequisites: fix, ~vehicles.allies, ~techlevel.medium
		Description: Allied Main Battle Tank.\n  Strong vs Vehicles

3TNK: 
	Armament@PRIMARY:
		Weapon: 105mmTANK
		Recoil: 128
		RecoilRecovery: 38
		LocalOffset: 768,85,90, 768,-85,90
		MuzzleSequence: muzzle
	Armament@SECONDARY:
		Name: secondary
		Weapon: M60mgTANK
		MuzzleSequence: muzzle
		LocalOffset: 128,0,43
	Buildable:
		Queue: Vehicle
		BuildPaletteOrder: 120
		Prerequisites: fix, ~vehicles.soviet, ~techlevel.medium 
		Description: Soviet Main Battle Tank, with dual cannons\n  Strong vs Vehicles 
Weapons.yaml

Code: Select all

M60mgTANK:
	Inherits: ^LightMG
	ReloadDelay: 18
	Range: 5c0
	Report: pillbox1.aud
	Burst: 5
	InvalidTargets: Air, Vehicle, Structure

M1CarbineTANK:
	Inherits: ^LightMG
	ReloadDelay: 18
	Range: 4c0
	Report: gun11.aud
	InvalidTargets: Air, Vehicle, Structure
	Warhead@1Dam: SpreadDamage
		Versus:
			Wood: 30	

25mmTANK:
	Inherits: ^Cannon
	InvalidTargets: Air, Infantry
	ReloadDelay: 21
	Range: 4c0
	Report: cannon2.aud
	Projectile: Bullet
		Speed: 853
		Image: 50CAL
	Warhead@1Dam: SpreadDamage
		Damage: 2500
		Versus:
			None: 32
			Wood: 52
			Light: 116
			Heavy: 48
			Concrete: 32
		InvalidTargets: Air
	-Warhead@2Smu: LeaveSmudge
	Warhead@3Eff: CreateEffect
		-ImpactSounds:
	Warhead@4EffWater: CreateEffect
		-ImpactSounds:

90mmTANK:
	Inherits: ^Cannon
	InvalidTargets: Air, Infantry
	Warhead@1Dam: SpreadDamage
		Versus:
			Heavy: 115
		InvalidTargets: Air

105mmTANK:
	Inherits: ^Cannon
	ReloadDelay: 70
	Burst: 2
	BurstDelays: 4
	InvalidTargets: Air, Infantry
	Warhead@1Dam: SpreadDamage
		Versus:
			Heavy: 115 
		InvalidTargets: Air

pointbreak
Posts: 29
Joined: Mon Jul 23, 2018 10:54 am

Re: Make tank shoot at inf with mg

Post by pointbreak » Tue Jul 24, 2018 11:15 am

Also even though I only wanted to modify the 105mm (heavy tank cannon) to not shoot at inf (which failed), it now seems to do at least twice as much damage?

User avatar
Graion Dilach
Posts: 223
Joined: Fri May 15, 2015 5:57 pm

Re: Make tank shoot at inf with mg

Post by Graion Dilach » Tue Jul 24, 2018 2:15 pm

That yaml looks correct to me, so I'm not certain what goes wrong. IIRc we haven't shipped the OpenRA.Utility ra --resolved-rules/--resolved-weapons though in the last release (does worth a check though) which would help debugging here a lot. You coulda inherit the actual weapons anyway and just override InvalidTargets, allowing you to just go

Code: Select all

M1CarbineTANK:
	Inherits: M1Carbine
	InvalidTargets: Air, Vehicle, Structure

Post Reply