• Lua coding looks kinda hard so far
    11 replies, posted
Hello guys, I am 14 years old and I have some problems converting sandbox sweps to TTT sweps and I want to start creating sweps by myself using models and such from gamebanana. I've converted a few sweps (Kirinolas sweps TTT edition and such). So I wanted to create SWEPs especially for TTT by myself. Now I have some experience knowing the Base codes, and variables and such but IDK how to code functions and such. I've searched tutorials espcially for this on youtube (Lua tutorial making a swep for gmod) but they aren't good enough. I don't understand what they say and I have to copy the functions without realising what they stand for. So, do you guys have some tips how to continue learning these functions? Or give me a good tutorial especially for coding SWEPs especially for TTT from scratch? Thanks anyway guys and have a good day :)
First off, do you want to create a gun or melee SWEP?
[QUOTE=code_gs;48080202]First off, do you want to create a gun or melee SWEP?[/QUOTE] Both :) but I want to start from the easy to the harder. What do you think is easier?
[QUOTE=kapach333;48080270]Both :) but I want to start from the easy to the harder. What do you think is easier?[/QUOTE] Melee Edit: here's a useful page on the gmod wiki for gun coding: [url]http://wiki.garrysmod.com/page/Chair_Throwing_Gun[/url]
I'll provide some example code with comments when I get home. Chair throwing gun is really just an exception since it throws entities
Honestly, I find most people who say they struggle with lua aren't having problems with the language itself but general programming concepts You might wanna start off with some of the basic guides, like these: [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7a06.html[/url] [url]http://www.lua.org/manual/5.3/[/url]
[QUOTE=NiandraLades;48081900]Honestly, I find most people who say they struggle with lua aren't having problems with the language itself but general programming concepts You might wanna start off with some of the basic guides, like these: [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7a06.html[/url] [url]http://www.lua.org/manual/5.3/[/url][/QUOTE] [URL="http://www.lua.org/pil/contents.html"]Programming in Lua[/URL] will be helpful (possibly more than the reference manual) as well. Even though this version is for an older version of Lua, most of it still applies.
It really depends on the person. I, myself, can't learn programming from reading books or listening to someone else - I have to practice, practice and practice. Books/tutorials/ebooks are fine for me if I want to learn something more in a certain field, but to learn the language itself from the very beginning would be like learning how to drive a car by watching Top Gear. You might be such a person and with that being said, I suggest you read peoples code, modify it and then see what happens. Then when you have enough experience and you understand how some parts of the code affect the rest of them, try writting small stuff yourself, such as a script that prints out players names - then keep adding some stuff to it, such as the names being printed in an alphabetical order or names themself being fetched with a function. Then keep expanding it until it's really big (but useless obviously), remove it and then try writting it from scratch - but this time, without the help of other peoples code but with your own experience and knowledge from lua wiki. I've started like most people did, by trying to make a lua wallhack. Then I kept expanding it until I've had crapload of functions (like really, it had over 200 functions) Started with this: [img_thumb]http://images.akamai.steamusercontent.com/ugc/540648543069958351/50DD4D09647BC2AA91AD2618C234AE5F7BF4B284/[/img_thumb] Ended with this: [img_thumb]http://images.akamai.steamusercontent.com/ugc/595833494730764792/03A43FC63538FCE87DFA1F6A8B841141D038A337/[/img_thumb]
I'm not going to go into great detail like everyone else, but when I started any language ( wether that be java or c# ), i'd dive straight in into a module system which had many different buttons that did different things. For example, for lua i made a clientside script that had many different functions like esp or clientside noclip. For c# i used winforms and created a Windows Console where you typed unique commands like "kill explorer.exe" and it'd kill explorer.exe. I believe the way i do it helps you understand the standards of the language and when you create a large project, you use the knowledge you learned from when you first started.
I did really basic coderhire jobs for people since I'm awful at ideas and I was poor and needed money when I was 14. [editline]30th June 2015[/editline] I never did DarkRP "coding", don't do that.
[QUOTE=Netheous;48083801]It really depends on the person. I, myself, can't learn programming from reading books or listening to someone else - I have to practice, practice and practice. Books/tutorials/ebooks are fine for me if I want to learn something more in a certain field, but to learn the language itself from the very beginning would be like learning how to drive a car by watching Top Gear. You might be such a person and with that being said, I suggest you read peoples code, modify it and then see what happens. Then when you have enough experience and you understand how some parts of the code affect the rest of them, try writting small stuff yourself, such as a script that prints out players names - then keep adding some stuff to it, such as the names being printed in an alphabetical order or names themself being fetched with a function. Then keep expanding it until it's really big (but useless obviously), remove it and then try writting it from scratch - but this time, without the help of other peoples code but with your own experience and knowledge from lua wiki. I've started like most people did, by trying to make a lua wallhack. Then I kept expanding it until I've had crapload of functions (like really, it had over 200 functions) Started with this: [img_thumb]http://images.akamai.steamusercontent.com/ugc/540648543069958351/50DD4D09647BC2AA91AD2618C234AE5F7BF4B284/[/img_thumb] Ended with this: [img_thumb]http://images.akamai.steamusercontent.com/ugc/595833494730764792/03A43FC63538FCE87DFA1F6A8B841141D038A337/[/img_thumb][/QUOTE] WOW! Thats amazing! great job! [editline]1st July 2015[/editline] [QUOTE=NiandraLades;48081900]Honestly, I find most people who say they struggle with lua aren't having problems with the language itself but general programming concepts You might wanna start off with some of the basic guides, like these: [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7a06.html[/url] [url]http://www.lua.org/manual/5.3/[/url][/QUOTE] Thats some sort of my problem. But if I check the functions and learn them, right after I go to notepad++ and try to code them but I forget how do you write them and their concepts. Do I only need to learn them again and again and again untill It'll come by easy to me? [editline]1st July 2015[/editline] [QUOTE=code_gs;48081727]I'll provide some example code with comments when I get home. Chair throwing gun is really just an exception since it throws entities[/QUOTE] Thanks man its very different from a gun code and I need to exercise and remember the functions for left mouse button (shooting) and such
Repetition is key. Everyone starts out having to look stuff up constantly ( and most of us still do ), has trouble trying to figure out the approach they want to use ( eg, repeat vs while ), or any other list of things that make you feel dumb when you're just starting out. The best advice I can give: Don't start off over ambitious - making a gamemode sounds cool and like a great idea because you get to learn entities, weapons, client and server stuff, the whole nine yards. It's a shit idea because you get in way over your head and do things in such a way that you spend a lot of time going back and redoing things or just giving up because you painted yourself into a corner. Instead, start off small. An ak47 that shoots babies, a watermelon that jumps when you use it, a banana bomb that lets you throw individual bananas like grenades or the whole bunch like a cluster bomb, and similar things are pretty simple - a straight forward weapon, a simple entity, or a weapon that makes use of entities, but they offer a lot of room for creativity and being returned to and improved upon. Don't get discouraged if it seems really hard - most of the trouble you are going to have will be learning the language itself, and learning how to manage the server / client states and communicate between them. There's a lot of resources available for the language itself - googling "lua tutorial" will get you a good amount of resources at various levels. Set reachable goals. This goes in hand with the first point - set yourself a goal, something to work towards, but it should be a reasonable goal that doesn't include writing thousands of lines of code or coming up with a new gameplay format. Just make each goal higher as you go, and generally aim towards doing something you haven't done before. Practice. Look at your older code and fix things that don't work very well, or completely rewrite it if you know a better solution. Maintained code can be reused for other projects, but if it is a mess you end up avoiding it. Don't sweat the community. While it isn't as bad as it is made out to be, we can be somewhat... caustic towards new people who aren't already at the same skill or knowledge level, but for the most part are willing to help out with problems, especially if you can show that you've been trying and aren't just asking for a handout or "the codes." Some server communities can be hostile towards other servers when they feel threatened in some way, but if you stay away from TTT and RP you typically get a free pass on that drama. Not that there's anything particularly wrong with those things in general if it is your interest, they just seem to attract more of it since they are the "main" gamemodes outside sandbox. Most of all, have fun! If you decide it is too hard, too much of a chore, or that you'd rather just mess around in sandbox, don't feel obligated to keep trying or make yourself do it. You might end up trying it again later - days, weeks, maybe even years. You're still young and have plenty of time to decide on what hobbies and interests you want.
Sorry, you need to Log In to post a reply to this thread.