Elevator script, need approval.

Old and generally outdated discussions, with the rare hidden gem. Enter at your own risk.

Moderators: Haplo, Lead Developers

Locked
User avatar
Aaron
Developer
Posts: 276
Joined: Sat Sep 11, 2004 9:00 pm
Location: My own little world
Contact:

Elevator script, need approval.

Post by Aaron »

I am using this elevator script (with different coordinates on one obviously) on two different elevators in my current dwemer ruin claim. This script uses one global variable (TR_Nchaz_Aar_Var_Elev#), is used on both the top and bottom cranks, and controls all elevator and crank functions. The script is so long because the elevator is made up of 22 seperate parts, and the bit of script at the start resets all parts to their correct location when the cell is changed.

Code: Select all

begin TR_Nchaz_Aar_Scpt_Elev1

float cranktimer
float elevtimer
short crankmoving
short active

; Elevator Global Variable States:
; 0 = floor 0, stationary
; 1 = floor 1, stationary
; 2 = moving, floor 0  to floor 1
; 3 = moving, floor 1 to floor 0

if ( CellChanged == 1 )
	set cranktimer to 0
	set elevtimer to 0
	set crankmoving to 0
	set active to 0
	setangle x 0
	if ( TR_Nchaz_Aar_Var_Elev1 == 0 )
		"TR_Nchaz_Aar_Lift1p01"->SetPos Z -388
		"TR_Nchaz_Aar_Lift1p02"->SetPos Z -388
		"TR_Nchaz_Aar_Lift1p03"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p04"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p05"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p06"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p07"->SetPos Z -592
		"TR_Nchaz_Aar_Lift1p08"->SetPos Z -592
		"TR_Nchaz_Aar_Lift1p09"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p10"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p11"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p12"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p13"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p14"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p15"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p16"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p17"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p18"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p19"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p20"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p21"->SetPos Z -688
		"TR_Nchaz_Aar_Lift1p22"->SetPos Z -784
	elseif ( TR_Nchaz_Aar_Var_Elev1 == 1 )
		"TR_Nchaz_Aar_Lift1p01"->SetPos Z 1916
		"TR_Nchaz_Aar_Lift1p02"->SetPos Z 1916
		"TR_Nchaz_Aar_Lift1p03"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p04"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p05"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p06"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p07"->SetPos Z 1712
		"TR_Nchaz_Aar_Lift1p08"->SetPos Z 1712
		"TR_Nchaz_Aar_Lift1p09"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p10"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p11"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p12"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p13"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p14"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p15"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p16"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p17"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p18"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p19"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p20"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p21"->SetPos Z 1616
		"TR_Nchaz_Aar_Lift1p22"->SetPos Z 1520
	elseif ( TR_Nchaz_Aar_Var_Elev1 == 2 )
		set TR_Nchaz_Aar_Var_Elev1 to 1
		"TR_Nchaz_Aar_Lift1p01"->SetPos Z 1916
		"TR_Nchaz_Aar_Lift1p02"->SetPos Z 1916
		"TR_Nchaz_Aar_Lift1p03"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p04"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p05"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p06"->SetPos Z 1872
		"TR_Nchaz_Aar_Lift1p07"->SetPos Z 1712
		"TR_Nchaz_Aar_Lift1p08"->SetPos Z 1712
		"TR_Nchaz_Aar_Lift1p09"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p10"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p11"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p12"->SetPos Z 1760
		"TR_Nchaz_Aar_Lift1p13"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p14"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p15"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p16"->SetPos Z 1720
		"TR_Nchaz_Aar_Lift1p17"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p18"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p19"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p20"->SetPos Z 1632
		"TR_Nchaz_Aar_Lift1p21"->SetPos Z 1616
		"TR_Nchaz_Aar_Lift1p22"->SetPos Z 1520
	elseif ( TR_Nchaz_Aar_Var_Elev1 == 3 )
		set TR_Nchaz_Aar_Var_Elev1 to 0
		"TR_Nchaz_Aar_Lift1p01"->SetPos Z -388
		"TR_Nchaz_Aar_Lift1p02"->SetPos Z -388
		"TR_Nchaz_Aar_Lift1p03"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p04"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p05"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p06"->SetPos Z -432
		"TR_Nchaz_Aar_Lift1p07"->SetPos Z -592
		"TR_Nchaz_Aar_Lift1p08"->SetPos Z -592
		"TR_Nchaz_Aar_Lift1p09"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p10"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p11"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p12"->SetPos Z -544
		"TR_Nchaz_Aar_Lift1p13"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p14"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p15"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p16"->SetPos Z -584
		"TR_Nchaz_Aar_Lift1p17"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p18"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p19"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p20"->SetPos Z -672
		"TR_Nchaz_Aar_Lift1p21"->SetPos Z -688
		"TR_Nchaz_Aar_Lift1p22"->SetPos Z -784
	endif
endif

if ( Menumode == 1 )
	return
endif

if ( OnActivate == 1 )
	if ( crankmoving == 0 )
		if ( TR_Nchaz_Aar_Var_Elev1 < 2 )
			Playsound "Dwemer Door Open"
			Set active to 1
			Set crankmoving to 1
		elseif ( TR_Nchaz_Aar_Var_Elev1 > 1 )
			Messagebox "The elevator is in motion."
		endif
	elseif ( crankmoving == 1)
		Messagebox "The elevator is in motion."
	endif
endif

if ( active == 0 )
	return
endif

if ( crankmoving == 1 )
	if ( cranktimer < 1.5 )
		Set cranktimer to cranktimer + GetSecondsPassed
		Rotate x -100
	elseif ( cranktimer > 1.5 )
		if (cranktimer < 4 )
			Set cranktimer to cranktimer + GetSecondsPassed
			Rotate x 100
			if ( TR_Nchaz_Aar_Var_Elev1 == 0 )
				Set TR_Nchaz_Aar_Var_Elev1 to 2
			elseif ( TR_Nchaz_Aar_Var_Elev1 == 1 )
				Set TR_Nchaz_Aar_Var_Elev1 to 3
			endif
		endif
	endif
endif

if ( cranktimer > 3 )
	Set cranktimer to 0
	Set crankmoving to 0
endif

if ( TR_Nchaz_Aar_Var_Elev1 > 1 )
	if ( TR_Nchaz_Aar_Var_Elev1 == 3 )
		if ( elevtimer < 19 )
			Set elevtimer to elevtimer + GetSecondsPassed
			"TR_Nchaz_Aar_Lift1p01"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p02"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p03"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p04"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p05"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p06"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p07"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p08"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p09"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p10"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p11"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p12"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p13"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p14"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p15"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p16"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p17"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p18"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p19"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p20"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p21"->MoveWorld Z -128
			"TR_Nchaz_Aar_Lift1p22"->MoveWorld Z -128
		endif
	elseif ( TR_Nchaz_Aar_Var_Elev1 == 2 )
		if ( elevtimer < 19 )
			Set elevtimer to elevtimer + GetSecondsPassed
			"TR_Nchaz_Aar_Lift1p01"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p02"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p03"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p04"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p05"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p06"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p07"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p08"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p09"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p10"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p11"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p12"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p13"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p14"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p15"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p16"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p17"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p18"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p19"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p20"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p21"->MoveWorld Z 128
			"TR_Nchaz_Aar_Lift1p22"->MoveWorld Z 128
		endif
	endif
endif

if ( elevtimer > 18 )
	Set elevtimer to 0
	Set active to 0
	if ( TR_Nchaz_Aar_Var_Elev1 == 2 )
		Set TR_Nchaz_Aar_Var_Elev1 to 1
	elseif ( TR_Nchaz_Aar_Var_Elev1 == 3 )
		Set TR_Nchaz_Aar_Var_Elev1 to 0
	endif
endif

end
Claims completed:
Yashazmus, Shrine of Mehrunes Dagon
Mzankh, Dwemer Ruin
Nchazdrumn, Dwemer Ruin
Sirrilas, Shrine of Mephala
Moriken, Abandoned Dunmer Stronghold
Old Necrom Morag Tong GH
Darconis Diamond Mine
Assorted other boring claims.
Starcrunch
Developer Emeritus
Posts: 1649
Joined: Tue Aug 17, 2004 5:12 am
Location: DC, USA

Post by Starcrunch »

Just do it. Note the use in a readme file. This forum is basically dead.

-Starcrunch
Vegor
Developer Emeritus
Posts: 2040
Joined: Sun Mar 07, 2004 4:11 pm
Location: No

Post by Vegor »

Additionally, the script seems fine. It will also be playtested during interior review. So don't worry and just add it.
Assassinace
Developer
Posts: 811
Joined: Thu Aug 21, 2003 10:56 am
Location: Dreamland

Post by Assassinace »

Sorry was out of town. Granted but I still need to test it.
Swiftoak
Developer Emeritus
Posts: 2029
Joined: Wed Feb 02, 2005 12:20 am
Location: Kah-nah-duh
Contact:

Post by Swiftoak »

Do you have any screenies of it?
"Idleness and lack of occupation tend - nay are dragged - towards evil."
-Hippocrates
User avatar
DarkQuiksilver
Member
Posts: 6
Joined: Wed Apr 06, 2005 5:56 am

Post by DarkQuiksilver »

Or you could just make the world move instead of the lift, and make the lift shake minorly from side to side.
Why do our noses run and our feet smell?
User avatar
Aaron
Developer
Posts: 276
Joined: Sat Sep 11, 2004 9:00 pm
Location: My own little world
Contact:

Post by Aaron »

[img]http://img.photobucket.com/albums/v475/BixVT/threadnecro.jpg[/img]

Sorry... had to, I love that picture :p

It doesn't really fit here, but come on, this is a rather old topic ;)

Ok, anyway, uh, this int is already past review, the elevator works fine, and so on and so forth... As for moving the interior... uh, well, yes, that would allow you to make a non-jittery lift but, think about it, that would mean moving hundreds of refs. You'd need another line of script for every single ref, and every single ref would need it's own ID. That = Bad idea ;)
Claims completed:
Yashazmus, Shrine of Mehrunes Dagon
Mzankh, Dwemer Ruin
Nchazdrumn, Dwemer Ruin
Sirrilas, Shrine of Mephala
Moriken, Abandoned Dunmer Stronghold
Old Necrom Morag Tong GH
Darconis Diamond Mine
Assorted other boring claims.
Locked