Target All Lights with Same Name

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
User avatar
Joined: Sat Apr 04, 2015 1:19 am
Location: London, KY

Target All Lights with Same Name

Postby tridecagon » Wed Mar 30, 2016 3:20 pm

I want to be able to control a bunch of lights from one script. I plan on making a custom event that turns the lights on or off based on a switch. The custom event should be able to be executed from two different scripts. The first script should set or unset a switch and then call the subscript. The second time the subscript is called is when the player enters a map. I have most of this working but my biggest--currently only--problem is that I can't select all lights via display name; it wants me to use the scripting ID instead. I decided to try giving them all the same scripting ID, but that didn't do anything.

I want a script that will work in any map I create that turns all the lights with the same display name on or off.

(all of this was a new post, but then it was automagically merged with the first one)
Any ideas and/or thoughts? My current plan is to create one script, whose sole purpose is to turn the desired light/s on and off, for every map. I can then create one more custom event that I can pass a text argument to (current map name) that executes the aforementioned script. This one can be called via timer. The maps themselves I can create a "Player Enters Map" script to execute the appropriate script directly.

I'm probably explaining this poorly but I'll make a better post if and when I finally do this. I'm just going to wait for a response first. Also I'm still fine with giving the lights the same scripting ID.
Last edited by tridecagon on Wed Apr 06, 2016 5:26 pm, edited 1 time in total.
Reason: Automatically merged double post.
I'm not the sharpest fork in the toaster.

Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users