From my experience, SetHits in Autocode is really finicky. For example, setting the hits for Mother Brain's glass container to 1 does not do anything, but setting it to 8 registers it as having a single "hit". Also, if you re-enter the section an NPC spawns in, or it is spawned with a layer, its hits will reset. Assuming that everything is set up correctly (which it should be, if you're using the devkit), then your best bet would probably be to use LunaLua.Dr. Freeman wrote:This is probably a stupid question, but I missed out on some step somewhere and I can't seem to figure out what. On the MaGLX dev kit with LunaDll installed, I created a text file in the level folder to have the SetHits code work, but when I test the level, the hits are always set to default. I tried tinkering with the section, thinking that I was wrong but it still doesn't seem to work. My only guess is that because the boss starts on a hidden layer that the frames need to be adjusted, but I'm not sure if I just made a mistake with just implementing the code properly in the first place. If all the LunaDLL files are in the folder with the engine, do you need to install or perform any other steps?
Code: Select all
-- Has the npc's hit counter been set?
hitflag = false
-- Run every frame
function onLoop()
-- If hit counter has not been set
if not hitflag then
-- Find all mother brains (NPCID 209) in the current section
for i,npc in pairs( findnpcs(209, player.section) ) do
-- Set hits to 3
npc:mem(0x148,FIELD_FLOAT,0)
-- Raise the flag that the hit counter has been set
hitflag = true
end
end
end















