[solved] Change weaponbob on the fly
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Global Moderator
- Posts: 1116
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
[solved] Change weaponbob on the fly
Is there any method of changing a weapon's bobbing properties as it's used instead of predefining them?
Last edited by Jekyll Grim Payne on Fri Aug 24, 2018 9:57 am, edited 1 time in total.
-
- Posts: 290
- Joined: Sun May 12, 2013 10:58 pm
Re: Change weaponbob on the fly
I think you can only change the speed or intensity of it, not the style or distance, that might be decorate only. Theres a option for it in GZDoom IIRC, but you can also type in "viewbob 'x' " in the console, I use Viewbob 0.01 personally.
Edit: I apologize for poor reading comprehension. This is a bad habit.
Edit: I apologize for poor reading comprehension. This is a bad habit.
Last edited by Toberone on Thu Aug 23, 2018 7:37 pm, edited 1 time in total.
-
- Global Moderator
- Posts: 1116
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
Re: Change weaponbob on the fly
I'm talking about weapon bobbing (see [wiki=Actor_properties#Weapons]Weapon.BobRangeX[/wiki], etc.), it has nothing to do with view bobbing.Toberone wrote:I think you can only change the speed or intensity of it, not the style or distance, that might be decorate only. Theres a option for it in GZDoom IIRC, but you can also type in "viewbob 'x' " in the console, I use Viewbob 0.01 personally.
-
- Posts: 5032
- Joined: Sun Nov 14, 2010 12:59 am
Re: Change weaponbob on the fly
You can change those directly with ZScript.
-
- Global Moderator
- Posts: 1116
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
Re: Change weaponbob on the fly
And where can I get a bit more information on how to edit properties on the fly?Blue Shadow wrote:You can change those directly with ZScript.
-
- Posts: 5032
- Joined: Sun Nov 14, 2010 12:59 am
Re: Change weaponbob on the fly
Well, you don't edit properties. You edit the variables the properties represent (there's a difference). It's usually done in functions, [wiki=Anonymous_functions]anonymous[/wiki] or otherwise, with the assignment operator:
The invoker tells the engine that it's the weapon itself that you want to do the change to, not the holder of the weapon, i.e. the player.
The bob variables are defined here, along with the other weapon variables.
Code: Select all
class MyCoolWeapon : Weapon
{
States
{
Fire:
BLAH A 1
{
invoker.BobRangeX = 1.5;
}
Goto Ready;
}
}
The bob variables are defined here, along with the other weapon variables.
-
- Global Moderator
- Posts: 1116
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
Re: Change weaponbob on the fly
I see. Thanks!
-
- Global Moderator
- Posts: 1116
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
Re: Change weaponbob on the fly
I don't see how to properly change bobstyle though. If I provide it as a property in Default definition, I can just write weapon.bobstyle "InverseSmooth", for example. But if I try to use invoker.BobStyle = "InverseSmooth"; in a state definition, I get "Script error: Numeric type expected". It looks like the value should be an integer but I can't find through testing which value I need, to be honest.
UPD:
Looks like it's either 1 or 2, I can't quite tell the difference between them.
UPD:
Looks like it's either 1 or 2, I can't quite tell the difference between them.
-
- Posts: 5032
- Joined: Sun Nov 14, 2010 12:59 am
Re: Change weaponbob on the fly
Looking through the source, I got this:
Code: Select all
0 = "Normal"
1 = "Inverse"
2 = "Alpha"
3 = "InverseAlpha"
4 = "Smooth"
5 = "InverseSmooth"