FANDOM


Fireplantcustomennemy

Venus Fire Trap, an enemy by Maurice.

Custom enemies are a new feature of Mario: SE, which allows to add new enemies to the game without touching the code, instead using JSON.

Vanilla enemies were converted to that system, and map-makers can add custom enemies to a mappack, or modify the vanilla ones.

BasicsEdit

At the top of your new enemy.json file, you can optionally copy all the properties from another enemy by adding "base=enemy" at the top. For beginners this is recommended as it allows you to skip some more complicated properties. It is also very useful for simple variations on an enemy, as all enemies with the same base will change if the base enemy changes.

After that, it will follow this pattern:

{
	"number": value,
	"string": "value",
	"boolean": true/false,
	"array": [value, "value", true, etc.]
}

Note that the final element does not have a comma at the end. Of course, most text properties have only a few acceptable values even though you can put anything there.

Very early into enemy.lua, there is code that parses all the properties into values in the enemies' property table. Every property in their enemy.json file will be added, even if it is not used anywhere.

A list of every property can be found on the Custom Enemy Documentation.

Collision Edit

Enemies derive their collision through two different properties: "category" and "mask".

Categories Edit

The "category" property is a simple number, 1 through 31. It decides which enemies and entities collide with it.

Masks Edit

The "mask" property, on the other hand, is an array. If it is true, it will not collide with entities or enemies of that category. You can use this to make background enemies that don't collide with anything, enemies that pass right through each other, or even specialized blocks that only collide with particular enemies or the player.

Here is the reference list, as shown in physics.lua:

Collapse
---1: *ALWAYS NOT COLLIDE*
---2: WORLD
---3: MARIO
---4: GOOMBA
---5: KOOPA
---6: MUSHROOM/ONEUP/FLOWER/STAR
---7: GEL DISPENSER
---8: GEL
---9: BOX
--10: SCREENBOUNDARIES
--11: BULLETBILL
--12: PORTALWALLS
--13: FIREBALLS
--14: HAMMERS
--15: PLATFORMS/SEESAWS
--16: BOWSER
--17: FIRE
--18: VINE
--19: SPRING
--20: HAMMERBROS
--21: LAKITO
--22: BUTTON --Not used anymore
--23: CASTLEFIRE
--24: CHEEP
--25: DOOR
--26: FAITHPLATE
--27: FLYINGFISH
--28: LIGHTBRIDGE
--29: PLANT
--30: SQUID
--31: UPFIRE

However, categories that refer to other enemies aren't hardcoded and can be freed up by changing that enemy's category. Additionally, you can add as many extra categories as you want, but masks without this category will use category 1 instead. This includes hardcoded masks, such as the player's.

To make it easier to edit, it's usually formatted so that each line directly correlates with a paragraph in the code, like so:

"mask": [    true, 
             true, true, true, true, true,
             true, true, true, true, true,
             true, true, true, true, true,
             true, true, true, true, true,
             true, true, true, true, true,
             true, true, true, true, true],

This mask specifically collides with nothing. Stopping at the first "true" will produce the same effect.

Custom Timers Edit

Custom Timers are an array. Their function is to let enemies preform actions or change their properties after a specified time. They are not used often because their only trigger is time. To use it, you have to put arrays in the array: The first slot is the delay, the second one is the action, the third one is the arguments.

Further Reading Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.