Scripts / [SOLVED] E key to open auto close.

Author
Message
Incenseman2003
6
Years of Service
User Offline
Joined: 4th Nov 2018
Location:
Posted: 19th Jan 2019 22:20 Edited at: 19th Jan 2019 22:32
I have been working with the door.lua.
I am trying to get the door to open with the "E" key and once the player is through the door it closes automatically.
What changes need to made to the file to make this happen?
Thanks in advance.

The author of this post has marked a post as an answer.

Go to answer

Attachments

Login to view attachments
PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 19th Jan 2019 23:39 Edited at: 19th Jan 2019 23:39
You must place the door close animation outside of the playerDist<100 and specify "the player is gone through the door".
Something like this:

This script close the door if the player is 150 units away.
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
Incenseman2003
6
Years of Service
User Offline
Joined: 4th Nov 2018
Location:
Posted: 20th Jan 2019 02:05
Unfortunately this did not even prompt me to open the door.
If I press the "E" key anyway nothing happens.
I truly have tried to learn scripting but it does seem to be way beyond me.
PM
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 20th Jan 2019 08:15
Did you get an error?
I tested it with different doors and it works for me.
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
Incenseman2003
6
Years of Service
User Offline
Joined: 4th Nov 2018
Location:
Posted: 20th Jan 2019 14:28 Edited at: 20th Jan 2019 14:36
This post has been marked by the post author as the answer.
I renamed the file when I added it to my script bank and that seems to be the issue.
The script works if it is named door.lua.
If I rename the script door_use_open_auto_close.lua it does not work.
Since I cannot have two files with the same name how do I rename the file and have it still work?

Update: I figured it out.
I had to change the following in the script.

From

To


From

To


Now it works with the new name.
Thanks you were a huge help and I truly do appreciate it.
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 20th Jan 2019 15:22
Yup thata lua 101 at the most basic level, you _init and _main have to be named the same as your lua file

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 21st Jan 2019 10:49
Also (as I think you have done) always prefix the lua name of scripts for doors with “door” - this lets the engine AI know it is a door and blocks path for AI NPC s (in theory - haven’t checked this for a while).

Cheers
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 21st Jan 2019 11:09
Also, i have found, using too many underscores in the name can sometimes cause glitches, as lua uses them as identifiers.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.

Login to post a reply

Server time is: 2024-12-22 14:34:01
Your offset time is: 2024-12-22 14:34:01