I don't know if this is a bug with my ZScript code or GZDoom, but it looks like Actor.Used does nothing. The comment above the method definition in zscript/actor.txt indicates that it is called whenever someone presses "Use" on the actor. So, I tried using it myself, and now the zip line does not work as intended.
BTW, I searched the GZDoom source code using grep, and there were no matches for "DEFINE_ACTION_FUNCTION(AActor, Used)".
Actor.Used does not work
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.
Re: Actor.Used does not work
Please define "does not work". The following sample work as expected for me
Do 'summon UsableTechLamp' and press use on it. The message will be printed.
DEFINE_ACTION_FUNCTION is used for native methods only. Actor.Used() is fully defined in ZScript. In C++ code it's called from here.
Code: Select all
class UsableTechLamp : TechLamp
{
override bool Used(Actor user)
{
Console.Printf("Hello! I'm just a TechLamp");
return false;
}
}
DEFINE_ACTION_FUNCTION is used for native methods only. Actor.Used() is fully defined in ZScript. In C++ code it's called from here.
-
- Posts: 4949
- Joined: Sun Nov 14, 2010 12:59 am
Re: Actor.Used does not work
From the commit message:
This method will only be called if the actor does not have the USESPECIAL flag - that one will be handled as before.
-
-
- Posts: 374
- Joined: Mon Jun 27, 2016 7:26 pm
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Actor.Used does not work
Thanks. I found out for myself that the USESPECIAL flag prevented Actor.Used from being called after doing a bit of experimenting.
I guess it's a question of either allowing Actor.Used and USESPECIAL to be combined, or explicitly specifying that Actor.Used cannot be used with USESPECIAL.
I guess it's a question of either allowing Actor.Used and USESPECIAL to be combined, or explicitly specifying that Actor.Used cannot be used with USESPECIAL.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Actor.Used does not work
Both methods have mutually exclusive semantics. And the flag being a switchable property, unlike the virtual method, has to be given priority.
-
-
- Posts: 374
- Joined: Mon Jun 27, 2016 7:26 pm
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Actor.Used does not work
How about changing the comment above Actor.Used to this, then?
Pull request
Code: Select all
// Called when the player presses 'use' and an actor is found, except if the
// UseSpecial flag is set. Use level.ExecuteSpecial to call action specials
// instead.
-
- Posts: 4949
- Joined: Sun Nov 14, 2010 12:59 am
Re: Actor.Used does not work
[wiki=Used]I added the function to the wiki[/wiki].