Need Help with Custom Entity

Mods, guides how to use and install mods go right in here.
Post Reply
User avatar
Zlmpery
Posts: 339
Joined: 05 Feb 2012, 19:12
Contact:

Post » 05 Apr 2012, 17:48

I'm working on a custom entity, a muncher.
Image
Munchers are basically piranha plants that don't move, are only only block tall, and are indestructable.
Here is the code for plant.lua: https://raw.github.com/Stabyourself/mar ... /plant.lua

I pasted the entire plant.lua code into muncher.lua.
I want to do three things:
1. Change the height.
2. Make it indestructable.
3. Make it not move.

I was comparing the code with goomba.lua but I still don't get it.

I removed

Code: Select all

	self.destroy = true
	self.active = false
from

Code: Select all

function plant:shotted()
	playsound(shotsound)
	self.destroy = true
	self.active = false
which I believe made it indestructable, but I need more help. I'm not the best at coding. :X

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 01:46

Zlmpery wrote:I'm working on a custom entity, a muncher.
Image
Munchers are basically piranha plants that don't move, are only only block tall, and are indestructable.
Here is the code for plant.lua: https://raw.github.com/Stabyourself/mar ... /plant.lua

I pasted the entire plant.lua code into muncher.lua.
I want to do three things:
1. Change the height.
2. Make it indestructable.
3. Make it not move.

I was comparing the code with goomba.lua but I still don't get it.

I removed

Code: Select all

	self.destroy = true
	self.active = false
from

Code: Select all

function plant:shotted()
	playsound(shotsound)
	self.destroy = true
	self.active = false
which I believe made it indestructable, but I need more help. I'm not the best at coding. :X
How about you don't remove that code?

Code: Select all

function plant:shotted()
	playsound(shotsound)
	self.destroy = false
	self.active = true
It's just switching it from true to false or vice versa.

User avatar
12seth12
Posts: 139
Joined: 11 Mar 2012, 20:42

Post » 06 Apr 2012, 09:19

Doen't he need to get rid of that code so the plant can't be killed? But he kept some of the code so the plant would still make the sound :o
(\/) (°,,°) (\/)

Maybe you should remove the self.mask, and change the category so you don't get rid of the original plant. Try looking at the goomba code, since it is the same size, all you need to do is change it so it doesn't move, and make it not killable by stomping.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 15:49

12seth12 wrote:Doen't he need to get rid of that code so the plant can't be killed? But he kept some of the code so the plant would still make the sound :o
(\/) (°,,°) (\/)

Maybe you should remove the self.mask, and change the category so you don't get rid of the original plant. Try looking at the goomba code, since it is the same size, all you need to do is change it so it doesn't move, and make it not killable by stomping.
Nope. THIS is doing it right as I said before. Just keep the damn plant from going back in the pipe or whatever:


Post Reply