Scripting Variable

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.

Scripting Variable

Postby Misery Theatre » Sat Nov 10, 2018 9:23 pm

I am scripting an elevator by lowering the floor and ceiling by a certain amount. The next script is the door, which only activates by script. But I need the door script to be unable to be activated until the elevator reaches a certain floor Z height, but can't figure out how to word the variable statement. Any assistance I may request on this?
Misery Theatre
Joined: 04 Nov 2018

Re: Scripting Variable

Postby TheMightyHeracross » Wed Nov 14, 2018 9:35 pm

Something like this should do the trick:

Code: Select allExpand view
//Let "tag1" be the sector tag of the elevator
//Let "tag2" be the sector tag of the door
//Let "height" be your chosen height (fixed point, so it must have a decimal point)

script "DoorScript" (void)
   if(GetSectorFloorZ(tag1, 0, 0)  <= height )//If elevator floor is at or below this height at the moment of activation...
      Door_Raise(tag2, speed, delay, lighttag);//...door successfully opens

Obviously the speed, delay, etc. of the door is your choice.

User avatar
...and remember: his silence is golden.
Joined: 18 Aug 2013
Location: Philadelphia, PA
Discord: TheMightyHeracross#1716
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests