Scripts / Using trigger zone to un-hide object.

Author
Message
42pixels
3
Years of Service
User Offline
Joined: 5th Nov 2021
Location: Hobart, Tasmania, Australia
Posted: 8th Dec 2021 01:34
Firstly let me just say I am 100% brand spanken new to lua, wrapping my head around this is important to me so the more information I can get the better for me

I have a bolt of lightning and a trigger zone. I have added this script to the lightning to hide it.


And I have this for the trigger zone



Now, the lightening seems to hide just fine (YAY!) but the trigger zone isn't showing the lightning at all (boo!)

So what am I missing? From what I can tell I am using the lightnintrigger to call the lightninbolt entity, but as it is not working I have obviously missed something.

Thanks in advance!
11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz, 32.0 GB, NVIDIA GeForce RTX 3060 Laptop GPU 6GB, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3777
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Dec 2021 09:45 Edited at: 8th Dec 2021 11:20
if this is only for 1 lightning bolt you can store the 'e' (the entity number) in the script on the object (as you already have one)
so


now the zone can use that (as it's not a local variable) to interact with the lightning like so

p.s. i have no idea what PerformLogicConnections(e) is and i assume that is your own function? if you need it just remove the -- before it again

note i added some extra logic because you would likely just want to wait a short duration and then hide/destroy the lightning bolt again.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2021 10:12 Edited at: 8th Dec 2021 10:16
This is how I would do it:

Script on lightning entity (entity should be set always active as it will likely be some way from the player)


Script on zone:


(Note, not tested as I'm not on my PC )
Been there, done that, got all the T-Shirts!
PM
42pixels
3
Years of Service
User Offline
Joined: 5th Nov 2021
Location: Hobart, Tasmania, Australia
Posted: 8th Dec 2021 10:19 Edited at: 8th Dec 2021 10:22
Thank you so much both for taking the time to look at this with me and for adding all of that extra logic, it is amazing! I would be happy just to get it to appear, haha. I have tried both the new script in the lua files, but I must be doing something wrong still. I walk through the trigger zone and there is still no lightning. I'll attach a screenshot of my scene, so you can see the lay-out.

What the heck am I doing wrong?
11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz, 32.0 GB, NVIDIA GeForce RTX 3060 Laptop GPU 6GB, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3777
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2021 10:28
Put Prompt() calls in the scripts to see where the logic is getting too.

For example add Prompt("Got Here") or something in the _main function then you should see that on screen which tells you it is actually running the script. Then just move the prompt to other parts of the script to see if they get triggered.
Been there, done that, got all the T-Shirts!
PM
42pixels
3
Years of Service
User Offline
Joined: 5th Nov 2021
Location: Hobart, Tasmania, Australia
Posted: 8th Dec 2021 10:59
Something isn't right, I can't even get prompt to send back anything. It is like my trigger zone isn't even registering.
11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz, 32.0 GB, NVIDIA GeForce RTX 3060 Laptop GPU 6GB, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3777
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2021 11:14 Edited at: 8th Dec 2021 11:14
Check the name of the scripts matches the function names and all are lower case.

i.e. lightningtrigger.lua
Been there, done that, got all the T-Shirts!
PM
42pixels
3
Years of Service
User Offline
Joined: 5th Nov 2021
Location: Hobart, Tasmania, Australia
Posted: 8th Dec 2021 11:56
Thank you, AmenMoses for your help! smallg and I figured out we had missed a curtail piece of code. Both yours and his work like a dream now. You are both amazing and thank you again!
11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz, 32.0 GB, NVIDIA GeForce RTX 3060 Laptop GPU 6GB, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3777
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 8th Dec 2021 14:36
Just out of interest what was missing?
Been there, done that, got all the T-Shirts!
PM
Pink Panther
14
Years of Service
User Offline
Joined: 1st Feb 2010
Location:
Posted: 8th Dec 2021 16:11
Thanks smallg and AmenMoses for your great scripts!
PM
42pixels
3
Years of Service
User Offline
Joined: 5th Nov 2021
Location: Hobart, Tasmania, Australia
Posted: 9th Dec 2021 04:33
We all missed the function if g_Entity[e]['plrinzone']==1 then so it wasn’t calling the script , that’s why I couldn’t get any response even from Prompt()
11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2.30 GHz, 32.0 GB, NVIDIA GeForce RTX 3060 Laptop GPU 6GB, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3777
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Dec 2021 09:49
Ahh, I keep forgetting Lee's 0 & 1 for false and true! Just needed == 1 adding to my script.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-22 01:31:09
Your offset time is: 2024-12-22 01:31:09