Jump to content


[Tutorial]How to make any unit fire any weapon at anything


2 replies to this topic

#1 R3ven

    Veteran

  • Project Team
  • 468 posts

Posted 23 May 2009 - 05:54

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

  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.


#2 JJ

    Half dead member

  • Project Leader
  • 3294 posts
  • Projects: Real life things, personal RA3 mod

Posted 23 May 2009 - 06:35

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.


#3 R3ven

    Veteran

  • Project Team
  • 468 posts

Posted 23 May 2009 - 14:50

oops forgot to mention the origin part

thanks JJ



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users