Jump to content

Astral Serpent

Members
  • Posts

    295
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Australia

Recent Profile Visitors

3,289 profile views

Astral Serpent's Achievements

Community Regular

Community Regular (4/10)

  1. 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.
  2. Holy shit.
  3. What's the point of adding 'On a serious note' when your whole post is a joke?
  4. 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.
  5. 4 fits with the colours of the site, imo.
  6. 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...
  7. 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.
×
×
  • Create New...