Specifying parameters for LUA entities in Hammer

I’ve asked a couple of people and commented in a couple of threads trying to figure this out but so far I’ve gotten nothing to help me advance.

Here’s my problem… I’m making a map and I want to use the LUA keypad to lock some of the doors in the map. I’ve gotten the Keypad to show up in Hammer, but I have yet to be able to set the password for the keypad and to put the keypad into secure mode. I’ve tried specifying both by setting values for the keypad in the properties box in Hammer.

For “keypad_secure” I set a value of 1. For setting the password I didn’t know which to use, so I set a number (4 digits, no zeros) for keypad_adv_password and adv_password. When I complied and ran the map the keypad was not in secure mode and did not have any password set.

I PMed Silverlan asking for help and this is what I got from it

I somewhat understand what he’s saying, but that means writing a modified code for the keypad, which leaves the code itself less secure because the password would be stored as a networked variable. However I don’t know any LUA, and I’m a Hammer newbie, working on my first map for Gmod. Someone suggested using the lua_run entity, but like I said, I don’t know the first thing about LUA or coding in general :[

Any help is appreciated.

rong section


(User was banned for this post ("Rule #15" - Terrenteller))

Go make a request to the creator to make a newer version that has keyvalues.

Or, pm Robbis_1 (the creator).

He can hardly be bothered to add other basic features, but I sent him a PM anyways.

Your splitting hairs here. This can be considered both a mapping and LUA question since lua_run is a Hammer entity, and I’m specifying properties for an entity in Hammer. Then there’s the LUA aspect of it. But seriously, stop trolling and actually contribute. I don’t need you telling me I put this in the wrong section when it’s at least somewhat relevant.

press the smartedit button and then select a keyvalue.
then you want to press the button that says
“add”
and write keypad_secure
1

I’ve tried this method before. Didn’t work. Thanks though.

Look at the tutorial on garrysmod.com for adding gmod chairs to a map.
I think the lua_run part would be pretty similar. Just name the keypad, and change what the lua_run changes.

Yea, that looks like what I need. It’s late now so I’ll try it out when I get time tomorrow and report back. Thanks.

Alright… sorry I was banned for a bit, anyways… I pulled up my map in hammer and got to as far as putting a bit in code into the LUA_run entity… the problem is I don’t understand code… so I kinda filled in the blanks


for _,ent in ipairs(ents.FindByName('keypad1'))

Which isn’t going to do anything… I’m not sure what to do next :[

Any help is very much appreciated, as I can map but I can’t code for my life.

Sorry for this, but I haven’t gotten a response and I don’t want to post a new topic about the same exact thing… so… bump.

So you want to be able to place them and set the password via a keyvalue? You’re probably better asking Robbis_1 to edit it for you if you don’t know any Lua. Also:



        self:SetNetworkedBool(key, tobool(value))  


What do you want the keypad_secure keyvalue to do?

The keypad_secure keyvalue is a value that determines if the keypad is in “secure” mode or not. When secure, instead of showing the numerical password as someone is typing it shows an ‘*’ instead.

So if the password was ‘1234’ and you went to type it in, it’d show on the screen for you and everyone else ‘****’

Edit: I don’t think Robbis would do anything for me, since he barely updates it himself anyways.

Same problem. I know Lua and Hammer good, but keyvalues I set in Hammer do not appear in Gmod for me too. I tried lua_run PrintTable(Entity(my ent id):GetKeyValues()), I haven’t seen my KV pairs.

tobool(1) does not work, it gives nil, input must be “true” or “false” (string). Use tonumber().