can i edit the fire rate of wart's bubbles?

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?
squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

can i edit the fire rate of wart's bubbles?

Postby squp » Fri Sep 22, 2017 4:15 pm

hey, i was just wondering if it was possible to slow the rate (preferably decrease it) of Wart's bubbles? i want to make a boss which uses wart, but with how many things he fires out, it'll make it too hard for the first boss.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby PixelPest » Fri Sep 22, 2017 7:06 pm

Basically your code would look something like what I've shown below. You can change the delay and maxN variables as you wish to suit your needs.

Code: Select all

local pnpc = API.load("pnpc"); --load the pnpc library which allows us to give variables to specific instances of NPCs, such as Wart

local delay = 55; --set how long it takes in ticks between bubbles (you can change this!)
local maxN = 3; --set how many bubbles wart should shoot (you can change this!)

function onTick() --every tick (unit of time in SMBX)
	for _, v in pairs(NPC.get(201)) do --for each of the Warts in the level assign them to v one at a time so we can do stuff to all of them
		local wart = pnpc.wrap(v); --wrap our Wart using the pnpc library to give us the ability to give it variables specific to that Wart
		
		if wart.data.counter == nil then --if there wasn't been a value set for the counter within our Wart's data table (of variables)
			wart.data.counter = 0; --set the counter to 0 (this variable will be used to make sure we don't exceed the max number of bubbles we have selected being shot each attack phase)
			wart.data.reloops = 0; --set our reloops variable to 0 (this variable will be used to make the delay occur)
		end
	
		if v.ai1 == 1 then --if the Wart is shooting bubbles (for AI #1: 0 - Idle, 1 - Bubbles, 2 - Hit, 3 - Death)
			if v.ai3 == 9 then --if our Wart is about to shoot a bubble on the next tick (shoots a bubble when AI #3 is a multiple of 10)
				if wart.data.reloops > 0 then --if our reloops variable is more than zero
					wart.data.reloops = wart.data.reloops - 1; --subtract one from the reloops variable
					v.ai3 = 8; --lower the AI #3 field to 8 so we can check it again on the next tick when it has increases to 9 between ticks
				end
			elseif v.ai3 == 10 then --if the AI #3 field equals 10 (which is when our Wart shoots a bubble)
				wart.data.counter = wart.data.counter + 1; --add one to the counter which counts how many bubbles our Wart has shot
				
				if wart.data.counter == maxN then --if the number of bubbles our Wart has shot is equal to our max number allowed per attack phase
					v.ai3 = 130; --set the AI #3 field to 130 which ends the attack phase for Wart's AI in general (but not others)
					wart.data.counter = 0; --set the number of bubbles our Wart has shot to zero so that this variable is ready for the next time we use it
				else --if the number of bubbles our wart has shot is not equal to our max number allowed per attack phase (it will be less and mean that our Wart should still be shooting bubbles)
					wart.data.reloops = delay; --set the reloops variable to the value of our delay variable
					v.ai3 = 8; --set the AI #3 field to 8
				end
			end
		end
	end
end
Here's a .gif of what the code above does with the way the variables are set rn:
Image

squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby squp » Sat Sep 23, 2017 1:56 am

[quote=PixelPest]
Code and stuff, this quote would be long if I directly quoted the reply[/quote]

Thanks, but how do I put the code in the list file? (I am VERY dumb)

ElectriKong
Bowser
Bowser
Posts: 4651
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Pronouns: he/him
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby ElectriKong » Sat Sep 23, 2017 5:17 am

FlatKiwi wrote:
PixelPest wrote: Code and stuff, this quote would be long if I directly quoted the reply
Thanks, but how do I put the code in the list file? (I am VERY dumb)
Create a file called lunadll.lua in your GFX folder (you need LunaLua or 2.0) and copy and paste the code in there.

squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby squp » Sat Sep 23, 2017 12:45 pm

Electriking wrote: Create a file called lunadll.lua in your GFX folder (you need LunaLua or 2.0) and copy and paste the code in there.
So I just copy/paste the code he gave me? I'm not too sure due to the notes

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby PixelPest » Sat Sep 23, 2017 12:50 pm

Yes. Just copy and paste all of what I posted in the code

squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby squp » Sat Sep 23, 2017 3:58 pm

PixelPest wrote:Yes. Just copy and paste all of what I posted in the code
thanks dude, your help is appreciated :D

squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby squp » Sun Sep 24, 2017 7:22 am

PixelPest wrote:I AM REPLYING TO PIXELPEST BOI
hey, i was just wondering: can i make him shoot a vegetable instead at a random point?

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby PixelPest » Sun Sep 24, 2017 3:54 pm

FlatKiwi wrote:

PixelPest wrote:I AM REPLYING TO PIXELPEST BOI
hey, i was just wondering: can i make him shoot a vegetable instead at a random point?
Just after a random number of times?

squp
Snifit
Snifit
Posts: 211
Joined: Sat Aug 12, 2017 10:10 pm
Flair: worm
Pronouns: she/it
Contact:

Re: can i edit the fire rate of wart's bubbles?

Postby squp » Mon Sep 25, 2017 11:33 am

PixelPest wrote:
FlatKiwi wrote:

PixelPest wrote:I AM REPLYING TO PIXELPEST BOI
hey, i was just wondering: can i make him shoot a vegetable instead at a random point?
Just after a random number of times?
As in, every round of shooting has at least one veggie in... lol is this even possible


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari