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?
Announcement
Collapse
No announcement yet.
how can I ZOOM?
Collapse
X
-
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
-
Originally posted by Topsy View PostThen 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.
Code:Inventory.functionname
Comment
-
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(); }
This is my Pawn class:
Code:class AlonePawn extends UTPawn; var AloneInventoryManager AloneInvManager; simulated function WeaponAimDownSight() { AloneInvManager = AloneInventoryManager(InvManager); AloneInvManager.WeaponAimDownSight(); }
This is my InventoryManager class:
Code:class AloneInventoryManager extends UTInventoryManager; var AloneWeapon Wep; simulated function WeaponAimDownSight() { Wep = AloneWeapon(Instigator.Weapon); Wep.WeaponAimDownSight(); }
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 ////// }
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
Comment