Weapons/Armor Changing Sprites Depending On Variables
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!)
-
- Posts: 86
- Joined: Thu Dec 22, 2016 1:39 pm
- Graphics Processor: Intel (Modern GZDoom)
- Location: here and there, at the same time
Weapons/Armor Changing Sprites Depending On Variables
Was making a mod with a randomizer to add different looks for weapons and armor depending on an internal rolled number, I would like to know how I would go about doing this, or where a tutorial would be that would help.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Weapons/Armor Changing Sprites Depending On Variables
Code: Select all
a_jumpif( "internal_rolled_number" == first_defined_value, "state_dependent_on_first_defined_value")
a_jumpif( "internal_rolled_number" == second_defined_value, "state_dependent_on_second_defined_value")
...
-
- Posts: 86
- Joined: Thu Dec 22, 2016 1:39 pm
- Graphics Processor: Intel (Modern GZDoom)
- Location: here and there, at the same time
Re: Weapons/Armor Changing Sprites Depending On Variables
What would these defined values be? would they be the sprites or something? Also, what's the ... part for? I'm sorta new to this scripting thing.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Weapons/Armor Changing Sprites Depending On Variables
How much you know?
Can you code simple, working weapon, than can shoot/bob/reload/make coffee at morning? Pistol, shootgun, magick wand, boomstick, anything?
Can you code simple, working weapon, than can shoot/bob/reload/make coffee at morning? Pistol, shootgun, magick wand, boomstick, anything?
-
- Posts: 86
- Joined: Thu Dec 22, 2016 1:39 pm
- Graphics Processor: Intel (Modern GZDoom)
- Location: here and there, at the same time
Re: Weapons/Armor Changing Sprites Depending On Variables
I know how to make a menu, and I found weasels old decorate tutorials. I do know how to make a weapon that fires at least bullets and shotgun shells.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Weapons/Armor Changing Sprites Depending On Variables
How much "looks" and what number you wish to use?SwiftFunk wrote:different looks for weapons and armor depending on an internal rolled number
-
- Posts: 86
- Joined: Thu Dec 22, 2016 1:39 pm
- Graphics Processor: Intel (Modern GZDoom)
- Location: here and there, at the same time
Re: Weapons/Armor Changing Sprites Depending On Variables
at least the colors yellow, red, and cyan for weapons and armor. so the number range would be 1-3 cause 3 colors.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Weapons/Armor Changing Sprites Depending On Variables
Here example with CVARs.
You can set cvar using menu.
More here
https://zdoom.org/wiki/CVARINFO
Code: Select all
actor colorful_armor:bluearmor
{states
{
spawn:
sprite letter number a_jumpif(getcvar("inventory_color") == 1, "red_armor")//getcvar return server float Console VARiable you can assign any number for any color, it just example
sprite letter number a_jumpif(getcvar("inventory_color") == 2, "cyan _armor")//jump perform only if all conditions inside a_jumpif will become true
sprite letter number a_jumpif(getcvar("inventory_color") == 3, "yellow_armor")//two = because programming feature, single = means "make staff from left part eaqule to right", two means "if left part eaqule right"
loop
red_armor://this state has sprite of yellow armor
sprite letter number a_jumpif(getcvar("inventory_color") == 0, "spawn")//if no cvar set go back to standart sprite
sprite letter number a_jumpif(getcvar("inventory_color") == 2, "cyan _armor")//in case if you tired from red color and want switch to another
sprite letter number a_jumpif(getcvar("inventory_color") == 3, "yellow_armor")
loop
cyan _armor://as write higher
sprite letter number a_jumpif(getcvar("inventory_color") == 0, "spawn")
sprite letter number a_jumpif(getcvar("inventory_color") == 2, "cyan _armor")
sprite letter number a_jumpif(getcvar("inventory_color") == 3, "yellow_armor")
loop
yellow_armor://-
sprite letter number a_jumpif(getcvar("inventory_color") == 0, "spawn")
sprite letter number a_jumpif(getcvar("inventory_color") == 2, "cyan _armor")
sprite letter number a_jumpif(getcvar("inventory_color") == 3, "yellow_armor")
loop
}}
More here
https://zdoom.org/wiki/CVARINFO