ACS CheckProximity

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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.

ACS CheckProximity

Postby Nigel Sablingmone » Tue Jun 30, 2020 12:27 am

Hello

I am trying to get the distance of something to the nearest player in Doom. When I walk near the Medikit it still prints NOPE. I'm not sure where this is going wrong. I was able to give inventory to myself within this script, but I'm not sure if that is a good test to see if SetActivator is working. I was wondering if this is possible in ACS without any ZScript:

```
Script 2 ENTER
{
SetActivator(0, AAPTR_NULL);
if (CheckProximity(0, "Medikit", 256.0, 1, CPXF_ANCESTOR))
{
Print(s:"YUP!");
}
else
{
Print(s:"Nope.");
}
delay(35);
restart;
}
```
Nigel Sablingmone
 

Re: ACS CheckProximity

Postby Jarewill » Tue Jun 30, 2020 12:57 am

What exactly are you trying to do?
The only off thing I see with this is that it has SetActivator(0, AAPTR_NULL); there.
That sets the activator of the script to be the world instead of the player.
And I don't think it's quite possible to check if there's a medikit nearby, if there's no actor that checks it at all.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: ACS CheckProximity

Postby septicpig » Wed Jul 01, 2020 10:26 am

(I have no idea why it says my name is Nigel Sablingmone and I cannot edit the message, but I am the original poster.)

I should start over with describing my problem. I was up late and lost the ability to explain myself clearly. Sorry! I was going a bit nuts trying to get this to work. :D

I am using Doom Builder X 2019.1 and running a test level with DOOM2.wad in Zandronum.
I placed a player and an Imp on the map, and used the example code from the wiki to test CheckProximity:

https://zdoom.org/wiki/CheckProximity
Code: Select allExpand view
Script "Shotgunguy_Checker" Enter
{
    if (CheckProximity(0, "DoomImp", 256.0, 1))
    {
        Print(s:"There's an imp somewhere around!");
    }
    else
    {
        Print(s:"There are no imps around.");
    }

    Delay(35);
    restart;
}


But when compiling this and testing it, the condition never responds with True condition, i.e. "There's an imp somewhere around!", it always returns "There are no imps around."
Also I noticed that the CheckProximity function is not highlighted and has no tooltip helpers when writing it in like other things. I made sure I have the latest ACC. I dont know how to update the config for syntax highlighting but I'm assuming that isn't causing the issue. I also read on another thread that this function needs to be used in DECORATE and not in ACS but that is not information available on the Wiki, it appears to be for ACS. But I'm starting to consider other causes at this point.

What could be preventing this from evaluating correctly? I can't figure out what the missing link is.
If it is helpful I can upload my test map, but again, it is just an imp in a room with the WIki script compiled.
User avatar
septicpig
 
Joined: 30 Jun 2020

Re: ACS CheckProximity

Postby Jarewill » Wed Jul 01, 2020 2:31 pm

Weird, the script works fine for me.

I have a few questions:
- Does the script start with this line?
Code: Select allExpand view
#include "zcommon.acs"

It's usually needed for scripts, though the script just wouldn't compile without it normally.

- Is the compiled script named "BEHAVIOR"
It should name itself that automatically if compiling the script in a wad with a map, but it might have not.

If both of those are true, then could you post your map?
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: ACS CheckProximity

Postby septicpig » Wed Jul 01, 2020 3:14 pm

OMG it works for you? That is a huge relief, first of all.

Yes, I do have zcommon.acs included. I have a few other scripts that are working so I know the scripting area in Doom Builder X compiles and runs when the map starts, or on ENTER. Also I have a script in my wad's A_START A_END markers that works. And this CheckProximity script is running, too, because the "else" in the "if" conditional returns, so I know the script runs and is trying the function, I just can't tell if the function is being recognized or not. I don't think I saw anything in the console about it, but maybe I should look again.

I don't know how to check if the script is named BEHAVIOR. Should I open my .wad in Slade3 and look for that? I have not read about BEHAVIOR before, I will look that up. Is this the default script name for a map's local script? I normally edit local map scripts directly through a map builder.

Could you tell me what "environment" setup you are using? Builder/ACC/Source Port/etc? Are you testing the map by launching the "test map" feature of a builder? Any info would be helpful. I feel like maybe something on my end is not configured right, or I'm using an outdated version of something. It is strange that the wiki example running in vanilla doom2.wad on Zandronum 3.0 doesn't work.

As soon as I get to my computer later today I will check into the BEHAVIOR thing and also upload the ProximityCheck test.wad with the wiki example I am running.

Thanks for the assistance thus far!
User avatar
septicpig
 
Joined: 30 Jun 2020

Re: ACS CheckProximity

Postby septicpig » Wed Jul 01, 2020 6:56 pm

I did some deeper research and sadly, I think CheckProximity is missing from Zandronum's engine. I started suspecting it was the source port because I have exhuasted all other possibilities. So, I'm assuming you are using GZDoom? Zandronum 3.0 runs on a much older version of GZDoom apparently and it prevents all sorts of advanced features from carrying over. SO SAD. This should probably be on the Wiki. Maybe I will try to edit it.

Here is the attached .wad if you want to try it anyway, but I think I the case is closed unless you know of some miracle cure.

Thank you for your help and for helping me reach a conclusion to this!
Attachments
proxtest.wad
(2.08 KiB) Downloaded 2 times
User avatar
septicpig
 
Joined: 30 Jun 2020

Re: ACS CheckProximity

Postby Blue Shadow » Wed Jul 01, 2020 7:37 pm

septicpig wrote:(I have no idea why it says my name is Nigel Sablingmone and I cannot edit the message, but I am the original poster.)

That's because you weren't logged in at the time you made the post; you were posting as a guest.
User avatar
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: ACS CheckProximity

Postby Jarewill » Thu Jul 02, 2020 12:32 am

septicpig wrote:I did some deeper research and sadly, I think CheckProximity is missing from Zandronum's engine. I started suspecting it was the source port because I have exhuasted all other possibilities. So, I'm assuming you are using GZDoom? Zandronum 3.0 runs on a much older version of GZDoom apparently and it prevents all sorts of advanced features from carrying over. SO SAD. This should probably be on the Wiki. Maybe I will try to edit it.

Yes, I'm using GZDoom.
It seems Zandronum doesn't support this function, as the script ran fine for me.

As a final question: have you tried standing near the imp for a second or so?
The script restarts every second, so it doesn't update instantly when there's an imp around.

If that doesn't work, then Zandronum might simply not support it. Sorry.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: ACS CheckProximity

Postby septicpig » Fri Jul 03, 2020 12:42 pm

That's because you weren't logged in at the time you made the post; you were posting as a guest.

LOL thank you Blue Shadow, I thought I was logged in at the time I made the post but I must have been half asleep and confused myself and never properly signed in.

As a final question: have you tried standing near the imp for a second or so?

I have, yes. I am certain it is Zandronum limitations at this point as I have had a lot of success with other ACS scripting/editing at this point.

Thank you for your time and assistance, Jarewill!
User avatar
septicpig
 
Joined: 30 Jun 2020


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests