Hi I'm trying to get an entity in my map that I created with hammer to be sent an input. I need to do this via LUA as it's part of a quest system I am going to be using on my gamemode so the player needs to have a certain value of a quest to be true before this input should occur. Looking across the gmod lua wiki It seemed the best way of forcing an input was the Entity:Input value so I tried a few things but got nowhere. Here is my code:
[CODE] function ZombieSpawn( ply, make_mod_zombie )
make_mod_zombie:Input( Onuser1, trigger1, Player, Enable) [/CODE]
So make_mod_zombie being the name of the entity having the input sent to it?
And Onuser1 being the output name?
trigger1 being the entity directly responsible
The Player being the one indirectly responsible
And Enable being what the input should cause?
bump?
I suggest you post in the mapping section if you haven't already.
Forget the map it's fine. It's the LUA that's the problem. Wiki doesn't really explain how it relates to the hammer I/O system or whatever it's called.
I decided to put it under GM:PlayerAuthed now since calling a new function for it does absolutely nothing.
[CODE]
function GM:PlayerAuthed( ply, make_mod_zombie )
make_mod_zombie:Input( Onuser1, trigger1, Player, Enable)
end
[/CODE]
Now i'm getting the error:
[CODE] bad key to string index (number expected, got string)
[/CODE]
Can anyone tell me why it's expecting a number? Maybe this isn't a very good command to use anyway but i've tried alternatives such as entity.fire but it looks too complicated to use without a guide.
Well I've given up with this command and I managed to find how to set the arguments for ent.fire so I'm using this code now
[CODE] for k,v in pairs(ents.FindByName("make_mod_zombie")) do
v:Fire("enable","0",0)
end
[/CODE]
Thanks for all the amazing help anyway guys :rolleyes:
If someone didn't reply you maybe you asked it wrong or people really can't help you
-snip nevermind-
Also, remember to mark the thread as solved if you have solved the problem ^w^
Sorry, you need to Log In to post a reply to this thread.