Page 1 of 1

Scripting Variable

Posted: Sat Nov 10, 2018 9:23 pm
by Misery
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?

Re: Scripting Variable

Posted: Wed Nov 14, 2018 9:35 pm
by TheMightyHeracross
Something like this should do the trick:

Code: Select all

//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.

[wiki]GetSectorFloorZ[/wiki]