Very basic coding implementation

Grab your favourite IDE and tinker with the innards of game engines

Very basic coding implementation

Postby ambitious_wallnut on Wed Apr 25, 2012 10:53 am

Hey guys, I am pretty new to modding. I am alright at basic mapping and have always dreamed of making my own source mod. I am not having any trouble with mapping but what I came to ask was about coding. I want to make my own scripts like: if I knife an enemy I will gain a some sort of buff? How is such coding implemented into a map? Is it a custom entity?
Sorry for being such a n00b :cry:
A-W
ambitious_wallnut
Dumpling
Dumpling
 
Joined: Sun Dec 18, 2011 9:47 am

Re: Very basic coding implementation

Postby ambitious_wallnut on Wed Apr 25, 2012 10:54 am

Oh and once I know how to actually add code can someone please point me in the direction to a tut for lua (I think thats the language)
ambitious_wallnut
Dumpling
Dumpling
 
Joined: Sun Dec 18, 2011 9:47 am

Re: Very basic coding implementation

Postby iain555 on Wed Apr 25, 2012 11:15 am

The map is a very specific part of the game and doesn't do much other than contain things already defined in the game's code.

To make a stand-alone mod with this, you would have to learn c++ and modify the source files provided by valve via source sdk.

lua is only available in gmod (It can be implemented into stand-alone mods, but doing so isn't really beginner level coding)
lua is a scripting language: nothing is hard-coded or compiled. Things written in lua aren't a core part of the game (maps and textures are the same: you can run a mod with or without certain files whereas code written in c++ is compiled into a .dll file which is needed for the game to work).


Put simply, for what you are trying to do, it would probably be easier to make a gmod game-mode with lua than to have to learn c++, code the knife, code the game-mode, code the buff state on the player. It might be worth downloading some gmod knife addons, power-up addons, and game-mode addons and looking at the lua for them to see how they work.
Once you get the hang of how object-orientated programming works, it will just be a case of looking up the syntax for lua.

Here's the gmod wiki entry on lua:
http://maurits.tv/data/garrysmod/wiki/w ... ?title=Lua



If you really want a stand-alone mod, google some c++ tutorials and dive into the "my first mod" article on here when you feel accomplished enough:
https://developer.valvesoftware.com/wik ... rogramming
User avatar
iain555
Regular
Regular
 
Joined: Tue May 05, 2009 3:59 pm
Location: Britain

Re: Very basic coding implementation

Postby ambitious_wallnut on Wed Apr 25, 2012 11:34 am

thanks man, appreciate the quick reply!
and yes stand-alone is where my head is set.
thanks again!
ambitious_wallnut
Dumpling
Dumpling
 
Joined: Sun Dec 18, 2011 9:47 am

Re: Very basic coding implementation

Postby iain555 on Wed Apr 25, 2012 4:08 pm

No problem! Good luck and have fun!
User avatar
iain555
Regular
Regular
 
Joined: Tue May 05, 2009 3:59 pm
Location: Britain

Return to Programming

Who is online

Users browsing this forum: No registered users