Using DECORATE variable 'Z' in ZSCRIPT function...

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Using DECORATE variable 'Z' in ZSCRIPT function...

Re: Using DECORATE variable 'Z' in ZSCRIPT function...

by SPZ1 » Tue Dec 12, 2017 11:31 am

Thank You, I was able to come up with this bit of code which was what I was seeking:

Code: Select all

Actor p_Player = GetPointer(AAPTR_PLAYER1);

if (self.Pos.z > p_Player.Pos.z){
	A_Print("Monster is Higher");
} else {
	A_Print("Player is Higher");
}
:mrgreen:

Re: Using DECORATE variable 'Z' in ZSCRIPT function...

by Blue Shadow » Mon Dec 11, 2017 6:24 pm

An actor's position is stored as a vector which is named Pos. So you want to use Pos.z, in your case. Of course, the same goes for when you want to access x an y.

Using DECORATE variable 'Z' in ZSCRIPT function...

by SPZ1 » Mon Dec 11, 2017 1:28 pm

If I attempt to use the DECORATE variable 'z' in my ZSCRIPT function, it gives me a warning in the console saying that it is deprecated since 3.2.0. Is there a way around this?

Basically, I am trying to find out if a enemy that is attacking me is above or below me for A_ThrowGrenade() ! I've tried exact numbers and it seems to work but not for up/down dynamically! :bang:

Top