Help Converting DECORATE

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
MrJohnny
Posts: 212
Joined: Fri Aug 05, 2016 8:41 am

Help Converting DECORATE

Post by MrJohnny »

Can someone please tell me how to replicate this line in zscript?

Code: Select all

TNT1 A 0 A_JumpIf(z<=floorz,"Spawn_Floor")
Blue Shadow
Posts: 5046
Joined: Sun Nov 14, 2010 12:59 am

Re: Help Converting DECORATE

Post by Blue Shadow »

Change z to pos.z and put a semicolon at the end of the line.

Code: Select all

TNT1 A 0 A_JumpIf(pos.z<=floorz,"Spawn_Floor");
MrJohnny
Posts: 212
Joined: Fri Aug 05, 2016 8:41 am

Re: Help Converting DECORATE

Post by MrJohnny »

Thanks, that works.
MrJohnny
Posts: 212
Joined: Fri Aug 05, 2016 8:41 am

Re: Help Converting DECORATE

Post by MrJohnny »

Okay, so I'm trying to make an actor check to see if it's hitting the ceiling, but it only jumps sometimes, not all of the time. I've tried both of these lines, and they both do the same thing: they don't jump all of the time.

Code: Select all

TNT1 A 0 A_JumpIf(pos.z>=ceilingz,"Spawn_Ceiling"); 
TNT1 A 0 A_JumpIf(pos.z==ceilingz,"Spawn_Ceiling");
Any ideas?
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm

Re: Help Converting DECORATE

Post by Arctangent »

An actor's z position is at the bottom of its hitbox, and the idTech engine tries to make sure an actor stays within the bounds of its sector as much as possible. You'll want to add the actor's height to its z position to get the position of the top of its hitbox.

Return to “Scripting”