easy (i guess) mod request (entity clones)

Mods, guides how to use and install mods go right in here.
Post Reply
User avatar
jokekid
Posts: 81
Joined: 05 Feb 2013, 23:28

Post » 12 Feb 2013, 12:36

how would i/could you make a mod that adds another companion cube entity, but with another sprite, i want this for my OoT mappack, to try to get rid of the portal items, but keeping it's functionality...

if someone could give me a simple explanation, if there is any, on how to "clone" entities with different sprites, it would be ideal.

User avatar
Mr.Q.Marx?
Posts: 849
Joined: 15 May 2012, 18:35

Post » 12 Feb 2013, 16:00

Do you need the original cube in your mappack? If the answer is 'no' this is a simple spriteswap.

User avatar
jokekid
Posts: 81
Joined: 05 Feb 2013, 23:28

Post » 12 Feb 2013, 16:24

yes, my plan is to have both boxes and cuccos (chicken), and i want them both to work like cubes of course, so how hard is it to clone a entity and make it use a different texture?

ucenna
Posts: 615
Joined: 11 Jan 2013, 20:06

Post » 12 Feb 2013, 18:56

From way back when:
Qcode wrote:This going to be a long post so be patient. And it's going to be hard.

So now that you have your code editor installed you need unzip the source, mari0.love. You should get a folder with lots of .luas. Open the folder with your code editor. Now that that's ready you will need to edit the image in graphics/SMB/entities.png. If you want to you can just download this one that I have and use it. http://www.mediafire.com/?v08mqs9j8iffs77 You see the mushroom in the bottom left corner? You can simply use that and edit it to look like the mini mushroom. Once you have that done we can start writing our code. First you will want to look at entity.lua. There should be something that starts like this

Code: Select all

entitylist = {
And ends like this

Code: Select all

   "checkpoint"
}
You'll need to edit this to add another entity, the minimushroom. (this code assumes you're going to name everything the same way I do)
So now it needs to look like this

Code: Select all

   "checkpoint",
   "minimushroom"
}
I'm going to start using line numbers in this tutorial. There the little numbers on the left that tell you what line you're on.
So now go to line 207 still in entity.lua
You'll want to again press enter and add another description. So maybe like this.

Code: Select all

"place on empty tile - checkpoint - mario will spawn there if he dies after reaching it", --"checkpoint"
	"place on a wall - minimushroom",
}
Now you'll need to start creating your own code. I may post something like this later, but for now you can make it up yourself. Make a new file in the mari0 folder called "minimushroom.lua" Without the quotes. I'd recommend copying in the entire mushroom code and then modifying it later.
After you've got all the code for the minimushroom go into game.lua. Go to line 920. Press enter then enter in this code.

Code: Select all

for j, w in pairs(objects["minimushroom"]) do
			w:draw()
		end
Now go to line 2053. Press Enter then enter in this code

Code: Select all

objects["minimushroom"] = {}
Now go to line 3803. Press enter then enter in this code.

Code: Select all

elseif i == "minimushroom" then
		table.insert(objects["minimushroom"], minimushroom:new(x-0.5, y-2/16))
Nows the last bit!
Go to main.lua. At line 73 there should be quite a few things saying require "".
Press enter in there and put this code.

Code: Select all

require "minimushroom"
After that you're done! Now if you havent modified the minimushroom.lua from the normal mushroom code then it will act just like a normal mushroom. This is expected. Now you can start actually modding stuff by playing around with code in the minimushroom.lua. If you need help with that stuff just ask.
BTW this is how I made my mega mushroom mod found here viewtopic.php?f=8&t=2099
Basically do this, preferably changing "minimushroom" to "cucco" then when you make the cucco.lua copy the companion cube code into the file. That should do it.

User avatar
jokekid
Posts: 81
Joined: 05 Feb 2013, 23:28

Post » 12 Feb 2013, 19:36

thanks a lot, i guess i'll have to do this when im actually done with the mappack itself, since i'll use other mods as well...

User avatar
Qcode
Posts: 1479
Joined: 05 Feb 2012, 18:00
Contact:

Post » 12 Feb 2013, 22:18

...
Last edited by Qcode on 21 Oct 2021, 09:08, edited 1 time in total.

ucenna
Posts: 615
Joined: 11 Jan 2013, 20:06

Post » 13 Feb 2013, 01:09

I'm with Qcode on that (despite having no lua programming experience)
Turtle's extra entities seems to slow down Mari0 significantly.

Maurice
Stabyourself.net
Posts: 2145
Joined: 01 Feb 2012, 20:19

Post » 13 Feb 2013, 10:32

http://dl.dropbox.com/u/17466990/mari0_1.6_2boxes.love

Use rightclick to set which graphic to use.
graphics/smb/box2.png

User avatar
jokekid
Posts: 81
Joined: 05 Feb 2013, 23:28

Post » 13 Feb 2013, 16:48

Maurice wrote:http://dl.dropbox.com/u/17466990/mari0_1.6_2boxes.love

Use rightclick to set which graphic to use.
graphics/smb/box2.png
OMG thanks!

also, what .lua was editted, because in the final release of the mappack in question it'll use the more custom music mod...

Maurice
Stabyourself.net
Posts: 2145
Joined: 01 Feb 2012, 20:19

Post » 13 Feb 2013, 17:19

main.lua game.lua box.lua entity.lua

User avatar
TurretBot
Posts: 4413
Joined: 15 Mar 2012, 23:18
Contact:

Post » 14 Feb 2013, 14:21

you should put right click to change graphic in se

Maurice
Stabyourself.net
Posts: 2145
Joined: 01 Feb 2012, 20:19

Post » 14 Feb 2013, 18:20

no

User avatar
jokekid
Posts: 81
Joined: 05 Feb 2013, 23:28

Post » 14 Feb 2013, 19:28

Turret Opera wrote:you should put right click to change graphic in se
that would still liit the skins to whateer nuber would be added, it would be cool to be able to select what spriteset a enemy uses one by one, i mean castle, underground or overworld... but let's not derail this topic anymore, my answer has been answered, so please dont reply to this anymore

Post Reply