Hi all,
I'm trying to create a custom HealthPickup item, and I'd like it to execute additional code either if manually used, or if auto-use is triggered on near-death scenario.
Previously, I was inheriting from CustomInventory class, so it was possible to define and use the "Use" state to execute the custom code. But when inheriting from "HealthPickup" class, this is no longer possible. So next, I tried overriding the virtual Use() function. This works when the item is manually used by the player, but on automatically triggered use of the item, the virtual function seems to be ignored.
Does anyone have an idea how to solve this problem? Should I instead look for and override one of the damage or death related virtual functions of PlayerPawn class instead?
HealthPickup AutoUse with custom code execution
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!)
- Player701
-
- Posts: 1710
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: HealthPickup AutoUse with custom code execution
Health auto-use code calls the Use method on health items only if their auto-use mode is 3 (Strife-like). The other two modes use an entirely separate routine which does not call Use and instead adds to player's health directly. I don't think it can be overridden because the corresponding methods are not marked virtual.