• I've completed the main Lua tutorial on the basics, where now? :s
    82 replies, posted
I've went through the main part of the tutorial, however when I go to the extra tutorials there, I feel like I've been thrown in at the deep end. So can someone provide me with some help or links to tutorials which will create a bridge from where I am now to the level of experience required for the extra tutorials? Thanks, Ninel
I suggest you read this through [url]http://www.facepunch.com/threads/1082042-I-ve-learned-basic-Lua.-Where-do-I-go-from-here[/url]
[QUOTE=nexusowner;29405600]I suggest you read this through [url]http://www.facepunch.com/threads/1082042-I-ve-learned-basic-Lua.-Where-do-I-go-from-here[/url][/QUOTE] Thank you for the link, however I already read it before I posted this thread with the hope that it would answer my question :s.
That thread should show you what to do since it has a lot of different opions in it. The best advice I feel I can give is that everyone learns differently Iv been learning by setting a task and trying to do it by looking at other code and trial and error. Tutorials may get you started off but you cant rely on them, you have to think of your own way of doing things
Thanks for your reply, however with barely any programming experience, I am unable think of my own ways to do things :s, sorry.
I suggest that you have a look through other people's work, try to get a feel for their logic. Look up function on the wiki. Start with simple SWEPs and SENTs, edit them to your liking if you want. Once you're ready, start making your own scripts. Three things... 1. Get Notepad++ with the GMod lua plugin or some other syntax highlighter. This is practically essential if you want to understand scripts and read through them quickly. You can find the links to what you need here. [url]http://www.facepunch.com/threads/868561-Need-help-READ-THIS-FIRST[/url]! 2. Reread stuff you've learned once, try it again to make sure you've understood it well. And always refer back to the wiki or the forums if you have questions. 3. Indent properly. Some people don't do this and it makes it confusing to read through their code. It'll help you pick apart your own code for errors too. Good luck!
Create some lua files in your lua folder in the garrrysmod/garrysmod directory. Fill them with some test code and explore! Use lua_openscript(_cl)
[QUOTE=Blargh123;29409408]I suggest that you have a look through other people's work, try to get a feel for their logic. Look up function on the wiki. Start with simple SWEPs and SENTs, edit them to your liking if you want. Once you're ready, start making your own scripts. [/QUOTE] Thank you for your reply and support. By editing things and making simple things will I become good at lua and know lots or just understand more what I know already? Also, has anyone got suggestions for specific scripts for me to edit and learn from? Thanks, Ninel
Find ones that are clean looking scripts, so you gain nice looking habits.
[QUOTE=Hyperion;29409661]Find ones that are clean looking scripts, so you gain nice looking habits.[/QUOTE] By 'clean looking' do you mean properly formatted with correct indentation etc?
Yea, and camelCasing preferably :) camelCasing looks nice to the eye for some reason.
I've heard of others starting with the basic bouncy ball which comes with Garry's Mod, I will try this first. Also, thank you for the help and support so far guys. [editline]25th April 2011[/editline] Actually, I'm finding it hard to get the sent_ball file, can someone show me where to find it or will I need to extract it from the .gcf?
[QUOTE=Ninel;29410347]I've heard of others starting with the basic bouncy ball which comes with Garry's Mod, I will try this first. Also, thank you for the help and support so far guys. Actually, I'm finding it hard to get the sent_ball file, can someone show me where to find it or will I need to extract it from the .gcf?[/QUOTE] I find the best thing to do is download garrysmod beta as it has everything in without having to extract from a .gcf but I suppose it depends on you internet and if you can be bothered to do that. I found creating small entities helped me out such as a sent that changes your spawn or a missile that follows a trajectory. As I said before think of ways YOU could do things and logically think about how you would do them. If you dont know how to do them in lua, find something that may do a similar thing, download it and look at the code
Go add something completely useless to darkrp like another weapon used to mass rdm.
[QUOTE=zzaacckk;29419236]Go add something completely useless to darkrp like another weapon used to mass rdm.[/QUOTE] Thanks for your reply, though are you serious?
[QUOTE=Ninel;29420235]Thanks for your reply, though are you serious?[/QUOTE] Go learn to make binary modules.
[QUOTE=zzaacckk;29422296]Go learn to make binary modules.[/QUOTE] I've found this: [url]http://lua-users.org/wiki/BinaryModuleTutorial[/url] . Is that tutorial good in teaching binary modules or do you have any others which you would suggest? [editline]25th April 2011[/editline] Infact, I've read through that and barely understand it :S.
[url]http://wiki.garrysmod.com/?title=GLuaModule[/url]
[QUOTE=zzaacckk;29423470][url]http://wiki.garrysmod.com/?title=GLuaModule[/url][/QUOTE] I'm sorry, but I don't understand what exactly it is that binary modules are used for. Also, I don't know C++ or any other programming language.
Learn how to use particles and derma controls.
You have now learned the first valuable lesson of learning lua: Don't listen to Zack because he is an idiot that knows nothing.
[QUOTE=zzaacckk;29422296]Go learn to make binary modules.[/QUOTE] :frog:
[QUOTE=King Flawless;29423906]You have now learned the first valuable lesson of learning lua: Don't listen to Zack because he is an idiot that knows nothing.[/QUOTE] Thanks for your reply, do you have any suggestions other than those posted so far as to what I should do next or where I should learn the next step from?
I suggest you start downloading other peoples scripts that interest you and look at how they work once you have a full understanding of how they work try and edit and improve them
Ok, I'm going to try and make an entity which gives the player pistol ammo if they use it, I'll edit the bouncy ball entity, however I don't know what the hook is for getting ammo or the ammo entity is.
I would start with downloading simple scripts and looking through them and try to understand what they did. Once that is done try remaking something similar without looking at it. Money System : [url]http://www.garrysmod.org/downloads/?a=view&id=98988[/url] 3d2d Text : [url]http://www.garrysmod.org/downloads/?a=view&id=112660[/url] Perma Props : [url]http://www.garrysmod.org/downloads/?a=view&id=102387[/url] Admin Menu : [url]http://www.garrysmod.org/downloads/?a=view&id=2221[/url] Those are some pretty simple things, PM me if you need any help.
[QUOTE=zzaacckk;29426410]I would start with downloading simple scripts and looking through them and try to understand what they did. Once that is done try remaking something similar without looking at it. Money System : [url]http://www.garrysmod.org/downloads/?a=view&id=98988[/url] 3d2d Text : [url]http://www.garrysmod.org/downloads/?a=view&id=112660[/url] Perma Props : [url]http://www.garrysmod.org/downloads/?a=view&id=102387[/url] Admin Menu : [url]http://www.garrysmod.org/downloads/?a=view&id=2221[/url] Those are some pretty simple things, PM me if you need any help.[/QUOTE] You just... rewrote King's sentence and put some links in? [QUOTE=Ninel;29426353]Ok, I'm going to try and make an entity which gives the player pistol ammo if they use it, I'll edit the bouncy ball entity, however I don't know what the hook is for getting ammo or the ammo entity is.[/QUOTE] You'll find the entity in [b]lua/entities/sent_ball[/b] and you should look inside the [b]init.lua[/b] which you should find a function called [b]ENT:Use[/b] [b][url=wiki.garrysmod.com/?title=ENT.Use]ENT.Use [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [b][url=http://wiki.garrysmod.com/?title=Player.GiveAmmo]Player.GiveAmmo [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] Post back if you happen to get errors or get stuck!
Thanks Buggzie, that really helped, I managed to get it to work. Now my next step is to change the bouncy ball to a different model, which part is it that I should edit? Also, for PhysicsInitSphere are there other shapes or is there just a sphere?
You also have [b][url=http://wiki.garrysmod.com/?title=Entity.PhysicsInitBox]Entity.PhysicsInitBox [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
You might want to use [url=http://wiki.garrysmod.com/?title=Ricky's_Example_SENT]Ricky's Example SENT[/url]. The ball has some stuff with sprites and effects, the Example SENT uses an actual model.
Sorry, you need to Log In to post a reply to this thread.