[UT] How to detect button release from inside a weapon mutator?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Teddyboy

New Member
Nov 12, 2004
2
0
0
Hello all :)

I'd like to have a sniperrifle with "stepped" zoom - like TacOps, for ex.

When the player hits altfire, the zoom shouldn't be dynamically changing until altfire is released, but it should immediately goes to, say, 6x. When the altfire is hit another time, it should switch back to defaultfov, quitting zooming state.

May anybody point me to the right way to do it, please?

TIA

Teddyboy
 

Gnam

Member
Feb 13, 2002
515
0
16
40
Yes, please.
I'm not sure, but check ChaosUT, I know they have a sniper scope like that, or they did back in UT99. AFAIK the UT2004 version ports over most of the old weapons, so it probably has what you're looking for. Just download it, then open the package in UnrealEd or use UCC to export the classes to a folder, and dig up the sniper rifle zoom class and it should have what you need.
 

MrBond

ZHP Founder
Sep 23, 2003
452
0
16
USA
zerohour-productions.net
I'd like to expand on this question a little, if I may.

How are button presses (and releases) handled? I know that Fire is "function Fire(float Value)", but what about custom defined keys? If there some standard syntax to follow?
 

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
40
New Zealand
www.digitalconfectioners.com
There are several ways of doing this, while these may only apply to UT2004. You can use a button type variable or a OnRelease type command.

Basically a button type is things like bFire, bAltFire and bDuck. When the button is pressed it will be a value of 1 and when it isn't being pressed it is returned to a value of 0. Thus you can detect the inital click by making a boolean variable true and then when the button is zero again and the boolean is true then a release has occured. These are found in PlayerController.uc

As for OnRelease, in user.ini you can define exec functions to be called in the active classes by using OnRelease function syntax. This will do it automatically for you.

There are other methods of doing so, but they are a bit more intervention wise, and the OnRelease method is probably the best.
 

Teddyboy

New Member
Nov 12, 2004
2
0
0
Thanks everybody for hints :)

I got the ChaosUT sniper code as a base and worked on it. And yes, setting bAltFire = 0 from code achieves what I wanted.

Hmmm ... I guess I'll soon look for somebody to test my new rifle ;)

n1, m8!

Teddyboy