A_RadiusGive and A_CheckProximity

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Elpoder_36
Posts: 3
Joined: Sun Jul 16, 2023 1:33 pm

A_RadiusGive and A_CheckProximity

Post by Elpoder_36 »

I find myself often limited as I feel it lacks more filters or flags to be able to make it more specific to which actors I want the function to go to.
In the case of CheckProximity, it only filters by class, I would like very much that there is a condition for a certain item that the actor to check has, for example, If this or that actor nearby in a radius of 512 that has "item". In this way many more things could be done making this tool more useful.
In RadiusGive, let there be more filters too, or more flags like "closset" or better yet, have a new pointer called "AAPTR_GIVER" referring to the actor who gave the item to others and that information can be taken from the "use" of the item activated by those who received the item.
I feel these are very useful functions for those of us who edit, and need more filtering.
Thank you very much for reading this. Regards.
User avatar
MartinHowe
Posts: 2056
Joined: Mon Aug 11, 2003 1:50 pm
Preferred Pronouns: He/Him
Location: East Suffolk (UK)

Re: A_RadiusGive and A_CheckProximity

Post by MartinHowe »

Sadly, it would be very hard to do this as ZScript stands. In C# we have predicates or callbacks and a yield mechanism. The best we can do right now is to use a block things iterator. The following is a snippet from code I'm using at the moment:

Code: Select all

void find_stuff(double radius)
{
    double radyus = (radius / MAPBLOCKUNITS); // input to the iterator is in these, not map units
    BlockThingsIterator bli = BlockThingsIterator.Create(self, radyus+self.radius);
    while (bli.Next())
    {
        actor mo = bli.thing;
        // Filter out ones you don't want
        if (Distance2D(mo) > raydius) continue; // needed as bli distances are approximate
        if (!mo.bIsMonster && !mo.player) continue;
        if (self.IsFriend(mo)) continue;
        if (mo == self) continue;
        if (mo.health <= 0) continue;
        if (!mo.bShootable) continue;
        if (!origin.CheckSight(mo)) continue;
        // Do stuff with each actor found
    }
}
User avatar
Major Cooke
Posts: 8206
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: A_RadiusGive and A_CheckProximity

Post by Major Cooke »

The AAPTR_ system is completely deprecated with ZScript's presence. It only exists because at the time, there was no other way to access pointers. In ZScript, not only do you have access to pointers, you can create your own for any class you make.

I advise you to learn how to work with ZScript instead.
Elpoder_36
Posts: 3
Joined: Sun Jul 16, 2023 1:33 pm

Re: A_RadiusGive and A_CheckProximity

Post by Elpoder_36 »

Major Cooke escribió:
> The AAPTR_ system is completely deprecated with ZScript's presence. It only
> exists because at the time, there was no other way to access pointers. In
> ZScript, not only do you have access to pointers, you can create your own
> for any class you make.
>
> I advise you to learn how to work with ZScript instead.

Ah well well. I'm new to this editing stuff, I've been doing well with Slade (Decorate) and some ACS. I'll take the advice and go learn some Zscript which should be more complete.

I take this opportunity to ask, if also from Zscript or from Decorate it is possible to restrict to the "Friendlys" monsters the action of setting the target to another friendly or player, since in a standard way it can not be done to

Thanks for your answers!
Post Reply

Return to “Feature Suggestions [GZDoom]”