How to add enemies to (or change enemies in) the game?

Mods, guides how to use and install mods go right in here.
Post Reply
User avatar
JWinslow23
Posts: 139
Joined: 06 Feb 2013, 01:05

Post » 15 Feb 2013, 18:32

Title says it all. I know what I am going to code, like fire-breathing Pirahna Plants and Goombas with hammers. Also, how to put hammers into ? Blocks?

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

Post » 15 Feb 2013, 19:10

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

User avatar
JWinslow23
Posts: 139
Joined: 06 Feb 2013, 01:05

Post » 16 Feb 2013, 02:06

Qcode wrote:So basically you're trying to make stuff from SE. I have a (somewhat complicated) tutorial for adding entities here: viewtopic.php?f=13&t=2109 .
That shows you through the basics of making a first entity. Making enemies is more complicated. I don't know what you mean by "how to change enemies". You edit the code for the enemies in their respective .lua files. You can put hammers into coin blocks by editing the function item in game.lua.
First you'll need to make a hammer entity that can be selected by itself. Make that first, I'll give you more help if you can do that. It'll prove whether you're truly up for this.
It helps a little bit, but I do not know how to make the entity version of that hammer thing. I have only a little programming experience, and that is with Batch. I do not know anything in Lua, except for this quine (program which outputs its own source) that I don't understand:

Code: Select all

s=[[print('s=['..'['..s..']'..'];'..s)]];print('s=['..'['..s..']'..'];'..s)

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

Post » 16 Feb 2013, 17:02

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

User avatar
JWinslow23
Posts: 139
Joined: 06 Feb 2013, 01:05

Post » 16 Feb 2013, 23:57

Qcode wrote:Here: http://www.mediafire.com/?4fnq8ak2s2eaop6
Put hammers into blocks. Works like the gif Maurice posted.
Stuff I did:
I edited the entity.png to add a hammer.
Edited entity.lua to add hammer to the entitylist and entitydescriptions.
Edited game.lua, the function item.
Edited the hammerbro.lua, the function hammerbro:throwhammer to allow a thrown argument.
Also in this file, I edited the hammer:init function to check if it wasn't thrown, then if it wasn't double it's speedy.
That's all I did.
Well, all you said in your "tutorial" is how to edit the description to use the entity. You never gave any code for shrinking Mario or having Mario stay up in the air more. (Talking about the Mini Mushroom code, by the way.)

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

Post » 17 Feb 2013, 00:12

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

User avatar
JWinslow23
Posts: 139
Joined: 06 Feb 2013, 01:05

Post » 17 Feb 2013, 00:33

Qcode wrote:You do realize that's the part the modder (you) is supposed to do, right? I also only asked you to make a selectable hammer entity to prove you were up for this. That was completely possible with that tutorial. It's simple and easy, in fact, because all you need to do to add an entity is change the entities.png (one was already provided in the tutorial if you were too lazy to resize it) and then add a whole 2 lines of code! See here:
Qcode wrote: 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",
}
You weren't able to do this, and so I made the mod for you. I even tell you what I edited so you could learn rather than trying to find what I altered. Then you criticize me for not bumping an old thread and adding code that the modder is supposed to do in the first place. That makes complete sense. Find someone else to help you making mods.
Sorry! I did that, but I thought that you meant actually MAKE the code for the entity!

Post Reply