Jump to content

Astral Serpent

Members
  • Posts

    295
  • Joined

  • Last visited

Posts posted by Astral Serpent

  1. 8VMXqtS.png


     

    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:






    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:




    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. 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.

    Link, Shadzy, UniqueOne and 3 others like this
  3. 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!

  4. $60 for a game is bullshit, everyone knows that 

    You get the new big-release games for $60 in retail stores?

    In Australia, we get them for $110.

     

    Thankfully, I saw steam wallet cards in the local games retailer recently. Will definitely be buying one of those instead of paying shitty prices for games.

    Although, that implies I would even care to buy all the crap new games that come out. I'd say CS:GO is probably only one of the recent games that I've really liked - and it's only $15 from steam.

    When it comes down to it, the only company I see doing anything good in the games industry is Valve. They bring out mod support for (almost) every game they release, they update their games  and each are pretty much unique. They don't spew out the same shitty title over and over, which is what I feel like I see everyone else doing.

     

    Older games are much more enjoyable than the new stuff that is coming out, aside from Valve's stuff and perhaps some indie game authors. 

    tl;dr I'd take Quake 3 over Battlefield 3 any day.

     

    Also new games lack strafejumping.

    Mog likes this
×
×
  • Create New...