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?
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Mon Aug 08, 2016 7:39 am
Enchlore wrote:When trying to start SMBX with LunaLua I get this error message:
Here are my computer specs:
I tried to search the forums if anyone provided a solution but didn't find anything.
it's happening often to me, I forgot always to activate the peripherical sound, it's probably deactivated on your side, try first to plug headset to see if change !
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Mon Aug 08, 2016 10:04 am
there's probably leftover semicolons somewhere in smbx\sounds.ini
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Thu Aug 18, 2016 2:50 pm
I was trying to write custom api code which would add hp system for player (do not read the code if you don't want to get cancer).
I wrote this code but it doesn't seem to work...
Code: Select all --HP System (by DeMuZ)---
---------------------------------------
local demuz_hp_system = {}
local max_hp = 3
local hurt = 0
local mushrooms = NPC.get(9,-1)
local encrypt = loadSharedAPI("encrypt")
hpData = encrypt.Data(Data.DATA_WORLD,true)
---------------------------------------------------------------------------------
function demuz_hp_system.onInitAPI()
registerEvent(demuz_hp_system,"onStart","onStart")
registerEvent(demuz_hp_system,"onTick","showHP")
end
function demuz_hp_system.setAmmount(value)
if value > 0 then
max_hp = value
end
end
function demuz_hp_system.onStart()
if hpData:get("hp") == nil or hpData:get("hp") == 0 then
hpData:set("hp",1)
hpData:save()
end
end
function demuz_hp_system.showHP()
Text.print("HP:",0,16)
Text.print(hpData:get("hp"),64,16)
if player:mem(0x13E, FIELD_WORD) > 0 and hurt == 0 then
hpData:set("hp",0)
hpData:save()
hurt = -1
end
if hurt == 0 then
if player:mem(0x122, FIELD_WORD) == 2 then
hpData:set("hp",hpData:get("hp")-1)
hpData:save()
hurt = 1
if player.powerup == PLAYER_SMALL and hpData:get("hp") > 1 then
player.powerup = PLAYER_BIG
end
end
???
end
if player:mem(0x122, FIELD_WORD) ~= 2 and hurt == 1 then
hurt = 0
end
end
return demuz_hp_system
I don't know how to make hpData rise while getting a mushroom if the player is already big.
Would anyone consider helping me? 
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Thu Aug 18, 2016 4:09 pm
DeMuZ wrote:I was trying to write custom api code which would add hp system for player (do not read the code if you don't want to get cancer).
I don't know how to make hpData rise while getting a mushroom if the player is already big.
Would anyone consider helping me? 
I would suggest taking a look at HUD of Time, it's a library that adds extra health and rerenders the HUD of certain characters.
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Thu Aug 18, 2016 4:39 pm
Hoeloe wrote:I would suggest taking a look at HUD of Time, it's a library that adds extra health and rerenders the HUD of certain characters.
I would like to make a hp system for Mario/Luigi and HUDofTime.lua seems to work only with Link.
If I can't create that with HUDofTime.lua, the only thing I need is to make "trigger lua code by getting a mushroom even if the player is big" 
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Thu Aug 18, 2016 4:45 pm
Yes, but take a look at what it does and see if you can apply it to what you're trying to do
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Fri Aug 19, 2016 12:19 pm
PixelPest wrote:Yes, but take a look at what it does and see if you can apply it to what you're trying to do
HUDofTime.lua uses SMBX hearth system to check if it should increase or decrease the ammount of player's hp variable, so it's only possible to use this code for Toad, Peach and Link.
I would like to apply hp variable system to Mario/Luigi, too. :/
EDIT: I think i can make it with onNPCKill() function but I don't know how to use it. I always get this error:
http://imgur.com/kXghMtE
|
|
|
|
|
|
|
|
|
-
Kevsoft
- Ripper II

- Posts: 375
- Joined: Sun Jul 27, 2014 8:03 am
Postby Kevsoft » Fri Aug 19, 2016 12:57 pm
Can you post the code (or the code snippet) at line 38?
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Fri Aug 19, 2016 12:59 pm
Kevsoft wrote:Can you post the code (or the code snippet) at line 38?
Code: Select all function demuz_hp_system.onNPCKill(<i don't know what to put here>,NPC.get(9,-1),9)
|
|
|
|
|
|
|
|
|
-
Kevsoft
- Ripper II

- Posts: 375
- Joined: Sun Jul 27, 2014 8:03 am
Postby Kevsoft » Fri Aug 19, 2016 1:26 pm
Yea... classical misunderstanding. So the thing is that events will pass you already defined values. You have to name those arguments a specific names.
So
Code: Select all function someAPI.onNPCKill(eventObj, npcObj, npcKillReason)
if npcObj.id == 9 and npcKillReason == 9 then
<do your stuff here>
end
end
is the correct code.
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Fri Aug 19, 2016 1:53 pm
Thank you for help!
EDIT: Why is this code not working? Player falls under the screen when he gets hit.
Code: Select all function demuz_hp_system.showHP() --onTick
(...)
if hpData:get("hp") > 1 and player.powerup ~= PLAYER_BIG then
player.powerup = PLAYER_BIG
end
(...)
end
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Fri Aug 19, 2016 4:44 pm
DOUBLE POST
notice me (any) senpai :>
I wanna finish my episode before September. 
|
|
|
|
|
|
|
|
|
-
Yoshi021
- Gold Yoshi Egg

- Posts: 691
- Joined: Thu Jan 21, 2016 9:06 pm
- Flair: :)
- Pronouns: He/Him
Postby Yoshi021 » Fri Aug 19, 2016 5:01 pm
Try having this offset activate whenever the player gets hurt.
player:mem(0x122,FIELD_WORD,12)
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Aug 19, 2016 5:06 pm
Yoshi021 wrote:Try having this offset activate whenever the player gets hurt.
player:mem(0x122,FIELD_WORD,12)
So what's your issue? You can check if player:mem(0x122, FIELD_WORD) == 2 (player is powering down) if that's what you're wondering, but I really don't know what exactly you're asking
Last edited by PixelPest on Fri Aug 19, 2016 5:09 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Fri Aug 19, 2016 5:07 pm
DeMuZ wrote:Thank you for help! :)
EDIT: Why is this code not working? Player falls under the screen when he gets hit.
Code: Select all function demuz_hp_system.showHP() --onTick
(...)
if hpData:get("hp") > 1 and player.powerup ~= PLAYER_BIG then
player.powerup = PLAYER_BIG
end
(...)
end
The player's hitbox changes because it loads the hitboxes for small mario. Since the hitbox's origin is at the top of the player, they get gradually pushed downward with each back-and-forth.
You need to offset the player by the difference and make sure to reset offset 0x122
http://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
Yoshi021 wrote:Try having this offset activate whenever the player gets hurt.
player:mem(0x122,FIELD_WORD,12)
When the player gets hurt, 0x122 gets set to 2. Setting that state to 12 will NOT give the player a hammer suit, btw.
PixelPest wrote:Yoshi021 wrote:Try having this offset activate whenever the player gets hurt.
player:mem(0x122,FIELD_WORD,12)
So what's your issue? You can check if player:mem(0x114, FIELD_WORD) == 2 (player is powering down) if that's what you're wondering, but I really don't know what exactly you're asking
No. No. No. No. No. No. No. No. No. No. No.
0x114 is the displayed sprite index. Do NOT check for 0x114 in this scenario.
|
|
|
|
|
|
|
|
|
-
Valtteri
- Birdo

- Posts: 2150
- Joined: Sun Dec 01, 2013 1:16 pm
Postby Valtteri » Fri Aug 19, 2016 5:07 pm
DeMuZ wrote:DOUBLE POST
Don't do this.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Aug 19, 2016 5:10 pm
Oops. I meant 0x122. Just didn't have the documentation open and mixed them up
|
|
|
|
|
|
|
|
|
-
Yoshi021
- Gold Yoshi Egg

- Posts: 691
- Joined: Thu Jan 21, 2016 9:06 pm
- Flair: :)
- Pronouns: He/Him
Postby Yoshi021 » Fri Aug 19, 2016 5:14 pm
Enjl wrote:
When the player gets hurt, 0x122 gets set to 2. Setting that state to 12 will NOT give the player a hammer suit, btw.
No, I used to have the same error that DeMuZ had where the player will move under blocks when you get hurt, but by having the Hammer Suit effect happen when the player gets hurt fixes the error. My intention was never to give the player the hammer suit.
Last edited by Yoshi021 on Fri Aug 19, 2016 5:26 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Fri Aug 19, 2016 5:18 pm
Adding this code actually helped!
Thank you for helping me! Now, with more hp, Mario will be happy! 
|
|
|
|
|
|
|
|
|
-
Nessquik
- Shy Guy

- Posts: 6
- Joined: Sun Jun 22, 2014 12:00 am
Postby Nessquik » Wed Aug 24, 2016 6:26 pm
Is CaptureBuffer no longer a function or something? I keep getting a nil value every time I try to call it:
The code is literally just: local buf = Graphics.CaptureBuffer(800, 600)
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 4 guests
|