Help with my API
Posted: Sun Oct 09, 2016 1:50 pm
I'm trying to make an API that allows you to set how many fireballs a Piranha Plant can shoot at once. You should be able to set it from your LunaDLL.lua file. For some reason, it doesn't work at all!
Here is the API code:
And here is the LunaDLL.lua:
Here is the API code:
Code: Select all
local multiVenusAPI = {};
local pNPC = API.load("pnpc");
local maxFire = 2;
local venusFireAI = 1;
function multiVenusAPI.onInitAPI()
registerEvent(multiVenusAPI, "onTick", "onTick");
registerEvent(multiVenusAPI, "onDraw", "onDraw");
registerEvent(multiVenusAPI, "onNPCKill", "onNPCKill");
end
function multiVenusAPI.maxFireBall(setMax)
maxFire = setMax;
end
function multiVenusAPI.onTick()
local tableOfVenusFireTrap = NPC.get(245,-1);
for i,npc in ipairs(tableOfVenusFireTrap) do
if npc.ai1 == 50 then
if venusFireAI < maxFire then
npc.ai1 = 0;
venusFireAI = venusFireAI + 1;
elseif venusFireAI == maxFire then
venusFireAI = 1;
end
end
end
end
return multiVenusAPI;
Code: Select all
local multiVenusAPI = API.load("multiFireVenusFireTrap");
function onStart()
multiVenusAPI.maxFireBall(4);
end