Hi everyone. I'm trying to achieve the following in ZScript (GZDoom version 4.14.1):
When an actor (A) uses A_RadiusGive to give an item (CustomInventory, Inventory, or any viable solution) to nearby actors (B), I need each receiver (B) to know who gave them the item and set that actor as their master.
Things I've tried so far:
I created a class derived from CustomInventory and tried to override bool Use(Inventory owner), but it throws this error:
Attempt to override non-existent virtual function Use
I also tried TryPickup, but that gave:
Attempt to override non-existent virtual function TryPickup
I attempted a workaround using a custom Actor token that stores the giver and performs A_RadiusGive, but the receiving actor has no reliable way of knowing who the giver was—unless I rely on a static field, which doesn't work properly with multiple simultaneous instances.
What I specifically want is:
When the actor receives the item, to be able to do something like self.master = whoever_gave_me_this
It must support multiple givers acting at the same time (no global/static variables)
It shouldn't depend on overriding functions like Use or TryPickup if they're not virtual anymore
Ideally usable from Decorate with A_RadiusGive, but if needed, I can call from ZScript too
Is there a canonical or reliable way to do this in modern ZScript (GZDoom 4.14.1)?
Any insight, workaround, or example would be greatly appreciated!
Thanks in advance!
How can a RadiusGive receiver know who gave them the item? (setting master)
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: 6
- Joined: Sun Jul 16, 2023 1:33 pm