No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

    Just another question, iv tried looking for it but cant seem to find any examples.

    If ( weapon == whateverweaponiwant ) { do **** }

    how do i test what weapon the player is holding so say

    if ( weapon == newassaultrifle ) { do random stuff }

    is there a list somewhere of the weapons or is it based on avail weapon classes?


      Now this all depends on how well you actually know uscript and what you have already done. As you cant change this class, you have to create a base class from it, and then make the weapons you create use your new class instead of the old one.

      First of all check what the top layer of this class is (ie does anything inherit from InstantHit?), I cant quite remember but I can tell you later on when I get home. Then just create a simple class that inherits off the top layer, and just add the one function exactly as it exists in this top layer. So it the top layer is InstantHit, then write a class that extends InstantHit, and has 1 function which is called "function DoTrace(Vector Start, Rotator Dir)". Then all you have to do is add the recoil before or after the call to trace as you need it.
      Now change the reference for your weapons to use this new class (just look where the old class is referenced, and replace the name). Et voila.

      Now if you want to give recoil to existing weapons then you may need a completly different way of doing it, as you cant change existing weapons. You would have to base off existing weapons and change them to use the new class instead.

      This should be enough for you to at least have a good go at it, but I doubt you will figure it all out (based on your questions so far), so Ill come back later and see where you have got to.


        Iv already done the recoil it was rather easy, i know how to program i just need some help finding my way around uscript atm

        I have created my own class, which is essentially instantfire but i have named it bulletfire, it will handle all bulletbased weapons adding recoil and other modifications i intend to make.

        The weapon reference thing is my issue atm because i wish to add different amounts of yaw and pitch recoil based on the weapon.


          Jolly good.


            If you're looking to get weapon-specific values for recoil rotations, it sounds like you need to set up some defaultproperties for the specific weapon fire classes. Initialize the variables (not sure if that's the correct way to say "var rotator R" at the top of your uc or whatever) in your bulletfire class, and simply set them in the defaultproperties of your individual weapon's fireclasses.