Jump to content

Latest API?


ThyHolyNoodle

Recommended Posts

Hello I've been trying to mod PZ for the past week but I've been having some trouble with some of the functions such as setInf(); (might misspell some of them but they don't work) while others such as RestoreHealth(); do work. If anyone knows where I can get the latest API for the latest build (or better yet build 41), that'd be awesome.

Link to comment
Share on other sites

Assuming you mean the latest API documentation (the API is the exposed code, which is included with pz), there isn't any.

The online sources for the java components are horribly out of date (by several years) and quite honestly of limited use anyways as there's no actual documentation on the functions, classes or methods. Just the arguments and return values types.

 

For the java component's API, your best bet is to install a decompiler such JD-GUI and browse the source directly. Its much easier to see what classes and functions are exposed to the lua component, as well as the expected arguments and return values. Browsing the API this way will make sure its up-to-date, and offers far more insight to the classes and methods then the old online documentation.

 

Link to comment
Share on other sites

The .class files in the projectzomboid/zombie directory

zombie/Lua/LuaManager.class is a excellent starting point, as it will list all exposed java classes, and global functions provided by java to the lua component.

If you use JD-GUI just pick any .class file and it will allow easy viewing of all of them

 

1268059354_Screenshotat2019-06-1511-14-14.thumb.png.c94d4085f2042b427cfdca8c4523e2fc.png

Link to comment
Share on other sites

Wait so what exactly am I looking for? I don't understand how I can use any of this. I mean I'm sure the information is somewhere in there and it is the latest but I don't know what I am supposed to use. Right now I am trying to find what I can put after "Events." What I am currently trying to make is a cure that makes use of the largely useless skill "first aid." So far I have

 

function Itemcool()
local inv = getPlayer():getInventory();
local player = getPlayer();

it = inv:FindAndReturn("MC.myfoods");

if it then
    getPlayer():Say("I have the cure");
    local BP;
    BP = player:getBodyDamage();
    BP:RestoreToFullHealth();
end
    
end

 

Events.OnFillInventoryObjectContextMenu.Add(invContextMenu);

 

But that last line makes it so that it restores health if you right click on anything in your inventory. So if you could help me understand my way on navigating my way around that'd be great.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...