LunaDLL - Help thread & Function Examples -

General discussion about Super Mario Bros. X.

Moderator: Userbase Moderators

DarkShadeX
Volcano Lotus
Volcano Lotus
Posts: 535
Joined: Sat Jan 18, 2014 11:34 am

Re: LunaDLL - Help thread & Function Examples -

Postby DarkShadeX » Thu Jan 08, 2015 6:15 am

Squishy Rex wrote:Hey Darkshade, with the Gravitational and Jumping codes, is it possible while using them to disable normal jumping and make a player fall straight down when they run off the edge of a block like in Captain Toad: Treasure Tracker? I'm not overly familiar with these codes so any help would be appreciated. Thanks.
If you want the player to fall without moving, you gotta have to use lunalua and check if the player is falling, if so, set the xspeed to 0.If you want, i could try to make the code for you.

Edit:
Try if this works:

Code: Select all

function onLoop() 
 if(player.speedY >= 0.5) then
player.speedX = 0
end
 end

Squishy Rex
Kain
Kain
Posts: 1982
Joined: Sat Dec 21, 2013 4:30 am
Pronouns: he/him
Contact:

Re: LunaDLL - Help thread & Function Examples -

Postby Squishy Rex » Thu Jan 08, 2015 6:49 am

Alright I'll give that a go. Thanks.

DarkShadeX
Volcano Lotus
Volcano Lotus
Posts: 535
Joined: Sat Jan 18, 2014 11:34 am

Re: LunaDLL - Help thread & Function Examples -

Postby DarkShadeX » Thu Jan 08, 2015 7:58 am

Squishy Rex wrote:Alright I'll give that a go. Thanks.
Replace my old code with this one:

Code: Select all

function onLoop() 
 if( player.speedY >= 0 and player:mem(0x60, FIELD_WORD) == -1 ) then -- Check if YSPD is more than 0 and check if you jumped.
player.speedX = 0
end 
 if( player.speedY >= 0 )then -- If YSPD is more than 0,make the game think you jumped.
  player:mem(0x60, FIELD_WORD, -1)
 end end
With my old code,you couldn't walk on slopes anymore,the above code fixes it ; )
Feel free to edit speedY >= 0 with any other number until its perfect for you. (the higher the number,the more you can go left and right before you start to fall)

EDIT:
Even easier:

Code: Select all

function onLoop() 
 if( player.speedY >= 1 and player:mem(0x48, FIELD_WORD) <= 1 ) then -- Check if YSPD is more than 1 and check if you're not on a slope.
player.speedX = 0
end end

Squishy Rex
Kain
Kain
Posts: 1982
Joined: Sat Dec 21, 2013 4:30 am
Pronouns: he/him
Contact:

Re: LunaDLL - Help thread & Function Examples -

Postby Squishy Rex » Fri Jan 09, 2015 12:35 am

Alright thanks, I have to update LunaLua now, but once I do, I'll test the code and modify it to what I need. Thanks Darkshade. :)

DarkShadeX
Volcano Lotus
Volcano Lotus
Posts: 535
Joined: Sat Jan 18, 2014 11:34 am

Re: LunaDLL - Help thread & Function Examples -

Postby DarkShadeX » Fri Jan 09, 2015 10:08 am

Squishy Rex wrote:Alright thanks, I have to update LunaLua now, but once I do, I'll test the code and modify it to what I need. Thanks Darkshade. :)
No problem,if you need anything else,just pm me.

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

Re: LunaDLL - Help thread & Function Examples -

Postby Destiny » Fri Jan 09, 2015 12:52 pm

It's possible add footstep sounds with LunaLua?

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL - Help thread & Function Examples -

Postby Wohlstand » Fri Jan 09, 2015 1:01 pm

Kei wrote:It's possible add footstep sounds with LunaLua?
I think, yes:
You have to use:
Check is player on the ground:
Play sound if player on ground and speed != 0:
Delay between steps is 100/abs(speed)
Where 100 - special constant which you can edit to calibrate delay between foot steps

DarkShadeX
Volcano Lotus
Volcano Lotus
Posts: 535
Joined: Sat Jan 18, 2014 11:34 am

Re: LunaDLL - Help thread & Function Examples -

Postby DarkShadeX » Fri Jan 09, 2015 1:04 pm

Kei wrote:It's possible add footstep sounds with LunaLua?
Here:

Code: Select all

local step = 0
myPlayer = Player()
function onLoop()
 if( player.speedX >= 1 or player.speedX <= -1  and player.speedY == 0 )then
  step=step+1
 if (step == 25)then -- Adjust it if you want to play the sound earlier or later!
  step = 0
  playSFXSDL("footstep.ogg") 
 if ( player.speedX == 0 and step >= -1)then -- Reset the counter.
  step = 0
  clearSFXBuffer()
 end
  end
 end
end

function onJump(myPlayer)
 step = 0
 clearSFXBuffer()
end

function onJumpEnd(myPlayer)
 step = 0
 clearSFXBuffer()
end
You will need wohlstands SDL lunadll update.

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

Re: LunaDLL - Help thread & Function Examples -

Postby Destiny » Fri Jan 09, 2015 1:54 pm

DarkShadeX wrote:
Kei wrote:It's possible add footstep sounds with LunaLua?
Here:

Code: Select all

local step = 0
myPlayer = Player()
function onLoop()
 if( player.speedX >= 1 or player.speedX <= -1  and player.speedY == 0 )then
  step=step+1
 if (step == 25)then -- Adjust it if you want to play the sound earlier or later!
  step = 0
  playSFXSDL("footstep.ogg") 
 if ( player.speedX == 0 and step >= -1)then -- Reset the counter.
  step = 0
  clearSFXBuffer()
 end
  end
 end
end

function onJump(myPlayer)
 step = 0
 clearSFXBuffer()
end

function onJumpEnd(myPlayer)
 step = 0
 clearSFXBuffer()
end
You will need wohlstands SDL lunadll update.
I have the update.
I keep getting a message error when I walk (Null chunk I guess). Where I should put the ogg file?

DarkShadeX
Volcano Lotus
Volcano Lotus
Posts: 535
Joined: Sat Jan 18, 2014 11:34 am

Re: LunaDLL - Help thread & Function Examples -

Postby DarkShadeX » Fri Jan 09, 2015 2:10 pm

In the folder where the gfx is located.
Also:
YOURLEVELNAME.lvl/YOURLEVELNAME

Edit: also make sure the sound is sampled in 41000 hz
Last edited by DarkShadeX on Fri Jan 09, 2015 2:17 pm, edited 1 time in total.

Wohlstand
Chargin' Chuck
Chargin' Chuck
Posts: 2008
Joined: Tue Feb 11, 2014 4:44 pm
Flair: [ˈvoːlˌʃtant], 狐エンジニア
Pronouns: he/him
Contact:

Re: LunaDLL - Help thread & Function Examples -

Postby Wohlstand » Fri Jan 09, 2015 10:48 pm

DarkShadeX wrote:In the folder where the gfx is located.
Also:
YOURLEVELNAME.lvl/YOURLEVELNAME

Edit: also make sure the sound is sampled in 41000 hz
44100 Hz *

ivanmegafanboy
Flurry
Flurry
Posts: 175
Joined: Wed Aug 12, 2015 11:47 am

Re: LunaDLL - Help thread & Function Examples -

Postby ivanmegafanboy » Sat Aug 15, 2015 1:31 pm

Thaks for the post, is such a pleasure to found a Luna.dll topic in the forums, and the codes are very usefull, especially the gravity ones.

To anybody who knows about Luna:
I was wondering if:
There is a code to disable the tail swipe in the racoon power-up and instead, giving the player the ability to spawn a npc (in this case, a jigsaw) in the direction he's looking, and keep with hover and flying abilities?
And a code to change the direction where the enemies shoot their projectiles? For example: straigth up shooting snifits, or downwards shooting volcano lotus

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

Re: LunaDLL - Help thread & Function Examples -

Postby Kevsoft » Sat Aug 15, 2015 2:14 pm

For such specific stuff you need to go deeper into LunaLua. There is no such "simple code" for that.

ivanmegafanboy
Flurry
Flurry
Posts: 175
Joined: Wed Aug 12, 2015 11:47 am

Re: LunaDLL - Help thread & Function Examples -

Postby ivanmegafanboy » Sun Aug 16, 2015 3:40 pm

Kevsoft wrote:For such specific stuff you need to go deeper into LunaLua. There is no such "simple code" for that.
Alrigth, I need that, I tried to download it months ago, but I still don't understand the steps to follow.
You created it, don't you?

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

Re: LunaDLL - Help thread & Function Examples -

Postby Kevsoft » Sun Aug 16, 2015 4:51 pm

Yes, I am the creator of LunaLua.
Here you can find more information http://engine.wohlnet.ru/pgewiki/Category:LunaLua_API

ivanmegafanboy
Flurry
Flurry
Posts: 175
Joined: Wed Aug 12, 2015 11:47 am

Re: LunaDLL - Help thread & Function Examples -

Postby ivanmegafanboy » Tue Aug 18, 2015 11:36 am

Thanks


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari