This is very simple to do and understand all you need is a certain bit of code, what weapon you want to be fired and, what you want said weapon to be fired at(e.g. having a ranger fire a firebase shell at a plane)
The certain bit of code is PDL believe it or not
Behavior = PointDefenseLaserUpdate ModuleTag_22 WeaponTemplate = AirF_RaptorPointDefenseLaser PrimaryTargetTypes = BALLISTIC_MISSILE SMALL_MISSILE ScanRate = 10 ScanRange = 200.0 PredictTargetVelocityFactor = 2.0 End
Now the weapon template and primary targets are the most important parts of the code in this because they define what weapon is being fired and at what.Now this is just a normal PDL that fires at missiles but by changing the two mentioned lines we can make any weapon fire at anything because the only thing the PDL behavior pays attention to is the KindOf of the target, what weapon is being fired, and the range of the weapon, so by changing that code to something like this:
Behavior = PointDefenseLaserUpdate ModuleTag_22 WeaponTemplate = FireBaseHowitzerGun PrimaryTargetTypes = AIRCRAFT ScanRate = 10 ScanRange = 200.0 PredictTargetVelocityFactor = 2.0 End
we have a shell being fired at an air unit.
and if we were to put this in the ranger code we would infact have a ranger fire a firebase shell at air units.
Again all credit of this tutorial goes to modder Beng.
Edited by huhnu, 23 May 2009 - 05:55.