Scripts / script troubleshooting

Author
Message
Lafette II
12
Years of Service
User Offline
Joined: 15th Oct 2012
Location:
Posted: 3rd Sep 2019 09:07
Hi..
I now have a problem with a few scripts from my mystic pack. In my opinion, these still worked when I published the pack. But nothing works, or it may never have been right. I have no idea how I can solve the problem. I know what I want, but I can not do it.
I have a trap there, which becomes active when I approach. I also have a switch that should disable the trap and also reactivate it. But he does not.

Here is the script for the trap


..and here for the switch.



I know it's very unstructured, but I can not do it better

Any constructive help is welcome

Andreas
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Sep 2019 09:56
Looks like they should be fine code wise but there's nothing to link the 2 scripts, you aren't talking to the trap script via the switch's script so it won't enable/disable the trap.
You need to pass in the trap's entity number to the switch so it can be used to toggle it.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Lafette II
12
Years of Service
User Offline
Joined: 15th Oct 2012
Location:
Posted: 3rd Sep 2019 15:19
@ smallg ..Thank you for your prompt reply.
Yes, the scripts work for themselves.
Quote: "but there's nothing to link the 2 scripts, you aren't talking to the trap script via the switch's script so it won't enable/disable the trap.
You need to pass in the trap's entity number to the switch so it can be used to toggle it."

That's the problem, I can not link them together. I do not have the technical horizon. I have tried it with variable, but it did not work out. The more I got into it, the worse it got.
I think it has to be done with ActivateIfUsed (e). But how???
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Sep 2019 16:12
this should help, might need to tweak it to suit depending on how your models are set up but looks decent enough with doors
(links by matching name first and if no match found then it will look for the closest trap)
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Lafette II
12
Years of Service
User Offline
Joined: 15th Oct 2012
Location:
Posted: 3rd Sep 2019 16:59
I am very grateful to them in advance. I'll test it right away when I'm back home.
PM
Lafette II
12
Years of Service
User Offline
Joined: 15th Oct 2012
Location:
Posted: 3rd Sep 2019 21:05
It works the way it should.
Thank you for the quick help
PM

Login to post a reply

Server time is: 2024-12-22 08:45:27
Your offset time is: 2024-12-22 08:45:27