GetActorZ to ignore 3D Floor?

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.

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!)
Post Reply
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

I'm trying to create a Hazardous situation where if player is below a specified thing, he receives damage, and for the most part it works just as I need it to

Code: Select all

 If( GetActorZ(0) <= (GetActorZ (hurtsectortag) )  )
{
	 Spawn("HazardThing",GetActorX(0)
				             ,GetActorY(0)
				             ,GetActorZ(0));
}
However I'm having this small but annoying issue where If the player is standing on a 3D Floor it will calculate the height from above that 3D Floor rather than the whole sector, meaning returning value is always the same whether you're below or above the 3D Floor, Is there anyway to tell the game to ignore the 3D Floors? Like can I get the exact Z Position? Thanks in advance.
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

Any idea on how to solve this? no matter what I do it always returns the value relative to the floor player is standing on, I want it to basically ignore 3D Floors.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetActorZ to ignore 3D Floor?

Post by Graf Zahl »

GetActorZ returns the absolute Z-position. It appears you are making a wrong assumptions somewhere but that code fragment is too small to give you any advice.
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

Code: Select all

script 23 (int hurtsectortag) //hurtsectortag is the tag of the thing to use to compare Z Positions.
{
    If( (GetActorZ(0)) > (GetActorZ(hurtsectortag)) )
	{
	 Print(s:"Moving above the actor");
	}
	else
    If( (GetActorZ(0)) <= (GetActorZ(hurtsectortag)) )
    {
	 Print(s:"Moving Below the actor");
	 Spawn("HazardThing",GetActorX(0)
				             ,GetActorY(0)
				             ,GetActorZ(0));
    }
}
This is basically the full code, I don't really understand what I'm doing wrong, Little help please :/ Also the script is re-executed every tick from another script, and it works just fine but it acts really strange when standing on 3D Floors.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetActorZ to ignore 3D Floor?

Post by Graf Zahl »

Are you sure that the hurtsectortag thing actually is where you expect it to be?
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

Yeah I'm pretty sure, It's placed below the 3D Floor, however when I stand on the 3D Floor I receive damage. It's like the game is calculating the height relative to the 3D Floor and not giving the exact position, this is confusing.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetActorZ to ignore 3D Floor?

Post by Graf Zahl »

You need to analyze the situation instead of just guessing. Print out the coordinates you get and see if they are correct.
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

So I tried Printing GetActorZ for both the player and the thing, for some reason it seems the Z Height updates relative to the 3D Floor whenever I step above the 3D Floor inside the same sector where the thing is placed (read: Prints height of 0 rather than the actual height), the game thinks I'm below the height of actor and spawns the actor eventhough I'm in fact above both the 3D Floor and the Thing, I've no idea why this is happening, It made it seem like GetActorZ does not ignore the 3D Floor, know how I can solve this? :oops:

EDIT : Solved, somehow there was another actor using the same tag elsewhere on the map, changing that actor's tag fixed it, If anyone is still having this issue make sure to check your tags lol, I feel dumb, Thanks for the help, really appreciate it.
Last edited by LOZ_98 on Thu May 10, 2018 4:17 pm, edited 1 time in total.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: GetActorZ to ignore 3D Floor?

Post by Matt »

Shouldn't [wiki]GetActorZ[/wiki] return the absolute position anyway?

Is it at all possible some other thing is interfering with the result?
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

Matt thanks for the help, Indeed that was it, I somehow gave another thing the same tag as the hurt thing (dunno how that happened) giving it a different tag solved it, Thanks again really appreciate it, and sorry If I sounded dumb lol
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: GetActorZ to ignore 3D Floor?

Post by Matt »

I wonder if there's a way to get a unique TID in ACS without ZScript...
User avatar
LOZ_98
Posts: 67
Joined: Thu Mar 22, 2018 7:46 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: GetActorZ to ignore 3D Floor?

Post by LOZ_98 »

There is, I used it twice or so for something non-mapping related, It's UniqueTID(min, max);
Post Reply

Return to “Scripting”