Scripts / Door.LUA is it broken ???

Author
Message
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 17:08
Hi Guys

I am having a problem with door.lua, it turns collision state off to allow you to pass through but never turns it back on again.

in the video below I modified the door.lua to show collision state on screen as you can see it turns it off but not back on again, do any of you scripting guru's
know how I can force collision back on after the door is closed?

thank you for any help you can give

Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 17:50
CollisionOn(e). you can also check for the last frame if g_Entity[e]['frame'] == GetEntityAnimationFinish(e,0) ......

so,

if g_Entity[e]['frame'] == GetEntityAnimationFinish(e,0)

..
..
CollisionOn(e)

Depends on the scenario when you want to turn collision back on.

Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 18:02
Hi BOTR
thank you but I think I am doing something wrong it still does not work this is what I have added to the stock door.lua



I'm not a coder lol
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 7th Sep 2017 19:19
Hi GraPhiX
Looking at the code above it would seem that
SetActivated(e,1) is not setting the g_Entity[e]['activated'] straight away so it is still 2 at the bottom test so CollisionOff(e) is called again.

Looking in Global.lua I see Lee has a second call to do this directly...(i think)
SetEntityActivated: SetEntityActivated ( e, activated flag ) -- Sets the entity data directly, e is entity index

thats what I think looking at the code...

Try changing SetActivated(e,1) to SetEntityActivated ( e, 1) ..

good luck..

PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 20:19
Hi J_C

thank you for your suggestion I just tried it and the result is still the same, I am beginning to think its the model somehow
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 20:23 Edited at: 7th Sep 2017 20:26
@GraPhix-I'll take a look at the script now as I'm looking into another LUA issue at the moment. Oh what is the model? I don't know if I have that one. Maybe add some more debug info to see what's going on.
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Sep 2017 20:31 Edited at: 7th Sep 2017 20:38
There is a bug in GG related to CollisionOff/CollisionOn combo, it reverts the collision box to 'simple' mode even when the original collision mode was 'complex', if you get my drift.

Not sure if this is the case for all entities or only those with specific collision modes in the first place.

It drove me crazy for a bit but now when it happens I simply turn off collision on everything and handle collisions myself.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 20:31 Edited at: 7th Sep 2017 20:34
thank you :0

the ironic thing is I have created this fence and gate to replace the faulty fence in GG, I was going to post it in free models and email it to Lee its with reference to this post https://forum.game-guru.com/thread/218549

I have attached it for you and the door.lua I modified
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD

Attachments

Login to view attachments
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:02
@GraPhix-thanks, I will see what I can do.....it usually something simple....
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:05
@GraPhix-thanks, I will see what I can do.....it usually something simple.... oh by the way....it might be a collisionmode issue as AmenMoses mentions above ummmmmmm...
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:10
ah yes, change the collisionmode in the FPE from 1 to 0. I havent tested your fence in GG yet but will do. For the welder tools I did I use collisionmode 0 for doors. So when collision is set back on for the entity it creates a box around the door.
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:21
ok so it's not the collisionmode either as I tried changing it from 1 to 0. No change. So must be script. I'm going to test out on my own door script that I converted from FPSC to LUA with my new tool (plug ha ). Anyway, shall get back to you as soon as.
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 21:27
Quote: "ah yes, change the collisionmode in the FPE from 1 to 0"


yep that fixed it thank you so much I have spent a full day on this, thank you Amenmoses too
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:31
weird, when I changed the collisionmode to 0 and tried out the script, I was still walking through the fence. Will keep playing around with this for a bit, maybe I missed something.
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 21:34
the fence was not a problem, it was the gate, the collision mode needs to be 1 for the fence
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:40 Edited at: 7th Sep 2017 21:40
yes this is correct. works fine now with collisionmode 1 for the fence and 0 for the gate. I used the original door.lua instead of the modified one. If you do use the GetEntityAnimationFinish( e,<anim slot> ), make sure you choose the correct animation slot number 0,1 ... etc. I noticed in the gate FPE there are 2 animation slots 0 and 1. So if I wanted to check the last frame for a given anim slot, say slot 1 the command should return 180:

animmax = 2
anim0 = 0,90
anim1 = 91,180<-----------last frame returned when calling GetEntityAnimationFinish(e,1)
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Sep 2017 21:53
Quote: "make sure you choose the correct animation slot number "


that's where I went wrong lol thank you so much for this I will post the model in the morning and send it to Lee
Welcome to the real world!
Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 7th Sep 2017 21:57
As I said in another post, this is a known bug with the door script, it's already been fixed and someone posted the fixed script on here, just can't remember where it is at the moment. I could have sworn I remember Lee saying he would edit the original and update it about three updates ago, looks like he didn't get around to it.

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.
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Sep 2017 21:59 Edited at: 8th Sep 2017 06:29
I noticed when I used the converted FPSC original door.lua script that "g_Entity[e]['plrvisible']==1" never equals 1. ummmm all weird....
other than that the door opens and close and plays sounds and collision works if I uncomment the plrvisibile bit out.

Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 7th Sep 2017 22:11
I've just checked my door.lua and it seems to be working fine, so I think I have the fixed version, I've attached it here, see if it works for you.

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.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-12-23 00:55:22
Your offset time is: 2024-12-23 00:55:22