-
Posts
295 -
Joined
-
Last visited
Content Type
Profiles
News Articles
Tutorials
Forums
Downloads
Everything posted by Astral Serpent
-
Introduction Welcome to my tutorial on creating a Lua plugin for JA++. Let's start with the requirements, whether they be software or actual knowledge: JA++ Your favourite text editor Basic Lua and coding knowledge Installation instructions for each of these can be found on the respective sites, LUA does not need to be installed as it is interpreted by JA++ itself. Additional Information: JA++ Plugin Developer Resources Getting Started First, you'll want to navigate to your GameData\japlus\cl\lua and create a folder for your plugin, I suggest naming it something related to planes, because planes are neat, mine will be named AstralPlane. Next, we want to go inside our plugin folder and create a file named plugin.lua. Alternatively, you can just open up notepad++ and save the file we will be working on as plugin.lua, so long as it's plugin.lua and it ends up there somehow with the needed things inside. Let's jump in, first we need to declare the plugin so JA++ knows what it is. RegisterPlugin( string name, string version ) We must assign a local object to this and fill it with the correct info, here's an example: local AstralPlane = RegisterPlugin( AstralPlane, 1337 ) After that, start up JA++ (I suggest also doing jappvideomode 1 while at the menu, so that you can alt tab, or you can just use windowed mode) Join a japlus server, I generally test on jawa.jk3.in since it's usually full of people to talk to. Lua plugins are loaded in client game, meaning once you join a server your Lua plugin will load. This means that you can not use or test a Lua plugin in the menu. Once in-game, you should see information on plugins you have, a completely fresh install of JA++ won't have any plugins, but your new plugin should display along with the name and version you set. Fun note: You can use ^1-7 on the name and version too for colourful plugin names. Seems obvious, but whatever. Now that we have our plugin initialized and ready to modify... Let's get creating! Creating A Console Command Let's create a console command that uses an anonymous function to print something. (anonymous means the function is defined here and can't be used elsewhere) AddConsoleCommand( string cmd, function listener ) the first argument is what the player must type in the console, the second is the function to be executed, in our case we shall be using an anonymous function (a function defined here and now, not somewhere else in the .lua file) AddConsoleCommand( foo, function() print(bar) end) Two things to note: AddConsoleCommand() in this case does not finish until end), which closes both our anonymous function and the AddConsoleCommand call. the function has no name, meaning it can't be called anywhere else, you may want to try named functions for something you'll want to call in different circumstances. And there you have it, the basics of a Lua plugin. Some extra info that'll help you: You can run the game in windowed mode (r_fullscreen 0, and then vid_restart). type jplua_reload after saving any Lua plugin changes to see the effects immediately.
-
- 6 comments
-
- Non Star Wars Related
- JKHub Exclusive
-
(and 1 more)
Tagged with:
-
- 3 comments
-
- Non Star Wars Related
- JKHub Exclusive
-
(and 1 more)
Tagged with:
-
Holy shit.
-
What's the point of adding 'On a serious note' when your whole post is a joke?
-
So the errors are 'npc space error' and then 'some thing'. Hey! I remember those errors! I get that when I sometimes and then I and it fixes it.
-
4 fits with the colours of the site, imo.
-
I really don't see how those are abusive. Things like amslap maybe, where there's not really any use other than lulz. Anything can be 'ab'used, it's up to the admins with privileges of those commands to not abuse them...
-
Recognizing Contributors To The Jedi Knight Series
Astral Serpent replied to Link's topic in Jedi Knight General Discussions
Aliases: Slider Area of skills: Coding Brief list of accomplishments: Created JA+, which has become one of the most widely used JKA mods ever. Made it closed source, compelling Raz0r to make the much better open source JA++. Examples of contributions: Made JA+ and raised hands like man power Comments: If Slider wasn't around, chances are there would not have been a JA++, or a JA+ for that matter. -
... I don't know how that skipped my mind.
-
I've only been playing for 3-5 years on and off. A friend said I might like the game, so I tried it out. First I played on a japlus server, I think it was a clan server called 'JA Phoenix' or something. On there, I met a fellow Australian and added him on xfire, he took me to a clan's lugormod server, !!BOSS!!. I played there for a while, and I even wanted to join the clan at one point... but alas, sabers are not my thing, especially not at 400 ping. After a while I lost interest. And then I regained interest and started playing makermod and got into modding the game, at which point I met an Australian coder on the JKFiles forums, who directed me to the jacoders community and IRC channel. I don't think anyone liked me there, but I stuck around and learned absolutely nothing. 2 years later and I still can't code. Now I just sit around in the #JACoders IRC channel, come up with cool ideas for projects, fork OpenJK, rename the project, and then go and play counter-strike and forget about it. I understand pointers now, so I guess I did learn something!
-
I have no PHP knowledge, no IP. Board knowledge, No MySQL knowledge and a 30kb/s upload speed. When do I start?
-
The title isn't really saying it all...?
-
Petition to make #OpenJK separate from #JACoders
Astral Serpent replied to eezstreet's topic in OpenJK
/sign -
http://www.youtube.com/watch?v=8FHGmbCrpZQ
-
Hopefully we'll see some people contributing and more JA++ users. R.I.P: Wallhax, aimbot and packet pause developer hax
-
KILL ME NOW