Page 2 of 2

Re: LunaDLL - Help thread & Function Examples -

Posted: Thu Jan 08, 2015 6:15 am
by DarkShadeX
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

Re: LunaDLL - Help thread & Function Examples -

Posted: Thu Jan 08, 2015 6:49 am
by Squishy Rex
Alright I'll give that a go. Thanks.

Re: LunaDLL - Help thread & Function Examples -

Posted: Thu Jan 08, 2015 7:58 am
by DarkShadeX
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

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 12:35 am
by Squishy Rex
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. :)

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 10:08 am
by DarkShadeX
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.

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 12:52 pm
by Destiny
It's possible add footstep sounds with LunaLua?

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 1:01 pm
by Wohlstand
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

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 1:04 pm
by DarkShadeX
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.

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 1:54 pm
by Destiny
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?

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 2:10 pm
by DarkShadeX
In the folder where the gfx is located.
Also:
YOURLEVELNAME.lvl/YOURLEVELNAME

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

Re: LunaDLL - Help thread & Function Examples -

Posted: Fri Jan 09, 2015 10:48 pm
by Wohlstand
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 *

Re: LunaDLL - Help thread & Function Examples -

Posted: Sat Aug 15, 2015 1:31 pm
by ivanmegafanboy
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

Re: LunaDLL - Help thread & Function Examples -

Posted: Sat Aug 15, 2015 2:14 pm
by Kevsoft
For such specific stuff you need to go deeper into LunaLua. There is no such "simple code" for that.

Re: LunaDLL - Help thread & Function Examples -

Posted: Sun Aug 16, 2015 3:40 pm
by ivanmegafanboy
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?

Re: LunaDLL - Help thread & Function Examples -

Posted: Sun Aug 16, 2015 4:51 pm
by Kevsoft
Yes, I am the creator of LunaLua.
Here you can find more information http://engine.wohlnet.ru/pgewiki/Category:LunaLua_API

Re: LunaDLL - Help thread & Function Examples -

Posted: Tue Aug 18, 2015 11:36 am
by ivanmegafanboy
Thanks