This is the code:
Code: Select all
local newpirai = 0
function onTick()
for i,piranha in ipairs(NPC.get(245,-1)) do
Text.print(piranha.ai1,0,0)
Text.print(piranha.ai2,0,20)
if piranha.ai2 == 2 then
if piranha.ai1 > 43 then
if piranha.ai1 < 51 then
newpirai = newpirai + 1
end
end
if newpirai < 71 then
if piranha.ai1 == 50 then
piranha.ai1 = 44
end
end
if newpirai == 71 then
piranha.ai1 = 51
newpirai = 0
end
end
end
for j,piraice in ipairs(NPC.get(246,-1)) do
piraice.id = 30
end
end
But nevertheless I've seen some Lua codes were the modifications made to one NPC are independent of what the other NPC's of the same ID do. What do I mean? well, for example, the Moar Rinkas Api haves this bouncing purple rinkas that change direction when touching a block, but if I tried to replicate that, I would only be able to make one rinka bounce naturally, as all the other rinkas on screen would act as if they also bounced, but without touching a block. Just because one rinka bounced, the speed of all the rinkas will change at the same time. So, is there a detail that I am missing? something that I am ignorant about?
Also, there is no information at all about the "ai" of the piranha plant that shoots fireballs on the wiki. It is not something grave, because I figured out easily the pattern of that NPC, but it still confuses me. Anybody can edit articles on that wiki, right?