Jump to content

check vector of an entity with 'if'


Recommended Posts

I am setting up my elevator scripts and I want to set up 'call' buttons that check to see if the elevator is already at that location (and play a sound if it is) before running the script to call the elevator. I cant figure out how to set up the if statement to check if 'elevator''s vector is equal to [vector_number]

therfiles likes this
Link to comment

Now would that check that the position of my 'elevator' entity matches the given numbers? right now my call buttons just fire the same script used to bring the player to that level. But if used while the elevator is already there, nothing moves, but the soundsets still play. I am trying to idiot-proof my elevator. 

Link to comment

Oh are you useing a func_door/plat? This would really work with a func_static.

 

First, make you elevator a func_static with an origin brush. Then, give it a script_targetname. Run a script on startup that affects your elevator (lets say you gave it the script_targetname of elevator_01). Then, on elevator_01, set parm1 to 0. In this example. we'll use parm1 as variable that states whether or not the elevator is at the extended position (hence the initial value of 0, or false). Then, make 2 ref tags, one where you make your origin brush (this will be used when your elevator returns to it's location, call it elevator_01_start) the other where it will end up. Then make a script that would run when the player presses the activating button or switch that checks the value of parm1 on elevator_01. If parm1 = 0, the elevator needs to move up, so include the move commands and set parm1 to 1. If parm1 = 1, the opposite should occur.

 

I'm just afraid since you are using a func_plat that you won't quite be able to exactly know the location of the entity, thus the if vector command wouldn't really work. Does this make sense? I've experienced several problems with using func_plats/doors, and I have found this to work pretty well.

Link to comment

Hi. I had a multi level callable elevator in my ffa3 plugin, and I dug out the scripts. You'll have to look at them and decipher if theres anything of value to you. im extremely inebriated right now, so i find myself unable to explain whats going on. Apparently I split it into multiple scripts and used a global variable with hand imputed vectors and move times. 
 

https://www.dropbox.com/s/bdaebu8q286kkmy/ElevatorFFA3.rar

 

 

There go. Let me know if it helps

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...