Page 1 of 4

AA Only Gun Tower?

Posted: Mon Apr 23, 2012 3:31 pm
by General BlackDragon
How exactly do I make a gun tower that doesn't target ground units? OR can't aim down? Here's the ODF I have so far:

Code: Select all

[GameObjectClass]
geometryName = "abaagn00.xsi"
glowTexture = "abaagna0.pic"
geometryScale = 1.25
classLabel = "turret"
collisionRadius = 10.0
scrapCost = 6
scrapValue = 4
maxHealth = 5000
maxAmmo = 10000
unitName = "Gun Tower"
aiName = "GunTowerFriend"
aiName2 = "GunTowerEnemy"
heatSignature = 2.0
imageSignature = 1.0
radarSignature = 1.0
isAssault = 0
ownsTerrain = 1
canCollide = 1
powercost = 0

GameObjectClassServiceMask = 1
GameObjectClassServiceMatch = 1
GameObjectClassServiceProvides = 1

buildSupport = "F"
buildRequire = "A"

weaponMask = 01111
weaponHard1 = "hp_cannon_01"
recoilName1 = "Recoil_R"
weaponName1 = "gBGTflaka"
weaponAssault1 = 0
weaponHard2 = "hp_cannon_02"
recoilName2 = "Recoil_L"
weaponName2 = "gBGTflakb"
weaponAssault2 = 0
weaponHard3 = "hp_cannon_01"
recoilName3 = "Recoil_R"
weaponName3 = "gBGTflakc"
weaponAssault3 = 0
weaponHard4 = "hp_cannon_02"
recoilName4 = "Recoil_L"
weaponName4 = "gBGTflakd"
weaponAssault4 = 0

turretCount = 2
turretName1 = "turret_y"
turretName2 = "turret_x"


[BuildingClass]
soundAmbient = "abtowee0.wav"

[CraftClass]
rangeScan = 400
periodScan = 0.0
velocJam = 0.0
//weaponPitch = 1.5
steerFactor = 0.5
engageRange = 400

MinWeaponPitch = 0.5
MaxWeaponPitch = 1.5

MustBeLinedUpToHit = true 
GunTowerProcessCheckCantHit = true
DoWeaponCanHitCheck = true
SitAttackCheckAbleToHit = true
FireWhenCanHitFriends = true

attackTask = "AssaultTankAttack"
subAttackTask = "SupportSubAttack"
subAttackClass = "ANS"

[TurretCraftClass]
omegaTurret = 2.0
detectRange = 200
pitchMin = 0.5 
pitchMax = 1.5

Re: AA Only Gun Tower?

Posted: Mon Apr 23, 2012 3:45 pm
by bigbadbogie
Not really possible without DLL. The closest I was able to come was with a turret class building tapped inside another building which prevented it from being able to shoot anything down low. The problem was that it would still target ground units and just sit there pointing even while aircraft flew overhead. Even the ODF command gunTowerProcessCheckCantHit = true didn't make it retarget aircraft when this happened, even though it says in the changelog that it is supposed to retarget if it can't hit a unit.

Re: AA Only Gun Tower?

Posted: Mon Apr 23, 2012 4:05 pm
by General BlackDragon
I've seen the retarget work when the unit passes behind a hill of terrain.

Re: AA Only Gun Tower?

Posted: Mon Apr 23, 2012 7:34 pm
by Zax
Ground or aircraft doesn't really make a difference to BZ. All targets are considered the same, thanks to the fake z axis and all.

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 1:17 am
by MrTwosheds
attackTask = "ArtlAttack"
subAttackTask = "ArtlSubAttack"
Might make it more inclined to fire upwards, been a while since I played with it though so I'm not sure. I don't think you can stop it firing at ground units completely.

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 1:31 am
by bigbadbogie
General BlackDragon wrote:I've seen the retarget work when the unit passes behind a hill of terrain.
It might work for terrain, but not for objects.

Perhaps if you used a 'terrain' class object to sculpt the terrain around the object to a particular height it might work.

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 2:30 am
by General BlackDragon
artl doesnt work either :-/

And, terrain shaping doesn't work on buildable gun towers, heh...

EDIT: Figured out one bit...

MinWeaponPitch = -0.2
MaxWeaponPitch = 1.5

min is set to - in code, so to make minimum pitch a positive number, it needs to be negative.

Now they physically can't aim down, or level. However, the AI still "tries" to aim at ground targets it can't hit, even with GunTowerProcessCheckCantHit = true

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 10:51 pm
by DutchBoy
what I did to create an aa only emplacement was to actually have the tower launch a satellite up 200m and gave it a weapon with 200 m range so it basically could only target object in the air, looks pretty damn cool too haha. I dont remember if it was 200m range and altitude, but that was the general idea. I think i may have gave it a lil more weapon range then height so it would attack ground targets very close to it's base structure.

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 10:56 pm
by DutchBoy
You could probably get a similar effect with a ground based tower as long as the control points were up high, since target selection for the ai was based on certain hardpoints, which i cant recall the specific names for, while still having the weapon hardpoints on the ground, but i don't think i ever messed with that, worth a try though if you want a certain look.

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 11:07 pm
by General BlackDragon
Hmmm

Valid hardpoints i can think of: hp_Com_1, hp_eyepoint,

Though, the com_1 and eyepoint need to be down south with the turret....

Hmmmm....

Re: AA Only Gun Tower?

Posted: Tue Apr 24, 2012 11:10 pm
by DutchBoy
I think com messes with what is drawn on the screen, i had some issues with that and the satellite i think, things may have changed though. if the com hp was off the screen the model wasn't shown, so placement of that required a lot of fine tuning...

Re: AA Only Gun Tower?

Posted: Wed Apr 25, 2012 1:21 am
by Zax
Fake Z axis means 200 meters is not measured vertically. If something is 300 meters in the air, but 1 meter away from it x or y, that ship will point up and attempt to attack as if it was right next to it.

Re: AA Only Gun Tower?

Posted: Wed Apr 25, 2012 1:48 am
by Red Devil
i learned that it isn't a fake Z axis, but that is either left-handed or right-handed

Re: AA Only Gun Tower?

Posted: Wed Apr 25, 2012 2:32 am
by Nielk1
Red Devil wrote:i learned that it isn't a fake Z axis, but that is either left-handed or right-handed
The logic is 2D, not 3D, so handedness is irrelevant.

Re: AA Only Gun Tower?

Posted: Wed Apr 25, 2012 2:33 am
by DutchBoy
hmm oh well i know the satellite did work rather well.