Page 1 of 2

Magikoopa.lua

Posted: Tue Mar 15, 2016 4:47 pm
by TDK
This is my first LunaLua API. This was from my first LunaLua level, Lemmy's Tower, that I've made a few months ago. I've edited the code to make it into an API.
You can use this API for magikoopa, and you can choose which section which the magikoopa can appear.

To use:

1. Extract the files from the download, and copy it into the level's custom graphics folder.

2. Make a new file in the custom graphics folder called "lunadll.lua" (make sure the extension is .lua)

3. Then add this to your lunadll.lua code:
magikoopa =API.load("magikoopa")

4. However the magikoopa will only appear in section 1 by default, so if you want it to appear in other section you would need to add this:
magikoopa.section = {list of sections}
For example if you want the magikoopa to appear in section 5 and 6, then you need to do this:
magikoopa.section = {4,5}

5. Also if you want to change the enemies that appear from the blocks, you would need to add this line of code:
magikoopa.enemy_list = {list of npc ids}
For example if you just want SMB3 goombas and koopas you could use:
magikoopa.enemy_list = {1,2,4,6}

6. You can also edit which blocks will be affected by the magic:
magikoopa.block_list = {list of block ids}
For example you want the SMB3 wood block to be affected, you can use:
magikoopa.block_list = {1}

An image (quite outdated):
Spoiler: show
Image
Example Level:
Spoiler: show
Download and enjoy:
https://www.mediafire.com/?z53dpubkx02unqk

Re: Magikoopa API

Posted: Tue Mar 15, 2016 8:38 pm
by snoruntpyro
Looks a bit awkward with the magic just hanging there. Might want to just change its ai1 value to 1 when you spawn it (assuming it's a Rinka). It'd also be neat if there was a teleportation effect.

Re: Magikoopa API

Posted: Thu Mar 17, 2016 3:51 pm
by TDK
snoruntpyro wrote:Looks a bit awkward with the magic just hanging there. Might want to just change its ai1 value to 1 when you spawn it (assuming it's a Rinka). It'd also be neat if there was a teleportation effect.
The image is a bit outdated since I made it in December. I have improved the rinka's ai since then.
However, I updated the API, and the magikoopa now has a fading effect when it appears and disappears.

Re: Magikoopa API

Posted: Thu Mar 17, 2016 9:28 pm
by PROX
I really like this. I think it should have a sound effect when it teleports though. (birdo beat sound or tanooki statue sound)

Re: Magikoopa API

Posted: Thu Mar 17, 2016 10:18 pm
by PixelPest
Or you could see if you could find a custom sound from NSMBWII or SMG

Re: Magikoopa API

Posted: Fri Mar 18, 2016 3:28 pm
by TDK
PROX wrote:I really like this. I think it should have a sound effect when it teleports though. (birdo beat sound or tanooki statue sound)
PixelPest wrote:Or you could see if you could find a custom sound from NSMBWII or SMG
I have now added a sound effect.

Re: Magikoopa API

Posted: Mon Mar 21, 2016 7:42 pm
by Super Mario Channel
Too much 1x1 Pixels... try saving as PNG and coverting to GIF with PGE Converter

Re: Magikoopa API

Posted: Tue Mar 22, 2016 12:04 am
by PROX
Super Mario Channel wrote:Too much 1x1 Pixels... try saving as PNG and coverting to GIF with PGE Converter
the image shown has 1x1 pixels, but the graphic itself doesn't

Re: Magikoopa API

Posted: Tue Mar 22, 2016 12:07 am
by Alagirez
Super Mario Channel wrote:Too much 1x1 Pixels... try saving as PNG and coverting to GIF with PGE Converter
I recommend you download the graphic, then open and zoom the graphic, then see every detail of the graphic.
I didn't see any 1x1 pixels.
-----------------------------------------
Hey the magikoopa looks nice, it reminds me to the real SMW magikoopa. I will use this later.

Re: Magikoopa API

Posted: Tue Mar 22, 2016 12:10 am
by Kyo Saito
Super Mario Channel wrote:Too much 1x1 Pixels... try saving as PNG and coverting to GIF with PGE Converter
It appears to have 1x1 pixels only because of the quality of the animated .gif image.

Re: Magikoopa API

Posted: Tue Mar 22, 2016 3:42 pm
by TDK
Super Mario Channel wrote:Too much 1x1 Pixels... try saving as PNG and coverting to GIF with PGE Converter
The image quality is low that's why there's 1x1 pixels. The magikoopa's graphics has 2x2 pixels.
Also wouldn't it be easier use Paint.NET when saving GIF images with 2x2 pixels.

Re: Magikoopa API

Posted: Mon May 02, 2016 4:57 pm
by pal4
I have it downloaded, but it doesn't much different from a rinka. It just stays in one place and the magic has no effect on blocks.

Re: Magikoopa API

Posted: Mon May 02, 2016 5:16 pm
by underFlo
Looks like you're not using LunaLua or not loading the API.

Re: Magikoopa API

Posted: Tue May 03, 2016 3:18 pm
by TDK
pal4 wrote:I have it downloaded, but it doesn't much different from a rinka. It just stays in one place and the magic has no effect on blocks.
Did you copy everything into the level's graphic folder?
Did you load the API and set the section like this in your lunadll.lua file:

Code: Select all

magikoopa = loadSharedAPI("magikoopa")
magikoopa.section = {0}

Re: Magikoopa API

Posted: Thu May 05, 2016 6:58 pm
by pal4

Re: Magikoopa API

Posted: Fri May 06, 2016 3:19 am
by Hoeloe
You can't set the parameters of the API before you load it, that just makes no sense.

You need to think about what your operations mean - when you say:

Code: Select all

a = b
That means you are assigning the value of b to the variable a. If a already has information, it will be lost when you do this.

Similarly, there's no point in defining the API as a blank table first - just load it directly. Also you should use API.load when loading APIs in LunaLua. The other functions are outdated.

Re: Magikoopa API

Posted: Fri May 06, 2016 2:35 pm
by TDK
... umm, you just posted my code.

Did you read my previous post?

Re: Magikoopa API

Posted: Fri May 06, 2016 4:07 pm
by pal4
TheDinoKing432 wrote:
... umm, you just posted my code.

Did you read my previous post?
Oops. Sorry. :oops:
I tried renaming the lua file to lunadll.lua and ended up with an error message.

Re: Magikoopa API

Posted: Fri May 06, 2016 4:16 pm
by S1eth
TheDinoKing432 wrote:
... umm, you just posted my code.

Did you read my previous post?
He just took your API .lua file and pasted

Code: Select all

magikoopa = loadSharedAPI("magikoopa")
magikoopa.section = {0}
into it assuming it would magically work.

@pal4: You can't just put the loading code into the same file as the code you want to load.

You have your main script file called lunadll.lua and ANOTHER file called magikoopa.lua
You want to put the loading code inside the lunadll.lua which LOADS and runs the code from the other file.

These are all the things you have to do:

1. Open PGE editor and create a new level file. Name it "MyLuaTest"
2. Save the level. Check "Make a custom folder"
3. Open the explorer and navigate into the "MyLuaTest" folder.
4. unzip "magikoopa API.zip" into this folder
5. rightclick --> create new text document --> rename it from "New Text Document.txt" to "lunadll.lua" (!!! EXTENSION .lua is important !!!)
6. rightclick on "lunadll.lua" --> open with --> notepad (or notepad++)
7. paste this code into the text file:

Code: Select all

magikoopa = API.load("magikoopa")
magikoopa.section = {0}
8. Save.
9. Play your level.

Re: Magikoopa API

Posted: Sun May 08, 2016 12:00 pm
by pal4
S1eth wrote:
TheDinoKing432 wrote:
... umm, you just posted my code.

Did you read my previous post?
He just took your API .lua file and pasted

Code: Select all

magikoopa = loadSharedAPI("magikoopa")
magikoopa.section = {0}
into it assuming it would magically work.

@pal4: You can't just put the loading code into the same file as the code you want to load.

You have your main script file called lunadll.lua and ANOTHER file called magikoopa.lua
You want to put the loading code inside the lunadll.lua which LOADS and runs the code from the other file.

These are all the things you have to do:

1. Open PGE editor and create a new level file. Name it "MyLuaTest"
2. Save the level. Check "Make a custom folder"
3. Open the explorer and navigate into the "MyLuaTest" folder.
4. unzip "magikoopa API.zip" into this folder
5. rightclick --> create new text document --> rename it from "New Text Document.txt" to "lunadll.lua" (!!! EXTENSION .lua is important !!!)
6. rightclick on "lunadll.lua" --> open with --> notepad (or notepad++)
7. paste this code into the text file:

Code: Select all

magikoopa = API.load("magikoopa")
magikoopa.section = {0}
8. Save.
9. Play your level.
What PGE editor? The Lunalua set I have is a 1.3.0.1 edition.