CustomInventory erases user variables upon pickup
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
CustomInventory erases user variables upon pickup
I use a series of CustomInventory actors that inherit from one parent, and differentiate from each other through user variables. I'm trying to do something new that involves them being picked up, but once we hit the Pickup state, I can no longer rely on the user variables through A_JumpIf, because as soon as it's picked up, the variables are all blanked (or, more specifically, my three variables are, for some reason, set to 2424382, 65536, 65536). Can this be adjusted so that the variables are still valid until the actor is actually gone from play?
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: CustomInventory erases user variables upon pickup
Who does pick the item(s), a player or non-player actor(s)? The reason I'm asking is because players can't hold user vars. [wiki=Advanced_DECORATE_functions_guide#A_SetUserVar.2FArray]See here[/wiki].
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: CustomInventory erases user variables upon pickup
Ahh, good point... Yeah, these are to be picked up by players. I guess once it gets to the Pickup state, it changes hands, and things get messy...
EDIT: I suppose I could mention, I've come up with a long-way workaround for the effect I was after, so if this turns out to be unfixable/not a bug/won't change, I won't be entirely crushed.
EDIT: I suppose I could mention, I've come up with a long-way workaround for the effect I was after, so if this turns out to be unfixable/not a bug/won't change, I won't be entirely crushed.
Re: CustomInventory erases user variables upon pickup
This is because it's called in the context of the actor picking it up. Since the actor picking it up doesn't have the same user variables as the item, you can't access them.
Bollocks. Every actor can have user variables. Weapons and players only complicate things because weapons can't access their own variables when called by the player.Blue Shadow wrote:players can't hold user vars
-
Blue Shadow
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: CustomInventory erases user variables upon pickup
Well, to be honest, I only went with what the wiki said...randi wrote:Bollocks. Every actor can have user variables. Weapons and players only complicate things because weapons can't access their own variables when called by the player.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------ZDoom wiki wrote:Since its introduction, user variables and arrays have been an extreme benefit to the community. This alone allows for reduction of bloat code (copy/pasted lines with many angle changes) except for weapons and players. Those two are the only things which cannot hold user variables or arrays due to their complex nature.
Edit: @Ed: Sorry for the false info.
Last edited by Blue Shadow on Wed Feb 13, 2013 9:30 pm, edited 1 time in total.
- Zhs2
- Posts: 1303
- Joined: Fri Nov 07, 2008 3:29 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Maryland, USA, but probably also in someone's mod somewhere
- Contact:
Re: CustomInventory erases user variables upon pickup
Would it be correct to assume that weapons cannot make use of player variables, but players can still have variables affected by outside factors and whatnot? I'd imagine that you could store a set of user variables per player, and then certain functions could affect these variables and then get accessed when called by ACS_ExecuteWithResult with the player as an activator in a weapon's damage function (obviously not something that would work with projectiles, but such is the spice of life?) Just some things I've been thinking about in reference to a certain RPG mod... cough cough...