This is the place for discussion and support for LunaLua and related modifications and libraries.
Moderator: Userbase Moderators
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
|
|
|
|
-
loop
- Ninji

- Posts: 984
- Joined: Sun Apr 17, 2016 5:56 pm
- Flair: i may be dumb but im not stupid!
- Pronouns: he/him/they
Postby loop » Sat Jan 21, 2017 12:05 am
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. 
|
|
|
|
|
|
|
|
|
-
RhysOwens
- Nipper

- Posts: 423
- Joined: Fri Apr 22, 2016 2:53 am
Postby RhysOwens » Sun Jan 22, 2017 10:42 am
They also spit multiple fireballs in 1.4.2/3 via changing things up with the Advanced option.
|
|
|
|
|
|
|
|
|
-
loop
- Ninji

- Posts: 984
- Joined: Sun Apr 17, 2016 5:56 pm
- Flair: i may be dumb but im not stupid!
- Pronouns: he/him/they
Postby loop » Sun Jan 22, 2017 11:56 am
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.
|
|
|
|
|
|
|
|
|
-
timocomsmbx2345
- Foo

- Posts: 853
- Joined: Sat Feb 06, 2016 1:44 pm
-
Contact:
Postby timocomsmbx2345 » Sun Jan 22, 2017 2:29 pm
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. . . . .
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Sun Jan 22, 2017 3:49 pm
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.
|
|
|
|
|
|
|
|
|
-
ivanmegafanboy
- Flurry

- Posts: 175
- Joined: Wed Aug 12, 2015 11:47 am
Postby ivanmegafanboy » Sun Jan 22, 2017 4:06 pm
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
|
|
|
|
|
|
|
|
|
-
loop
- Ninji

- Posts: 984
- Joined: Sun Apr 17, 2016 5:56 pm
- Flair: i may be dumb but im not stupid!
- Pronouns: he/him/they
Postby loop » Sun Jan 22, 2017 9:31 pm
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.
|
|
|
|
|
|
|
|
|
-
ivanmegafanboy
- Flurry

- Posts: 175
- Joined: Wed Aug 12, 2015 11:47 am
Postby ivanmegafanboy » Sun Jan 22, 2017 11:43 pm
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.
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 5 guests
|