LunaLua Offical Thread - SMBX Usermod Framework

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?

Shall I steam some LunaLua live development?

Yes
200
92%
No
17
8%
 
Total votes: 217
Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9865
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Wed Dec 09, 2015 6:23 pm

SMBX thinks your hammer brother has 3 frames for each direction, and doesn't load any beyond that, because they "don't exist".

My way to circumvent this redigit-like programming like this is to completely disable the frame counter and add in my own. In your case, I'd write frames=18 into the .txt and just add if calls asking for direction, ai5, your own frame counter, and the times when he should use his 3rd frame.

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Wed Dec 09, 2015 6:42 pm

Enjl wrote:SMBX thinks your hammer brother has 3 frames for each direction, and doesn't load any beyond that, because they "don't exist".

My way to circumvent this redigit-like programming like this is to completely disable the frame counter and add in my own. In your case, I'd write frames=18 into the .txt and just add if calls asking for direction, ai5, your own frame counter, and the times when he should use his 3rd frame.
Well, I got it working. It feels a bit clunky, but they render correctly - I still have to work on the death effect, but the NPC works great.

Code: Select all

local npcconfig = loadAPI("npcconfig");
npcconfig[29].frames = 6 * 3;
npcconfig[29].framestyle = 0;

local hammerBroFrameTimer = 0;
local broIds = {89, 210};

function onLoop()
	for k, v in pairs(NPC.get(29, -1)) do
		if(v.friendly) then v.friendly = false; end
		if(v.msg.str ~= "") then
			if(v.msg.str == "goomba") then
				v.ai4 = 1;
			elseif(v.msg.str == "rinka") then
				v.ai4 = 2;
			end
			v.msg = "";
		end
		v.animationTimer = 0;
		if(v.ai5 > 0) then v.ai5 = v.ai5 - 1; end
		
		local frameAdd = 0;
		if(v.ai5 > 0) then frameAdd = 2; else frameAdd = math.floor(hammerBroFrameTimer / 16); end
		if(v.direction == DIR_RIGHT) then frameAdd = frameAdd + 3; end
		
		v.animationFrame = (v.ai4 * 6) + frameAdd;
		
		for k1,v1 in pairs(NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)) do
			if(v1.id == 30 and v1.ai1 == 0) then
				v.ai5 = 16;
				if(v.ai4 == 0) then
					v1.ai1 = 1;
				else
					v1.id = broIds[v.ai4];
				end
			end
		end
	end
	hammerBroFrameTimer = (hammerBroFrameTimer + 1) % 32;
end
Maybe when drawImageToScene gets priorities within SMBX-drawn things I'll make a better version, but this'll do for now.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Dec 10, 2015 12:41 am

Cool about the birdo egg it's working to kill Npcs now :D Nice :P
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)

TheSaturnyoshi
Monty Mole
Monty Mole
Posts: 108
Joined: Tue Dec 01, 2015 9:46 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TheSaturnyoshi » Thu Dec 10, 2015 11:38 am

lotus006 wrote:Cool about the birdo egg it's working to kill Npcs now :D Nice :P
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
Easy, set its x and y speeds.
However, if you want to be able to place it in the level, I would suggest using a system like Henry Richard's, using the NPC's message to determine the direction.

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Thu Dec 10, 2015 6:52 pm

TheSaturnyoshi wrote:
lotus006 wrote:Cool about the birdo egg it's working to kill Npcs now :D Nice :P
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
Easy, set its x and y speeds.
However, if you want to be able to place it in the level, I would suggest using a system like Henry Richard's, using the NPC's message to determine the direction.
One thing to note is that if you want to make it move diagonally at the same speed it moves horizontally/vertically, you'll probably want to use some basic trigonometry. This works okay:

Code: Select all

		local angle = 45;
		local length = 4;

		v.speedX = math.sin(angle * (math.pi / 180)) * length;
		v.speedY = math.cos(angle * (math.pi / 180)) * length;
...where angle is the angle (big surprise), length is the speed it moves, and v is the NPC.

EDIT: What's the best way to add animation frames to the player? I could use Graphics.drawImageToScene, but that makes the player render in front of everything, which is bad.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Dec 10, 2015 11:02 pm

HenryRichard wrote:
TheSaturnyoshi wrote:
lotus006 wrote:Cool about the birdo egg it's working to kill Npcs now :D Nice :P
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
Easy, set its x and y speeds.
However, if you want to be able to place it in the level, I would suggest using a system like Henry Richard's, using the NPC's message to determine the direction.
One thing to note is that if you want to make it move diagonally at the same speed it moves horizontally/vertically, you'll probably want to use some basic trigonometry. This works okay:

Code: Select all

		local angle = 45;
		local length = 4;

		v.speedX = math.sin(angle * (math.pi / 180)) * length;
		v.speedY = math.cos(angle * (math.pi / 180)) * length;
...where angle is the angle (big surprise), length is the speed it moves, and v is the NPC.

EDIT: What's the best way to add animation frames to the player? I could use Graphics.drawImageToScene, but that makes the player render in front of everything, which is bad.
Thanks for both, I will check soon :) sorry for the late reply

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Fri Dec 11, 2015 2:49 pm

LOL thnx again guys @HenryRichard & @ TheSaturnyoshi for the help ! ;) :P

Now I have my Spread S powerups in SMBX !!! haha , I love to much LunaLua !!
But when to much bullets the game slow too much, I think is because about colliders api on my bullets
need to find a way without this !


HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Fri Dec 11, 2015 7:31 pm

I found a bug: If you replace an effect with a .png, it doesn't automatically resize.

Willhart
Banned
Posts: 368
Joined: Thu Apr 10, 2014 2:18 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Willhart » Fri Dec 11, 2015 7:57 pm

HenryRichard wrote:I found a bug: If you replace an effect with a .png, it doesn't automatically resize.
That happens with some backgrounds too, especially when they are larger than original. I remember that placing a mask gif file of correct size should work as a temporary fix. It will tell the size of the sprite to the editor, but also be overridden by the png's graphics.

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Fri Dec 11, 2015 9:55 pm

Willhart wrote:That happens with some backgrounds too, especially when they are larger than original. I remember that placing a mask gif file of correct size should work as a temporary fix. It will tell the size of the sprite to the editor, but also be overridden by the png's graphics.
I guess I could do that if I had to.

I'm still wondering about adding more frames to a character - It'd be weird if my Kirby playable didn't open his mouth when he inhaled.

Destiny
Volcano Lotus
Volcano Lotus
Posts: 572
Joined: Tue Apr 22, 2014 2:40 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Destiny » Sat Dec 12, 2015 8:53 am

So, I'm having an issue.
Always when I install LunaLua, I can run it normally, but only one single time. After that, if I try to run it, I always get this error:

"Instruction at 0x7295efa8 referenced memory at 0x514100dd. The memory could not be read."

I know it may be due to my PC being old, but I just wanna know why.

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sat Dec 12, 2015 12:18 pm

Looks like an issue with the vb6 virtual machine. Which OS do you use?

Destiny
Volcano Lotus
Volcano Lotus
Posts: 572
Joined: Tue Apr 22, 2014 2:40 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Destiny » Sat Dec 12, 2015 12:40 pm

Kevsoft wrote:Looks like an issue with the vb6 virtual machine. Which OS do you use?
Win XP. I can't upgrade it due to not having the specs to install the others.

Kevsoft
Ripper II
Ripper II
Posts: 375
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Sat Dec 12, 2015 12:58 pm

Which Service Pack? Newer ones may include newer version of the vb6 virtual machine.

Also "only one single time": Do you mean only one single time after reboot, or one single time after installation?

Destiny
Volcano Lotus
Volcano Lotus
Posts: 572
Joined: Tue Apr 22, 2014 2:40 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Destiny » Sat Dec 12, 2015 1:04 pm

Kevsoft wrote:Which Service Pack? Newer ones may include newer version of the vb6 virtual machine.
Service Pack 3.
Kevsoft wrote:Also "only one single time": Do you mean only one single time after reboot, or one single time after installation?
I mean, I was able to open it multiple times, but after a short period of time, the error started appearing.

ShadowStarX
Bronze Yoshi Egg
Bronze Yoshi Egg
Posts: 1750
Joined: Mon Jan 27, 2014 7:21 am
Pronouns: he/him
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby ShadowStarX » Sun Dec 20, 2015 12:18 pm

Guys, can I get the script for vertical wrap? (basically if you fall down on the bottom you'll continue falling on the top)
Thanks.

Lukas Old Account
Snifit
Snifit
Posts: 227
Joined: Sat Mar 28, 2015 3:01 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Lukas Old Account » Sun Dec 20, 2015 2:00 pm

Welp, kind of stuck writing a lua code. I tried to but ofcourse i failed. So i wanted to ask here;
"Is there by any chance a way to let rinka or volcano lotus spawn their fireballs in circles? Just wondering..."

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9865
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Sun Dec 20, 2015 3:23 pm

ShadowStarX wrote:Guys, can I get the script for vertical wrap? (basically if you fall down on the bottom you'll continue falling on the top)
Thanks.
From Level 1 in Halloween Hypnosis:
http://hastebin.com/anemeketas.lua

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Sun Dec 20, 2015 3:36 pm

I'd advise using this modification, as it will work with both players.

Code: Select all

function onLoop()
        -- set up for section 4
	NPCs = NPC.get({--[[table of npcs you want to wrap]]}, 3)
	for i=1,table.getn(bobombx) do
		if (bobombx[i].y >= -140000) then
			bobombx[i].y = -140632
		end
	end
	if (player.section == 3 and player.y > -139950) then
		player.y = -140666
	end
	if(player2) then
		if (player2.section == 3 and player2.y > -139950) then
			player2.y = -140666
		end
	end
end

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Dec 20, 2015 3:56 pm

I found this also on talkhaus I recently used it and worked perfectly, but maybe need modification for all players also , enjoy :D

Code: Select all

function onLoop()
   local sectBottom = player.sectionObj.boundary.bottom
   local sectTop = player.sectionObj.boundary.top

   if (player.speedY > 0) then
      if (player.y > sectBottom) then
         --bottom to top
         player.y = sectTop - 48
      end
   elseif (player.speedY < 0) then
      if (player.y < sectTop - 48) then
         --top to bottom
         player.y = sectBottom
      end
   end
end


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 4 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari