{x} to use - interactable actor prompt on hud
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!)
{x} to use - interactable actor prompt on hud
How would I go about scripting a hud element that appears next to the crosshair when looking at an interactable actor? Selaco has the exact kind that I want but the scripting for it is a lot more complex than I'd need.
- ramon.dexter
- Posts: 1562
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: {x} to use - interactable actor prompt on hud
So, what do you think? The coding for such task IS pretty complex.
- R4L
- Global Moderator
- Posts: 426
- Joined: Fri Mar 03, 2017 9:53 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11 Pro
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: {x} to use - interactable actor prompt on hud
While I agree with the latter part of your post, why must you always put a sarcastic spin on things?ramon.dexter wrote: ↑Wed Nov 06, 2024 12:42 am So, what do you think? The coding for such task IS pretty complex.
Only thing I can suggest is checking out how Selaco did it or how other mods display information on the HUD and start from there.
- ramon.dexter
- Posts: 1562
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: {x} to use - interactable actor prompt on hud
So, dude wants pretty complex function to add, but he doesnt like how complex the coding is. If the functionaly could be achieved with some simple coding, the simple coding would be already used. But if the functionality is missing, it usually involves a lot of custom complex coding.
I've just learned that lots of 'simple visual things' involves a big load of custom coding in the backside.
I've just learned that lots of 'simple visual things' involves a big load of custom coding in the backside.
- Jekyll Grim Payne
- Global Moderator
- Posts: 1120
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
- Contact:
Re: {x} to use - interactable actor prompt on hud
How about you don't participate in a thread if you have nothing relevant to say? OP asked as question. You're not answering it. And how complex it is, is debatable.ramon.dexter wrote: ↑Thu Nov 07, 2024 12:44 am So, dude wants pretty complex function to add, but he doesnt like how complex the coding is. If the functionaly could be achieved with some simple coding, the simple coding would be already used. But if the functionality is missing, it usually involves a lot of custom complex coding.
I've just learned that lots of 'simple visual things' involves a big load of custom coding in the backside.
- Jekyll Grim Payne
- Global Moderator
- Posts: 1120
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
- Contact:
Re: {x} to use - interactable actor prompt on hud
This boils down to what should be considered an "interactable actor." There's no universal identifier of such a thing. Any actor can be made interactable, provided it has the SOLID flag, and its Used() virtual function is overridden; thus, it's not possible to determine if a specific actor is interactive or not from outside. So, if these are your own actors and you have full control over them, your first task would be to come up with an actual identifier for something like this (such as a custom flag, for example).
Other than that, attaching an example of how to do this. This will print a prompt for any actor. You can modify the custom isActorInteractable function to add custom conditions instead.
Re: {x} to use - interactable actor prompt on hud
This is perfect! Thank you so much for this.Jekyll Grim Payne wrote: ↑Thu Nov 07, 2024 4:27 amThis boils down to what should be considered an "interactable actor." There's no universal identifier of such a thing. Any actor can be made interactable, provided it has the SOLID flag, and its Used() virtual function is overridden; thus, it's not possible to determine if a specific actor is interactive or not from outside. So, if these are your own actors and you have full control over them, your first task would be to come up with an actual identifier for something like this (such as a custom flag, for example).
Other than that, attaching an example of how to do this. This will print a prompt for any actor. You can modify the custom isActorInteractable function to add custom conditions instead.
InteractionPrompt.zip
This will mostly be used for actors (items) that have an ACS script attached, or NPCs with dialogue. So a custom flag is the way to go I think. Thanks for the concise help!
EDIT: Getting 'Cannot use a named argument here - not all required arguments have been passed'
for line 41:
Tried adding it myself but don't think I've got the wording righttracer.Trace(start, mo.cursector, dir, mo.radius + mo.userange, traceflags: 0, wallmask: 0, ignore: mo);
- Jekyll Grim Payne
- Global Moderator
- Posts: 1120
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
- Contact:
Re: {x} to use - interactable actor prompt on hud
In GZDoom 4.13.0 the ability to use named arguments was extended. Note that in my file I have version 4.13.0, which allows me to use extended named arguments. In earlier versions, they're more limited. Details are covered here on the wiki. I recommend using the latest version of GZDoom, however (and thus declaring your zscript version to be the latest), unless you have strong reasons to stick to an earlier version.hvgcore wrote: ↑Sun Nov 10, 2024 6:07 pm EDIT: Getting 'Cannot use a named argument here - not all required arguments have been passed'
for line 41:
Tried adding it myself but don't think I've got the wording righttracer.Trace(start, mo.cursector, dir, mo.radius + mo.userange, traceflags: 0, wallmask: 0, ignore: mo);