ok that got it right. now here is lift1 as is:
;Artificial Intelligence Script
;Header
desc = Auto Lift (Up and Down) (activate brings lift to plr)
;Triggers
:state=0,plrhigher=10,plrdistwithin=50:state=6,coloff
:state=1:moveup=1
:state=1,raycastup=20 100:state=2
:state=2,plrdistfurther=55,playerassociated:state=3,unassociateplayer,colon
:state=3,plrhigher=10,plrdistwithin=50:state=7,coloff
:state=4:moveup=-1
:state=4,raycastup=20 0:state=5
:state=5,plrdistfurther=55,playerassociated:state=0,unassociateplayer,colon
:state=6,plrdistwithin=50:sound=audiobank\scifi\scenery\lifts\up.wav,state=1,associateplayer
:state=6,plrdistfurther=55,playerassociated:state=0,colon
:state=7,plrdistwithin=50:sound=audiobank\scifi\scenery\lifts\down.wav,state=4,associateplayer
:state=7,plrdistfurther=55,playerassociated:state=3,colon
:activated=1:state=11,activate=0
:state=11,plrhigher=100:state=21
:state=11:state=31
:state=21,raycastup=20 100:state=3
:state=21:state=1
:state=31,raycastup=20 0:state=0
:state=31:state=4
;End of Script
now if you look at the activation part of the code you will notice the following:
you are above the lift OUTSIDE IT and you call it using a switch.
first up activated is 1 so state goes to 11 and activate goes to 0
next pass, I ASSUME, state 11 is read and playerhigher is greater than 100, OR DOES plrhigher=100 mean it must be 100 exactly?
anyways, state becomes 21
next pass, state is 21 and raycastup does not see anything as you are like 300 higher than the lift, so we go to the next line
state is 21 and then is changed to 1
next pass state is 1 so moveup=1, next line state is 1 raycast fails again
next pass state is still 1 and moveup 1 again and so on
a number of passes later state is still 1 but this time raycastup sees something 100 above, like a roof so this line is valid and state becomes 2
next pass state is 2 and plyrdistfurther is 55 BUT BUT BUT playerassociated is FALSE. you were not in the elevator and never got associated, so the state never changes and the lift hangs at state 2.
this is how i see that the activation code fails in lift1.
NOW NOTE that i have used lift1 and switch1 and if my reading of the code is right, then the lift should have gone up to my level and then locked up. it never moved.
here is what i did to lift1:
;Header
desc = Auto Lift (Up and Down) (activate brings lift to plr)
;Triggers
:state=0,plrhigher=10,plrdistwithin=50:state=6,coloff
:state=1:moveup=1
:state=1,raycastup=20 100:state=2
:state=2,plrdistfurther=55,playerassociated:state=3,unassociateplayer,colon
:state=3,plrhigher=10,plrdistwithin=50:state=7,coloff
:state=4:moveup=-1
:state=4,raycastup=20 0:state=5
:state=5,plrdistfurther=55,playerassociated:state=0,unassociateplayer,colon
:state=6,plrdistwithin=50:sound=audiobank\scifi\scenery\lifts\up.wav,state=1,associateplayer
:state=6,plrdistfurther=55,playerassociated:state=0,colon
:state=7,plrdistwithin=50:sound=audiobank\scifi\scenery\lifts\down.wav,state=4,associateplayer
:state=7,plrdistfurther=55,playerassociated:state=3,colon
:activated=1:state=11,activate=0
:state=11,plrhigher=100:state=21
:state=11:state=31
:state=21,raycastup=20 100:state=3
:state=21:moveup=1
:state=31,raycastup=20 0:state=0
:state=31:moveup=-1
;End of Script
ok at the activation part i cleaned it up.
you are OUTSIDE THE LIFT and press the switch, activation is 1
state is 0 and activated is 1 so state becomes 1 and activate becomes 0
next pass state is 11 and plrhigher is more than 100 so state becomes 21
next pass state is 21 and raycastup fails as you are like 300 above the lift
next line state is 21 so moveup 1
next pass state is 21, raycast fails so next line moveup 1
this goes on until raycastup succeeds as the lift is 100 from the roof.
next pass state is 21 and raycastup succeeds so state becomes 3
next pass state is 3 plrhigher is 10 but plrdistwithin is not 50 as the player is not on the lift yet, so the state stays at 3.
note that if you get on the lift at this point, state becomes 7 and the lift is READY TO GO DOWN.
now it appears that my code is correct, but i have noticed that i have NEVER gotten the lift to move on an activation. i believe that is where it hangs now. in the original code if i got it right the lift should have come up to me and then hanged, but it never moved.
this new code wont move it either.
next post talks about the switch, which is also relevant.