• Buttons on map, give them settings and save them so they stay after restart
    1 replies, posted
I have a lot of questions and I've tried to get an answer out by trying but well, not really sure. There is a map called gm_site19 from SCP:CB or remade just that, incase you need it. https://i.imgur.com/9sHSXzj.png That thing I drawed around with red is a button created by the map. I've tried to change the model with lua_run but basically it crashed my gmod. Is it possible to change the models of map created entities? Are there any exceptions etc.? Then, that what I want to do https://i.imgur.com/phF3TJT.png As you see that is another map created entity button. I want to make a command something like /setbuttonlevel 3 Then if I have an level 3 keycard I can open that door, but atm I don't worry about checking if it has that item, I just worry about how to do that command and make it work later. Then everytime I go to a door and do /setbuttonleel 1 - 5 it should save the button settings, so that when I restart the server, I don't have to go to every button again. Like save it permanently unless I do /setbuttonlevel 0 or /removebuttonleel something like that and I got literally no clue how to save anything permanently nor temporary nor I know how to connect lua with mysql to get data from there and apply it on a script to use it later. I've tried to... get the parent of the button and door or anything well, but parent isn't really that what I search, I tried to find the linking like, how does the button know that it has to open the door, maybe somewhere in hammer editor, but how to do it with lua? Maybe that last sentence is something you won't understand because I can't write it well. That is a tesla gate https://files.facepunch.com/forum/upload/108594/a90f0e43-46e1-4f33-b823-8a2127c60af3/image.png There is a lever that activates this and 2 other tesla gates. I thought about a command that works with FindInSphere but I don't know, when the lever activates all 3 gates and I walk to one I want to run /disableteslagate if I'm a specific class and then it might plays a sound, but it disables the tesla gate. And I guess it will enable again if I run /enableteslagate and maybe also that checks if it is already disabled or not, or it enables again when the lever gets switched back to on. What do I need, do I need to go in hammer and search the teslagate trigger or what do I exactly have to do? Cause I'm not good using lua with map entities but I would like to get better at it and in lua in general, I hope you can help me.
I've tried to test around with lua_run The electrical thing you see on the picture is a func_brush entity index ID 1875 https://files.facepunch.com/forum/upload/108594/9628ad94-bc4e-4344-9c45-4953ba7a1fde/image.png I run this lua_run local target = ents.GetByIndex(1875) target:Fire("Enable") However there is a trigger... ofc, that triggers the func_brush but I can't figure out how I can disable the trigger with lua.
Sorry, you need to Log In to post a reply to this thread.