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
[QUOTE=Silverlan]
Of course it doesn't work, keyvalues have absolutely nothing to do with networked variables.
To use them as networked variables you can do something like this:
[LUA]
function ENT:KeyValue(key, value)
if key == "keypad_secure" then
self:SetNetworkedBool(key, tobool(value))
end
end
[/LUA]
Entity.KeyValue is called whenever a keyvalue is set for to the SENT.
The function above would set the networked bool "keypad_secure" to whatever you've set the keyvalue with the same name to in hammer. As for the other networked variables, I don't see them being set in the "SetupKeypad" function of that stool code, so I don't see why you want to set those for your SENT, some of them seem to be client-side or part of the stool code anyway.
- Silverlan[/QUOTE]
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
[highlight](User was banned for this post ("Rule #15" - Terrenteller))[/highlight]
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.
[QUOTE=Anti-Flag;16088496]rong section[/QUOTE]
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
[code]for _,ent in ipairs(ents.FindByName('keypad1'))[/code]
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.
[QUOTE=Skeven;16088462]function ENT:KeyValue(key, value)
if key == "keypad_secure" then
self:SetNetworkedBool(key, tobool(value))
end
end[/QUOTE]
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:
[code]
self:SetNetworkedBool(key, tobool(value))
[/code]
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().
Sorry, you need to Log In to post a reply to this thread.