Need help with lua? - LunaLua General Help

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?
zlaker
Reznor
Reznor
Posts: 2844
Joined: Fri Dec 20, 2013 1:46 pm

Re: Need help with lua? - LunaLua General Help

Postby zlaker » Tue May 31, 2016 12:50 pm

Is there a way I can set the direction of an NPC like left or right?

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

Re: Need help with lua? - LunaLua General Help

Postby Emral » Tue May 31, 2016 12:55 pm

zlakergirl357 wrote:Is there a way I can set the direction of an NPC like left or right?
NPC.direction = (-1 for left, 1 for right)

RhysOwens
Nipper
Nipper
Posts: 423
Joined: Fri Apr 22, 2016 2:53 am

Re: Need help with lua? - LunaLua General Help

Postby RhysOwens » Sat Jun 11, 2016 4:28 am

How do I change the projectile that an NPC throws. You could do something like that easily in LunaDLL.

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

Re: Need help with lua? - LunaLua General Help

Postby Emral » Sat Jun 11, 2016 5:38 am

RhysOwens wrote:How do I change the projectile that an NPC throws. You could do something like that easily in LunaDLL.
The easy and lazy way to turn all NPC A into NPC B is:

Code: Select all

function onTick()
	local transform = NPC.get(npcID, section)
	for k,v in pairs(transform) do
		v.id = otherNPCID
	end
end

RhysOwens
Nipper
Nipper
Posts: 423
Joined: Fri Apr 22, 2016 2:53 am

Re: Need help with lua? - LunaLua General Help

Postby RhysOwens » Sat Jun 11, 2016 1:33 pm

This was my code:

Code: Select all

function onTick()
   local transform = NPC.get(87, 1)
   for k,v in pairs(transform) do
      v.id = 1
   end
end
I tried to make Bowser shoot Goombas instead of flames but he still shoots flames.

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

Re: Need help with lua? - LunaLua General Help

Postby HenryRichard » Sat Jun 11, 2016 1:41 pm

Change the 1 to -1.

underFlo
Wart
Wart
Posts: 4456
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Pronouns: They/She
Contact:

Re: Need help with lua? - LunaLua General Help

Postby underFlo » Sat Jun 11, 2016 2:00 pm

(That's the first 1 he's talking about btw)

RhysOwens
Nipper
Nipper
Posts: 423
Joined: Fri Apr 22, 2016 2:53 am

Re: Need help with lua? - LunaLua General Help

Postby RhysOwens » Sat Jun 11, 2016 4:38 pm

Spinda wrote:(That's the first 1 he's talking about btw)
Thanks dude, it now works. Now I made Bowser shoot Rinkas. Has anyone done that?
Update = How do you fix the fact that the sprites look wrong when they are thrown as a replacement?
And how can you make SMB1 Bowser not shoot flames at all? When I set NPC-87 replacement to 0 the flame appears for only a split-second.

h2643
Reznor
Reznor
Posts: 2890
Joined: Sat Dec 21, 2013 7:23 am
Contact:

Re: Need help with lua? - LunaLua General Help

Postby h2643 » Sun Jun 12, 2016 9:49 am

You might want to mess around with the Bowser AI.
http://wohlsoft.ru/pgewiki/SMBX_NPC_AI# ... ID:_200.29

Xirix
Bob-Omb
Bob-Omb
Posts: 20
Joined: Sun Jan 19, 2014 10:42 am

Re: Need help with lua? - LunaLua General Help

Postby Xirix » Tue Jun 14, 2016 7:49 am

Out of curiousity, has anyone made Horizontal moving Thwomps, or the ability to have Diagonal projectiles (Aka Mario 3 Cannons)? If not, where should I start about trying to code these myself?

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Tue Jun 14, 2016 8:27 am

Xirix wrote:Out of curiousity, has anyone made Horizontal moving Thwomps, or the ability to have Diagonal projectiles (Aka Mario 3 Cannons)? If not, where should I start about trying to code these myself?
Rednaxela used horizontal-moving "Maverick" Thwomps in a MaGLx2 level. Diagonal projectiles are much simpler and only involve making the values for NPC.speedX and NPC.speedY have the same absolute values

S1eth
Bot
Bot
Posts: 54
Joined: Sat Apr 23, 2016 10:44 am

Re: Need help with lua? - LunaLua General Help

Postby S1eth » Wed Jun 15, 2016 9:41 am

What is the undocumented glDraw argument "sceneCoords" and how do I use it?

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

Re: Need help with lua? - LunaLua General Help

Postby Emral » Wed Jun 15, 2016 10:49 am

S1eth wrote:What is the undocumented glDraw argument "sceneCoords" and how do I use it?
"sceneCoords = true" will set the coordinates for the verteces to be scene coordinates, rather than screen coordinates.

Alagirez
Ludwig von Koopa
Ludwig von Koopa
Posts: 3617
Joined: Tue Dec 02, 2014 2:28 am
Flair: Legalize Awooo!
Pronouns: He/Him/That wolf
Contact:

Re: Need help with lua? - LunaLua General Help

Postby Alagirez » Wed Jun 15, 2016 11:00 pm

Is that possible to make the player fly (with leaf, tanooki, etc (not a blue shoe lol)) without limit? (aka Infinite flying)

TheUNICORNTrap
Goomba
Goomba
Posts: 2
Joined: Sun Jun 12, 2016 7:23 pm

Re: Need help with lua? - LunaLua General Help

Postby TheUNICORNTrap » Wed Jun 15, 2016 11:18 pm

Hey I need to know if I can install this game for the mac. I am a new player and am interested in starting this out.

PLEASE reply thank you.

S1eth
Bot
Bot
Posts: 54
Joined: Sat Apr 23, 2016 10:44 am

Re: Need help with lua? - LunaLua General Help

Postby S1eth » Wed Jun 15, 2016 11:25 pm

Camacho wrote:Is that possible to make the player fly (with leaf, tanooki, etc (not a blue shoe lol)) without limit? (aka Infinite flying)
http://www.wohlsoft.ru/pgewiki/SMBX_Player_Offsets

This page has some helpful memory addresses. Scroll down to flight related adresses.

You can use "Flight time remaining" to make sure that it does not count down while you are flying. Set it with Player:mem() http://www.wohlsoft.ru/pgewiki/Player_(class)

You probably want to check for "isFlying" first, and if true, set the "flight time remaining" to a certain value.

.

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

Re: Need help with lua? - LunaLua General Help

Postby Lukas Old Account » Sat Jun 18, 2016 4:44 am

So ehm, anyone here knows how to make a code that there is red fog that becomes less transparent each time the player walks one screen further?

S1eth
Bot
Bot
Posts: 54
Joined: Sat Apr 23, 2016 10:44 am

Re: Need help with lua? - LunaLua General Help

Postby S1eth » Sat Jun 18, 2016 6:42 am

Lukas wrote:So ehm, anyone here knows how to make a code that there is red fog that becomes less transparent each time the player walks one screen further?
You will have two x coordinates in your level. The first one for when you want to start drawing fog, and the second one for when you want your fog to reach full opacity. (let's call them A and B)

So, you want to take the player's x (player.x) coordinate, or the player camera's x coordinate ( Camera.get()[1]x+Camera.get(){1].width ) and check if they are within your points A and B.

If you draw a single fog image, you can use Graphics.drawImageWP and set your opacity depending on the x coordinate difference of the player and point A/B.
http://wohlsoft.ru/pgewiki/LunaLua_glob ... _functions

If you want to use fog particles, look for: http://wohlsoft.ru/pgewiki/Particles.lua
Last edited by S1eth on Sat Jun 18, 2016 9:02 am, edited 1 time in total.

RhysOwens
Nipper
Nipper
Posts: 423
Joined: Fri Apr 22, 2016 2:53 am

Re: Need help with lua? - LunaLua General Help

Postby RhysOwens » Sat Jun 18, 2016 7:13 am

Okay, I've loaded the Level Timer API into my level but the new UI graphics don't appear. I've tried putting those graphics into my level's folder but nothing happened.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Sat Jun 18, 2016 7:31 am

RhysOwens wrote:Okay, I've loaded the Level Timer API into my level but the new UI graphics don't appear. I've tried putting those graphics into my level's folder but nothing happened.
Have you actually set the timer using setSecondsLeft() and setTimerState() ?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari