Need help with lua? - LunaLua General Help

This is the place for discussion and support for LunaLua and related modifications and libraries.
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?
User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1205
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Tue May 31, 2016 2:57 am

Quantumenace wrote:Thanks! I saw that blend option in particles but I couldn't tell how it was supposed to work just from the script. The default particle textures don't work correctly with it because the actual color is all white.
They do work correctly. The reason they're white is because that allows the emitter colour values to set the colour of the particle correctly. It is important to note that, when using additive particles, you should keep the alpha channel of your colourings at 0, because otherwise you will get an alpha blend.
Quantumenace wrote:Also, the "split" function in particles.lua writes to the global variable "i" instead of a local one. Is that intended? I had inconsistent bugs with other things because I accidentally was reading from that, and if it was nil the problem would have been obvious right away.
Hmm, that looks like an oversight on my part.

User avatar
zlaker
Ludwig von Koopa
Ludwig von Koopa
Posts: 2827
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?
ImageImageImageImageImageImageImageImageImageImage
I make art lol

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8425
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » 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)
The ABC of Creation
________________________________________________________
Image

User avatar
RhysOwens
Lakitu
Lakitu
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.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8425
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » 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
The ABC of Creation
________________________________________________________
Image

User avatar
RhysOwens
Lakitu
Lakitu
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.

User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2846
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.
Jesus is my savior.

User avatar
underFlo
Mario
Mario
Posts: 4481
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Current Project: actually nothing i lied to you
Chat Username: underFlo
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)
im a girl yo

User avatar
RhysOwens
Lakitu
Lakitu
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.

User avatar
h2643
Ludwig von Koopa
Ludwig von Koopa
Posts: 2896
Joined: Sat Dec 21, 2013 7:23 am
Flair: Украинец
Current Project: RL
Chat Username: h/hnumbers

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
Koopa Troopa
Koopa Troopa
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: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
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
Spiny
Spiny
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?

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8425
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » 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.
The ABC of Creation
________________________________________________________
Image

User avatar
WerewolfGD
Wart
Wart
Posts: 3265
Joined: Tue Dec 02, 2014 2:28 am
Flair: Legalize Awooo!
Current Project: Howling
Chat Username: Alagirez
Contact:

Re: Need help with lua? - LunaLua General Help

Postby WerewolfGD » 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)
Yea... I'm back, but with different view.

Known also as Camacho or Harvey36Dice.
Also a furry

Image
Awooo!
If you want to talk with me, go here : Alagirez#2056

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
Spiny
Spiny
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
Pokey
Pokey
Posts: 229
Joined: Sat Mar 28, 2015 3:01 pm
Current Project: Expedition Neon

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?
bye

S1eth
Spiny
Spiny
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.

User avatar
RhysOwens
Lakitu
Lakitu
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.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests