|
-
Arco
- Koopa
- Posts: 17
- Joined: Mon Nov 08, 2021 9:32 pm
- Flair: Creative
- Pronouns: she/her
-
Contact:
Postby Arco » Tue Mar 29, 2022 3:11 am
So I'm working on making a custom NPC that behaves like the NSMB. U Bowser Jr Blocks seen in his second boss battle. I have a working, but buggy block NPC that behaves like a block, kind of, using a temporary placeholder graphic (the big hit ? block) until I make a new one, but I want to incorporate the 2 hit destruction system. I have tried to adjust the HP, but it doesn't seem to matter. I will show a full script of both the .lua and .ini files below. What can I do to make this work?
npc- n.lua
Code: Select all local npcManager = require("npcManager")
local bowserJRBlock = {}
local npcID = NPC_ID
local bowserJRBlockSettings = {
id = npcID,
gfxheight = 64,
gfxwidth = 64,
width = 64,
height = 64,
gfxoffsetx = 0,
gfxoffsety = 0,
frames = 1,
framestyle = 0,
framespeed = 8,
speed = 0,
npcblock = true,
npcblocktop = true,
playerblock = true,
playerblocktop = true,
nohurt=false,
nogravity = true,
noblockcollision = true,
nofireball = true,
noiceball = true,
noyoshi= true,
nowaterphysics = true,
jumphurt = false,
spinjumpsafe = false,
harmlessgrab = false,
harmlessthrown = false,
grabside=false,
grabtop=false,
health = 20,
}
npcManager.setNpcSettings(bowserJRBlockSettings)
npcManager.registerHarmTypes(npcID,
{
HARM_TYPE_NPC,
},
{
[HARM_TYPE_NPC]=10,
}
);
function bowserJRBlock.onInitAPI()
npcManager.registerEvent(npcID, bowserJRBlock, "onTickNPC")
end
function bowserJRBlock.onTickNPC(v)
if Defines.levelFreeze then return end
local data = v.data
if v.despawnTimer <= 0 then
data.initialized = false
return
end
if not data.initialized then
data.initialized = true
end
if v:mem(0x12C, FIELD_WORD) > 0
or v:mem(0x136, FIELD_BOOL)
or v:mem(0x138, FIELD_WORD) > 0
then
end
if v.collidesBlockBottom then
v.speedY = -6
end
end
return bowserJRBlock
npc- n.ini
Code: Select all [npc]
name = "Bowser Jr Block"
group = "New Super Mario Bros."
category = "Bowser Jr"
image = "npc-982e.png"
description = "Behaves like a block, takes two explosions to break."
gfx-offset-x = 0
gfx-offset-y = 0
gfx-width = 64
gfx-height = 64
physical-width = 64
physical-height = 64
grid = 32
grid-offset-x = 0
grid-offset-y = 0
frame-style = 0
frames = 1
frame-delay = 128
foreground = 0
animation-direction = 0
animation-bidirectional = 0
custom-animation = 0
container = 0
contents-id = 0
have-special = 0
moving = 1
default-health = 1
collision-blocks = 1
I'm new to making custom NPCs separate from existing ones for the record, so you might need to play a little dumb for me. :D
FYI, I'm making it an NPC so I can use a generator to regenerate them like in the game, and so far that works well :3
|
|