Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Armolitskiy

How to make custom weapon recoil setting in the settings menu?

Question

How to make custom weapon recoil setting in the settings menu?

I use the "A_SetPitch" parameter to create weapon recoil in the decorate scripts. And I need to add a slider to the settings so that I can change the recoil. I added a slider, but how to make it change the recoil of the weapon?

Share this post


Link to post

5 answers to this question

Recommended Posts

  • 0
13 hours ago, ([zen3001]) said:

you can use GetCvar() to get the value the user picked.

the pitch function should look like this:

A_SetPitch(pitch-GetCvar(users_value)) 

 

not working

MENUDEF:
OptionMenu "OptionsMenu"
{
    Slider "Weapon Recoil", "recoil", 0, 10, 0.1, 1
}

 

CVARINFO:
user float recoil = 10;

GETCVAR:
if (GetCVar("recoil "))
{
    A_SetPitch (pitch-GetCvar(users_value))
}

Share this post


Link to post
  • 0

sorry my, fault turns out you must write it that arguement as a string, and with user_value I just meant what ever variable you would have defined in your cvarinfo.

In this case it's recoil so, A_SetPitch(pitch-GetCvar("recoil"))

Share this post


Link to post
  • 0
15 hours ago, ([zen3001]) said:

sorry my, fault turns out you must write it that arguement as a string, and with user_value I just meant what ever variable you would have defined in your cvarinfo.

In this case it's recoil so, A_SetPitch(pitch-GetCvar("recoil"))

sorry, not working

Share this post


Link to post
  • 0
Quote

Returns the value of the console variable as a float. If the variable could not be found, or its scope is user and the calling actor is not a player, the function returns 0.

 

it turns out, the GetCvar function only works when the user is calling the function if function has a user scope, what you could do is use a server scope instead but this might mess up the multiplayer depending on how much freedom you want to give the different players if you care about multiplayer. There should be another function that doesn't care about the scope maybe there and I missed it, try looking it up yourself if you don't like the limitation of this one

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×