Announcement

Collapse
No announcement yet.

Weapon Pickup 1st Person View

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

    Weapon Pickup 1st Person View

    I've been following the bonus disc tut. but applying it to a Shotgun model I made. I can summon the static mesh in game and when I walk into it I get the PickupMessage="You got the Shotgun!" but thats it.

    The 1st person view of the weapon doesn't happen. Anyone shed any light on whats wrong? The animation is of weapon is called ShotgunAmin containing Shotgun_3rd & Shotgun_1st. Static mesh is called ShotgunStatic containing Shotgun.


    //==========================================
    // ShotgunPickup
    //==========================================
    class ShotgunPickup extends UTWeaponPickup;

    defaultproperties
    {
    DrawType=DT_StaticMesh
    StaticMesh=StaticMesh'ShotgunStatic.Shotgun'

    InventoryType=class'Shotgun'

    PickupMessage="You got the Shotgun!"
    }



    //==========================================
    // Shotgun
    //==========================================
    class Shotgun extends Weapon config(user);

    defaultproperties
    {
    Mesh=SkeletalMesh'ShotgunAnim.Shotgun_1st'
    DrawScale=0.6
    InventoryGroup=7

    ItemName="Shotgun"
    FiremodeClass(0)=class'ShotgunFire'
    PickupClass=class'ShotgunPickup'
    AttachmentClass=class'ShotgunAttachment'

    BobDamping=1.4
    CenteredOffsetY=-5.00
    PlayerViewOffset=(X=10.0,Y=12.0,Z=-8.0)
    SmallViewOffset=(X=16.0,Y=12.0,Z=-8.0)
    }



    //==========================================
    // ShotgunAttachment
    //==========================================
    class ShotgunAttachment extends AssaultAttachment;

    defaultproperties
    {
    Mesh=SkeletalMesh'ShotgunAnim.Shotgun_3rd'
    DrawScale=1
    }

    #2
    correct me if im wrong, but dont the _1st and _3rd person animations have to be seperate files? I myself am learning to make weapons for a mod im starting, I actually came here to recruit a few scripters, programmers and animators (only to export/import, I make all weapons and anims themselves)

    what i think the problem here is that you need to put the lines for the _1st in the shotgun.uc, and the _3rd in the attachment type. Because if you look at the other weapons for UT they all have the skeletal mesh for the weapons _1st in there inventory type .uc and _3rd in there attachment.uc if you dont get what i mean, here:

    //default properties for the flak cannon attachment


    defaultproperties
    {
    mMuzFlashClass=Class'XEffects.FlakMuzFlash3rd'
    bHeavy=True
    LightType=LT_Steady
    LightEffect=LE_NonIncidence
    LightHue=30
    LightSaturation=150
    LightBrightness=255.000000
    LightRadius=4.000000
    Mesh=SkeletalMesh'Weapons.Flak_3rd'
    }



    //some of the default properties for the flak cannon invetory type.uc


    defaultproperties
    {
    FireModeClass(0)=Class'XWeapons.FlakFire'
    FireModeClass(1)=Class'XWeapons.FlakAltFire'
    SelectAnim="Pickup"
    PutDownAnim="PutDown"
    LightRadius=4.000000
    Mesh=SkeletalMesh'Weapons.Flak_1st'
    }



    ((EDIT))
    oh, i didnt see that you already had that in there....well then my best geuss would be that it has something to do with the animation itself, go back to maya, or 3dsmax etc. and see if anythings wrong

    Comment


      #3
      I agree. The weapon wont appear if your anims dont work. Check your log, see if it mentions anything about missing animations, meshes, or anything else relating to your weapon, classes, and packages.

      Comment


        #4
        I looked over the animations but they look fine. I think the problem is how i've set the files up. This is my 1st go so ive no doubt done something wrong. The code looks like this. (I followed the Angel Mapper tut. on weapon script)

        C:\Games\UT2004\Shotgun\Classes

        and i have Shotgun.uc, ShotgunAttachment.uc, ShotgunFire.uc, ShotgunPickup.uc and ShotgunShell.uc.

        In C:\Games\UT2004\Animations I have ShotgunAnim.ukx

        and in C:\Games\UT2004\Textures I have ShotgunTex.utx

        Basically im trying to get my shotgun model to fire the Flak Cannon. I downloaded some weapons to see if I could get any hints but they have .u, .ucl and .utx file. I think the problem is that I haven't set out my files properly. Any ideas on what I should do?

        I could easily give you the web link for the files if you really want to help me

        Comment


          #5
          check your drawlscales and theres other code to adjust the position of the gun in 1st person.. can't quite think of what that is now.. but hope that helps..

          Comment


            #6
            Originally posted by Bishops292
            check your drawlscales and theres other code to adjust the position of the gun in 1st person.. can't quite think of what that is now.. but hope that helps..
            As Bishop292 was saying here and Bonehead mentioned, if your log file (ut2004.log and UCC.log for the compile log) do not mention any errors, then chances are your model is there but your PlayerViewOffset and SmallViewOffset may place the model out of your viewable range. If that might be the case I recommend setting the offsets to 0,0,0 in your default properties then adjusitng the offset in game using the "editactor" console command: http://wiki.beyondunreal.com/wiki/Co...nsole_Commands

            The properties to adjust are either the relativelocation (which if you use these values in the playerviewoffset will result in the same view), or playerviewoffset.

            Comment


              #7
              I set the PlayerViewOffset and SmallViewOffset x,y,z to 0. The UCC.log is fine.

              Heading: --------------------------Shotgun - Release---------------------------
              Log: Success - 0 error(s), 0 warning(s)
              Exit: Preparing to exit.


              But in the UT2004.log I get:

              ScriptLog: console toggle

              ScriptLog: Fabricate shotgun.shotgunpickup

              Error: ShotgunPickup DM-Gael.ShotgunPickup (Function Engine.WeaponPickup.PostBeginPlay:0023) Accessed null class context 'InventoryType'

              Warning: ShotgunPickup DM-Gael.ShotgunPickup (Function Engine.Pickup.SpawnCopy:0048) Accessed None 'Copy'

              Does this mean theres something going wrong in the Shotgun.uc code?

              Comment


                #8
                @icaris: Looks like the default properties of your pickup class might be messed up. check the spelling of the name of the inventory class in your pickup class to make sure it matches the name of your shotgun class.

                Comment


                  #9
                  The problem is probably that he didnt set the InventoryType in the pickup to anything (hence why it says null class context).

                  Comment


                    #10
                    In the ShotgunPickup ive got:

                    InventoryType=class'Shotgun'

                    Doesn't this then direct it to the shotgun.uc code?

                    Comment


                      #11
                      Well ive spent ages looking over the code and I just can't work out were im going wrong. :cry: I've put the .uc files along with the animation, staticmesh and texture in a ZIP_FILE *Link no longer working, i fixed problem* (file is only 200k, ive stuck a simple coloured texture on it cos i want 2 get it working ingame b4 textuing it properly)

                      Feel free to download it, anyone whos managed to get a weapon ingame before will prob notice where ive got wrong. Any help will be very much appreciated.

                      Comment


                        #12
                        Im guessing (keep in mind i've been working with uscript for a week now, so still new to it) its cos:

                        InventoryType=class'Shotgun'

                        should be

                        InventoryType=class'Shotgun.Shotgun'

                        The first shotgun is just the package name, the the 2nd shotgun (after the full stop) is the name of the weapon inside the package. I haven't downloaded the code so im not sure this will sort it, its just a thought.

                        Comment


                          #13
                          You can see your model in game now right? (at least when I compiled what you had I saw the model just fine, albeit centered in the screen). Make sure you delete your .u file before you recompile each time.

                          A few things you need to fix in the code:
                          -In the third person attachment, change the drawscale down to at least 1/10 whatever it is now.
                          -Make sure you add a secondary fireModeClass to the shotgun (even if the class does absolutely nothing). This will fix a lot of accessed nones in your code.


                          I will see about giving you some coordinates for the first person Viewoffset in about an hour.

                          Comment


                            #14
                            Thank you very much meowcat :up: I added a secondary fireModeClass and changed the drawscale down. I can now see it but as you say its centred. Ill have a go at the Viewoffset now...

                            For the FiremodeClass(1)=class'ShotgunAlt' I plan to make it the same as the primary fire but slower reload and more powerful. Cheers.

                            Comment


                              #15
                              Glad it works for you now. I came up with a PlayerViewOffset of PlayerViewOffset=(X=110.0,Y=30.0,Z=-60.0)
                              This seems about right to me. Anyways here is a handy console command function to toss in your weapon's code for easy placement of the first person weapon model.
                              Code:
                              exec function updatePVO(int x, int y, int z)
                              {
                              	local vector NewPVO;
                              
                              	NewPVO.X = x;
                              	NewPVO.Y = y;
                              	NewPVO.Z = z;
                              	Default.PlayerViewOffset=NewPVO;
                              	//SaveConfig();
                              }
                              To use this once it has been compiled into your weapon code, in game simply bring up your weapon, bring down the console, then type "updatePVO X Y Z" where X, Y, Z are the numbers you want to try for the player view offset. This only works if you have Use Small Weapons UNChecked in your player configurations.

                              Comment

                              Working...
                              X