Announcement

Collapse
No announcement yet.

how can I ZOOM?

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

    how can I ZOOM?

    hi, I want to zoom on my weapon. My gun isn't a custom weapon and it's an AK-47 , how can i zoom with this weapon?

    #2
    You have to make an animation for it and script it into game I can't really lead you in any step by step tutorial by telling you this but if anyone has another way it might be easier.

    Comment


      #3
      What kind of zooming? Like aiming down the sights or just regular zooming on the crosshair? The latter part can be done by just changing field of view (console command is "fov 50" for example) and the former one requires some animation work.

      Comment


        #4
        Hi, I was wondering if you want to achieve this sort of zooming functionality:
        www.YouTube.com/user/topgear575

        Link may be wrong but my channel shouldn't be too hard to find

        To get something like this you basically need to create a weapon animation that simulates the weapon zooming in or aiming down it's sights. Then you have to either create a new input button or edit the right mouse button input to tell your controller to tell your pawns inventory manager, which tells your current weapon that you want to zoom in.

        Then when your weapon receives the call it should be told to play the zooming animation and then in some cases change a few variables to get a better feel to it. Then vice versa for zooming out.

        Hope that sums it up well if not feel free to message me and I'll help the best I can

        Comment


          #5
          Originally posted by Topsy View Post
          Then you have to either create a new input button or edit the right mouse button input to tell your controller to tell your pawns inventory manager, which tells your current weapon that you want to zoom in.

          Then when your weapon receives the call it should be told to play the zooming animation and then in some cases change a few variables to get a better feel to it. Then vice versa for zooming out.
          I don't really get the 'to tell to tell to tell' part :P. How do you tell your inventory manager to do something from another script? Like this?

          Code:
          Inventory.functionname

          Comment


            #6
            Its pretty simple really, just:

            This is your my AlonePlayerController class (Not posting my code, this is just typed up quickly):
            Code:
            class AlonePlayerController extends UTPlayerController
            	dependson(AlonePawn);
            
            exec function WeaponAimDownSight()
            {
            	AlonePawn(Pawn).WeaponAimDownSight();
            }
            That calls the function "WeaponAimDownSight" in your Pawn class

            This is my Pawn class:
            Code:
            class AlonePawn extends UTPawn;
            
            var AloneInventoryManager AloneInvManager;
            
            simulated function WeaponAimDownSight()
            {	
            	AloneInvManager = AloneInventoryManager(InvManager);
            	AloneInvManager.WeaponAimDownSight();
            }
            That declares my AloneInventoryManager class and then calls the function "WeaponAimDownSight" inside it.

            This is my InventoryManager class:
            Code:
            class AloneInventoryManager extends UTInventoryManager;
            
            var AloneWeapon Wep;
            
            simulated function WeaponAimDownSight()
            {	
            	Wep = AloneWeapon(Instigator.Weapon);
            	Wep.WeaponAimDownSight();
            }
            (AloneWeapon is the name of my base weapon class)
            That declares your weapon and then calls the function inside that weapon.

            And finally this is my Weapon class/s (Class/s because you would have more than one weapon in most cases)
            Code:
            simulated function WeaponAimDownSight()
            {
            	////// Zooming code goes here //////
            }
            This is not the exact code from my classes it is just a "mini-tutorial", although to create a better system there is a little bit more code needed or just to make improvements. After a while small things like this are easy to pick up so it shouldnt be too hard. Good luck

            Oh and yes you were right about the Inventory.functionname bit, you just need to declare it as a variable to be able to call things in it. :P

            Comment

            Working...
            X