[Tutorial]How to make any unit fire any we...
R3ven 23 May 2009
Before i go on with this i give all credit to Beng one of the greatest generals and zero hour modders out there.
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
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:
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.
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.
JJ 23 May 2009
Wow, kinda common sense. By doing a little experimenting, most people can find that out.
So anyway, you should mention that the disadvantage of this is that the weapon will fire from the unit's origin, so it only works well with lasers and dummy weapons.
Edited by JJ, 23 May 2009 - 06:35.
So anyway, you should mention that the disadvantage of this is that the weapon will fire from the unit's origin, so it only works well with lasers and dummy weapons.
Edited by JJ, 23 May 2009 - 06:35.