[DECORATE] User variables and different frames

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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.

[DECORATE] User variables and different frames

Postby DamTheGreat » Mon Sep 13, 2021 9:27 am

I have an idea for a future project after my map pack is released, but I'm already asking now to see if my idea is even possible. My idea is for a custom gun that has a sideways magazine with visible bullets, so after every shot, there would need to be a new frame with the magazine shifted to the side and when the magazine is empty, the same cycle repeats, but flipped. I'm thinking of using user variables like this:


Spoiler:


I would of course reduce the user_bullets variable by one at each shot and after 46 shots, put it back to 46. Is the way I intend to use "if" and user variables even possible, or is there another way I could implement my idea?
User avatar
DamTheGreat
 
Joined: 26 Oct 2020
Location: Luxembourg
Discord: ☠DamTheGreat☠#7201
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [DECORATE] User variables and different frames

Postby Jarewill » Mon Sep 13, 2021 11:06 am

DECORATE is very limited with user variables and what you are thinking about is not possible that way.
For one to check user variables you have to use specific functions, and the "equals" operator is "==" and not "=".
For two, you cannot do the states like that. You can do the checks inside a frame, but you can't use checks to specify a frame.
And lastly, user variables don't even work with weapons.

You are better off using inventory tokens instead of user variables and also overlays are way better for what you want to do.
Example of an inventory token:
Code: Select allExpand view
Actor MyGunBullets Inventory {Inventory.MaxAmount 46

DECORATE is very limited, so you either have to hack around it with inventory tokens or use ZScript, as it allows variables inside weapons.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: [DECORATE] User variables and different frames

Postby DamTheGreat » Mon Sep 13, 2021 6:46 pm

Jarewill wrote:DECORATE is very limited with user variables and what you are thinking about is not possible that way.
For one to check user variables you have to use specific functions, and the "equals" operator is "==" and not "=".
For two, you cannot do the states like that. You can do the checks inside a frame, but you can't use checks to specify a frame.
And lastly, user variables don't even work with weapons.

You are better off using inventory tokens instead of user variables and also overlays are way better for what you want to do.
Example of an inventory token:
Code: Select allExpand view
Actor MyGunBullets : Inventory {Inventory.MaxAmount 46}

DECORATE is very limited, so you either have to hack around it with inventory tokens or use ZScript, as it allows variables inside weapons.


Yeah, that's what I though... DECORATE is very limited, I only thought of it because I know a little bit of it but it looks like if this project is ever going to happen, I'm gonna have to learn ZScript...
User avatar
DamTheGreat
 
Joined: 26 Oct 2020
Location: Luxembourg
Discord: ☠DamTheGreat☠#7201
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: eharper256 and 1 guest