Page 1 of 1
MF Fire Piranha Plants?
Posted: Sat Jan 21, 2017 12:05 am
by loop
I want to make it to where certain Piranha Plants spit a certain amount of fireballs like in Mario Forever using NPCparse, but I really don't know how to code it.

Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 10:42 am
by RhysOwens
They also spit multiple fireballs in 1.4.2/3 via changing things up with the Advanced option.
Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 11:56 am
by loop
RhysOwens wrote:They also spit multiple fireballs in 1.4.2/3 via changing things up with the Advanced option.
Yeah, but I use 2.0, as 1.4.x is a little unstable sort of. I am hoping I can code it with NPCParse so I can assign each and every piranha plant with different amounts of fireballs (and other NPCs of course). I just need help coding.
Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 2:29 pm
by timocomsmbx2345
RhysOwens wrote:They also spit multiple fireballs in 1.4.2/3 via changing things up with the Advanced option.
if only that was possible in 2.0, as well as every other feature. . . . .
Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 3:49 pm
by Hoeloe
timocomsmbx2345 wrote:RhysOwens wrote:They also spit multiple fireballs in 1.4.2/3 via changing things up with the Advanced option.
if only that was possible in 2.0, as well as every other feature. . . . .
Guess what? It is.
I believe the fire piranha plants use one of the AI-values as a timer for their bullets. If you manipulate that using LunaLua, you can adjust how frequently it fires, and in what timing pattern.
Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 4:06 pm
by ivanmegafanboy
This is something I made for my level, this piranha shoots a series of hammers before hiding, in fact, you can see them on my signature. There is comments, but if you want a better explanation, I will try to give it
Code: Select all
local pnpc = API.load("pnpc") --loads an API that....just works. (Sorry, its a black box for me but its used for the new piranha enemies)
function onTick()
for _,piraice in ipairs(NPC.get(246,-1)) do --table for piranha's fireballs
piraice.id = 30 --replaces piranha fire with a hammer
end
for _,piranha in ipairs(NPC.get(245,-1)) do --table for piranha
snowpiranha = pnpc.wrap(piranha) --here we use pncp to wrap the piranha npc
if snowpiranha.data.shooting == nil then --this variable doesn't exist, so it will be equal to nil
snowpiranha.data.shooting = 0 --if this variable is equal to nil, it will be set to 0
end
if piranha.ai2 == 2 then --when the piranha has risen and prepares to shoot, its ai2 is 2
if piranha.ai1 > 43 and piranha.ai1 < 51 then --when ai1 reaches 50, the piranha shoots
snowpiranha.data.shooting = snowpiranha.data.shooting + 1 --if ai1 is beetween 43 and 51, the counter will have 1 added every frame
end
if snowpiranha.data.shooting < 71 then --if the counter is smaller han 71
if piranha.ai1 == 50 then --if ai1 of piranha reaches 50
piranha.ai1 = 44 --it will get back to 44, so it shoots again when it reaches 50 again
end
end
if snowpiranha.data.shooting == 71 then --if the counter reaches 71
piranha.ai1 = 51 --ai1 is set to 51, so it can finish properly and go back to hide
snowpiranha.data.shooting = 0 --the counter restarts
end
end
end
end
Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 9:31 pm
by loop
ivanmegafanboy wrote:This is something I made for my level, this piranha shoots a series of hammers before hiding, in fact, you can see them on my signature. There is comments, but if you want a better explanation, I will try to give it
Code: Select all
local pnpc = API.load("pnpc") --loads an API that....just works. (Sorry, its a black box for me but its used for the new piranha enemies)
function onTick()
for _,piraice in ipairs(NPC.get(246,-1)) do --table for piranha's fireballs
piraice.id = 30 --replaces piranha fire with a hammer
end
for _,piranha in ipairs(NPC.get(245,-1)) do --table for piranha
snowpiranha = pnpc.wrap(piranha) --here we use pncp to wrap the piranha npc
if snowpiranha.data.shooting == nil then --this variable doesn't exist, so it will be equal to nil
snowpiranha.data.shooting = 0 --if this variable is equal to nil, it will be set to 0
end
if piranha.ai2 == 2 then --when the piranha has risen and prepares to shoot, its ai2 is 2
if piranha.ai1 > 43 and piranha.ai1 < 51 then --when ai1 reaches 50, the piranha shoots
snowpiranha.data.shooting = snowpiranha.data.shooting + 1 --if ai1 is beetween 43 and 51, the counter will have 1 added every frame
end
if snowpiranha.data.shooting < 71 then --if the counter is smaller han 71
if piranha.ai1 == 50 then --if ai1 of piranha reaches 50
piranha.ai1 = 44 --it will get back to 44, so it shoots again when it reaches 50 again
end
end
if snowpiranha.data.shooting == 71 then --if the counter reaches 71
piranha.ai1 = 51 --ai1 is set to 51, so it can finish properly and go back to hide
snowpiranha.data.shooting = 0 --the counter restarts
end
end
end
end
Thanks. I'll try it, of course I'll give credit. Maybe I'll also try making my own, or wait until it is added to 2.0.
Re: MF Fire Piranha Plants?
Posted: Sun Jan 22, 2017 11:43 pm
by ivanmegafanboy
Jayce 777 wrote:Thanks. I'll try it, of course I'll give credit. Maybe I'll also try making my own, or wait until it is added to 2.0.
Of course that you should try to make your own, that's the spirit. I hope this is useful for you.