Page 1 of 1

SMBX - Hammer Starman (Repost)

Posted: Fri May 22, 2015 4:05 pm
by DarkShadeX
I got a lot of emails about if i could repost the Starman code from a while ago,if you guys really want it,then here:

Code: Select all

--Set some Variables first:
local StarPower_P1 = false
 local StarTimer_P1 = 0


 -- Find Starman:
function countNPCID(id)
   local npcs = findnpcs(id, -1)
   local count = 0
   for k,v in pairs(npcs) do
      count = count + 1
   end
   return count
end

function onLoop()

 local HNPC = findnpcs(171, -1) -- The Hammer in section!
 
 hud(false)
 printText("GOT STARPOWER: "..tostring(StarPower_P1), 30, 50)
 printText("STARMAN NPC IN ROOM: "..tostring(count), 30, 70)
 printText("INVINCIBILITY LEFT: "..tostring(StarTimer_P1), 30, 90)
 -- Get Star Power:
 
 if(StarPower_P1 == false and countNPCID(103) == 0 and count ~= -1 )then
   count = -1
   StarTimer_P1 = 600
  end
  
 -- Check Stuff:
if(StarTimer_P1 >= 1)then
  StarPower_P1 = true -- Keep Power state to true.
  mem(0x00B2C8C0, FIELD_WORD, 0xFFFF) -- Make the Player Invincible.
 else
  StarPower_P1 = false -- Keep Power state to false.
  mem(0x00B2C8C0, FIELD_WORD, 0) -- Make the Player NOT Invincible.
  HNPC[0].x = -1000000 HNPC[0].y = -1000000 -- Reset Hammer Position!
 end

 -- If you're in Invincibility State: 
if(StarPower_P1 == true and StarTimer_P1 >= 1)then -- Reduce Invincibility Time!
 StarTimer_P1 = StarTimer_P1 - 1
 HNPC[0].x = player.x HNPC[0].y = player.y -- Set Hammer position to player.
 end
 
end
Make sure to tweak the code to make it work better.

Re: SMBX - Hammer Starman (Repost)

Posted: Mon May 25, 2015 9:36 pm
by Radishl
Wow, neat!
We could really use this.

Thanks Dark!

Re: SMBX - Hammer Starman (Repost)

Posted: Tue Jul 21, 2015 11:40 pm
by PersonNamedUser
How do you use this?

Re: SMBX - Hammer Starman (Repost)

Posted: Sat Jul 25, 2015 2:58 pm
by SMBXxer
What object does it replace? I use this in Lunaglobal, right?

Re: SMBX - Hammer Starman (Repost)

Posted: Sun Jul 26, 2015 4:09 am
by FanofSMBX
SuperMario12345 wrote:How do you use this?
I think you put the code in your level's lunadll.lua and then you collect a Red Coin.

Re: SMBX - Hammer Starman (Repost)

Posted: Sun Jul 26, 2015 11:17 pm
by SMBXxer
FanofSMBX wrote:
SuperMario12345 wrote:How do you use this?
I think you put the code in your level's lunadll.lua and then you collect a Red Coin.
.lua?
I still have .dll, do I need to change?

Re: SMBX - Hammer Starman (Repost)

Posted: Sun Aug 09, 2015 5:46 pm
by Wohlstand
SMBXxer wrote:
FanofSMBX wrote:
SuperMario12345 wrote:How do you use this?
I think you put the code in your level's lunadll.lua and then you collect a Red Coin.
.lua?
I still have .dll, do I need to change?
LunaLUA is same LunaDLL but in new view, and with a lot of new better things (Lua-scripting sub-system, Better Audio engine, Improvment of Graphic system with OpenGL usage, Some bug-fixes, etc. Don't worry, it still support old lunadll.txt, but this sub-system no more have updates, most of new things are available for lunadll.lua)