Announcement

Collapse
No announcement yet.

[solved] Weapon Replacement problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [solved] Weapon Replacement problem

    I am currently working on making skins for weapons. I made a red flak cannon and I want to replace the flak cannon with the red flak cannon. But when I tried my code, it replace the enforcer instead and when I pick up a flak cannon. It gives me another flak cannon (which means I have a red and yellow flak cannon). How do I fix this? Please go the link below. (it has the code).

    This link takes you to the thread about weapon skins and replacement:
    http://utforums.epicgames.com/showthread.php?t=723339

    #2
    UTGame(WorldInfo.Game).DefaultInventory[0] = class'RedFlakCannon.UTWeap_RedFlakCannon';


    the problem is this "DefaultInventory[0]" this is egual to the enforcer weapon.

    in the utgame class you will find this
    DefaultInventory(0)=class'UTWeap_Enforcer'
    DefaultInventory(1)=class'UTWeap_ImpactHammer'
    so if you want to have the flakcannon not replace the enforcer put this

    class UTMutator_RedFlakCannon extends UTMutator;

    function InitMutator(string Options, out string ErrorMessage)
    {
    if (UTGame(WorldInfo.Game) != None)
    {
    UTGame(WorldInfo.Game).DefaultInventory[2] = class'RedFlakCannon.UTWeap_RedFlakCannon';
    }

    Super.InitMutator(Options, ErrorMessage);
    }

    function bool CheckReplacement(Actor Other)
    {
    if (Other.IsA('UTWeap_FlakCannon') && !Other.IsA('UTWeap_RedFlakCannon'))
    {
    ReplaceWith(Other, "UTWeap_RedFlakCannon");
    }

    return true;
    }

    DefaultProperties
    {
    }
    notice the DefaultInventory[2] this will mean you have 3 weapons on startup

    your problem with when you pickup the other flakcannon is that your mutator is not working correctly i presume ill test it out

    Comment


      #3
      Originally posted by PatrickBlake View Post
      UTGame(WorldInfo.Game).DefaultInventory[0] = class'RedFlakCannon.UTWeap_RedFlakCannon';


      the problem is this "DefaultInventory[0]" this is egual to the enforcer weapon.

      in the utgame class you will find this


      so if you want to have the flakcannon not replace the enforcer put this



      notice the DefaultInventory[2] this will mean you have 3 weapons on startup
      I don't want to start with red flak cannon. I want to have to find and pick it up.

      Comment


        #4
        I figure it out how to just replace the flak cannon and not start with it. It is red when I pick it up, but it still yellow when you are looking at the weapon before you pick it up. or 3rd person view also. how do I replace the texture that way also?

        Comment


          #5
          show me your weapon default properties as you need to set the pickup mesh

          example


          // Pickup staticmesh
          Begin Object Name=PickupMesh
          SkeletalMesh=SkeletalMesh'WP_Stinger.Mesh.SK_WP_St inger_3P_Mid'
          End Object

          Comment


            #6
            Originally posted by PatrickBlake View Post
            show me your weapon default properties as you need to set the pickup mesh

            example


            // Pickup staticmesh
            Begin Object Name=PickupMesh
            SkeletalMesh=SkeletalMesh'WP_Stinger.Mesh.SK_WP_St inger_3P_Mid'
            End Object
            How do I replace the 3rd person mesh textures? I keep getting warnings saying that it does not exist. I tried making it in Unreal Editor but I don't know how.

            Comment


              #7
              function bool CheckReplacement(Actor Other)
              {

              local UTWeaponPickupFactory WeaponPickup;


              if (Other.IsA('UTWeap_FlakCannon') && !Other.IsA('UTWeap_Enforcer'))
              {
              ReplaceWith(Other, "UTWeap_RedFlakCannon");
              }

              WeaponPickup = UTWeaponPickupFactory(Other);
              if (WeaponPickup != None)
              {
              if (WeaponPickup.WeaponPickupClass != None)
              {
              WeaponPickup.WeaponPickupClass = class'UTWeap_Enforcer';
              WeaponPickup.InitializePickup();

              }
              }

              return true;
              }
              this is what i have quickly put together i aint tested it but it shows ya the idea of how its meant to be done

              Comment


                #8
                Uhhhhh......Is this code for the mutator part? I am now very confused because I am replacing the regular flakcannon with the red flakcannon...

                Comment

                Working...
                X