smw centralirc.cat.biopge project

happy birthday talkhaus!!!

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

I'm unsure what I'm doing wrong?
Do I not have the latest version of colliders?

Code: Select all

local colliders = loadAPI("colliders");
 
function onLoop()
	if (colliders.collideBlock(player,1)) then
		player.speedY = -10
	end
end
Image

User avatar
Hoeloe
One of them Lua people
Posts: 822
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

7NameSam wrote:I'm unsure what I'm doing wrong?
Do I not have the latest version of colliders?

Code: Select all

local colliders = loadAPI("colliders");
 
function onLoop()
	if (colliders.collideBlock(player,1)) then
		player.speedY = -10
	end
end
What's happening that's wrong? This should push the player up when they touch a block with ID 1.
Image
Image
Image
Image

User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

Hoeloe wrote:
7NameSam wrote:I'm unsure what I'm doing wrong?
Do I not have the latest version of colliders?

Code: Select all

local colliders = loadAPI("colliders");
 
function onLoop()
	if (colliders.collideBlock(player,1)) then
		player.speedY = -10
	end
end
What's happening that's wrong? This should push the player up when they touch a block with ID 1.
Nothing happens if I touch the block,
Attachments
WONTWORK2.gif
WONTWORK2.gif (106.74 KiB) Viewed 1259 times
Image

S1eth
Posts: 285
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby S1eth » 1 year ago

7NameSam wrote:
Hoeloe wrote:
7NameSam wrote:I'm unsure what I'm doing wrong?
Do I not have the latest version of colliders?

Code: Select all

local colliders = loadAPI("colliders");
 
function onLoop()
	if (colliders.collideBlock(player,1)) then
		player.speedY = -10
	end
end
What's happening that's wrong? This should push the player up when they touch a block with ID 1.
Nothing happens if I touch the block,
This code only does anything if you are inside the block rather than touching the block, for example if you use block id 447 (cloud, go through from below)
Image

User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

S1eth wrote: This code only does anything if you are inside the block rather than touching the block, for example if you use block id 447 (cloud, go through from below)
Oh, okay. is there any good way to check if you are touching a not-cloud block?
Image

cramps-man
Posts: 14
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby cramps-man » 1 year ago

If you cbf trying to figure out how to get colliders to work, then just use the block collidesWith method.

Code: Select all

function onLoop()
	for key, b in pairs(Block.get(1)) do
		if (b:collidesWith(player) ~= 0) then
			Text.print("FUCK", 0, 0)
			break
		end
	end
end
You can see what collidesWith() returns here
http://wohlsoft.ru/pgewiki/Block_%28class%29

Checking ~= 0 checks all 4 sides of the block for collision.

User avatar
HenryRichard
Not a licensed doctor or nurse.
Posts: 30
Joined: 1 year ago
Pronouns: he/him/overlord
Location: ok

Re: LunaDLL/LunaLUA help thread

Postby HenryRichard » 1 year ago

I can't seem to get paralX.lua to work. I'm using the demo level it comes with and the latest dev build of lua, and it doesn't do anything unless I add sections = {0} to the arguments list, and then I get this error:
Capture.PNG
Capture.PNG (12.83 KiB) Viewed 1210 times
What am I doing wrong?
Image

User avatar
Rednaxela
Maker of Shenanigans
Posts: 659
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Rednaxela » 1 year ago

HenryRichard wrote:What am I doing wrong?
On a hunch... could you post the "function paralX.onCameraUpdate" line, from your paralX.lua in the version of paralX.lua that you're using?

I have a hunch you're on an out of date version, with a very specific bug.
Currently LPing: Ys Origin

User avatar
HenryRichard
Not a licensed doctor or nurse.
Posts: 30
Joined: 1 year ago
Pronouns: he/him/overlord
Location: ok

Re: LunaDLL/LunaLUA help thread

Postby HenryRichard » 1 year ago

Rednaxela wrote:
HenryRichard wrote:What am I doing wrong?
On a hunch... could you post the "function paralX.onCameraUpdate" line, from your paralX.lua in the version of paralX.lua that you're using?

I have a hunch you're on an out of date version, with a very specific bug.

Code: Select all

function paralX.onCameraUpdate (eventObj, cameraIndex)
	updateCameraSections (cameraIndex)
	currentCamera = cameraIndex
	for k,v in pairs(indexedParallaxes) do
		v:draw (cameraIndex)
	end
end
I don't think that eventObj should be there...
Image

User avatar
Rednaxela
Maker of Shenanigans
Posts: 659
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Rednaxela » 1 year ago

HenryRichard wrote:I don't think that eventObj should be there...
No, that needs to be there.

Hmm... not sure what's... uhless... you're on an out of date version of lunadll without thinking you are. Other than that, something for Rocky to look into.
Currently LPing: Ys Origin

User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

I'm not sure where to put this, so I'm putting this here:

I downloaded the newest version of the A2XT base game off of the onedrive, and the raocow player character has some weird offset issues
Attachments
WONTWORK3.gif
WONTWORK3.gif (199.24 KiB) Viewed 1130 times
Image

User avatar
ztarwuff
What the heck is a flair and why am I being asked to write one for my profile?
Posts: 496
Joined: 4 years ago
Location: Within 2 miles of the Imperial Crypt of Napoleon III

Re: LunaDLL/LunaLUA help thread

Postby ztarwuff » 1 year ago

7NameSam wrote:I'm not sure where to put this, so I'm putting this here:

I downloaded the newest version of the A2XT base game off of the onedrive, and the raocow player character has some weird offset issues
It's the ini files that maintain's raocow's sprite hitbox. They're located in the Episode 2 folder, which means you need to download at least the ini files from the Episode 2 folder off OneDrive.
SAJewers wrote:*ping*
What was the reason the ini files couldn't be in the top level folder again?

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 153
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Wohlstand » 1 year ago

7NameSam wrote:I'm not sure where to put this, so I'm putting this here:

I downloaded the newest version of the A2XT base game off of the onedrive, and the raocow player character has some weird offset issues
So, that needed to add into lunaworld a loading of right INI-calibrations (even store Talkhaus specific lua libraries which are will work automatically)

User avatar
SAJewers
A2XT Guy
Posts: 1974
Joined: 5 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Postby SAJewers » 1 year ago

ztarwuff wrote:
7NameSam wrote:I'm not sure where to put this, so I'm putting this here:

I downloaded the newest version of the A2XT base game off of the onedrive, and the raocow player character has some weird offset issues
It's the ini files that maintain's raocow's sprite hitbox. They're located in the Episode 2 folder, which means you need to download at least the ini files from the Episode 2 folder off OneDrive.
SAJewers wrote:*ping*
What was the reason the ini files couldn't be in the top level folder again?
because they're programmed like npc-xx.txt files where you need to place them in the episode folder, but then also require lunaworld.txt.

Honestly we should probably just re-do those sheets so we don't require those ini files, or create some global lua thing so that we can put them in the top level folder.
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 153
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Wohlstand » 1 year ago

SAJewers wrote:
ztarwuff wrote:
7NameSam wrote:I'm not sure where to put this, so I'm putting this here:

I downloaded the newest version of the A2XT base game off of the onedrive, and the raocow player character has some weird offset issues
It's the ini files that maintain's raocow's sprite hitbox. They're located in the Episode 2 folder, which means you need to download at least the ini files from the Episode 2 folder off OneDrive.
SAJewers wrote:*ping*
What was the reason the ini files couldn't be in the top level folder again?
because they're programmed like npc-xx.txt files where you need to place them in the episode folder, but then also require lunaworld.txt.

Honestly we should probably just re-do those sheets so we don't require those ini files, or create some global lua thing so that we can put them in the top level folder.
I mean playable character calibration file (which includes offsets and metrics of playable character)

User avatar
Rednaxela
Maker of Shenanigans
Posts: 659
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Rednaxela » 1 year ago

SAJewers wrote:just re-do those sheets so we don't require those ini files
This is not really doable without changing large parts of the fundamental design of those sprites. Not only would the default hitbox size be odd with it, but many frames have significant features that rely on being able to draw above and left of the hitbox to a degree that is simply not possible with the default offset values.
SAJewers wrote:or create some global lua thing so that we can put them in the top level folder.
This however is very easy/doable.
Currently LPing: Ys Origin

User avatar
SAJewers
A2XT Guy
Posts: 1974
Joined: 5 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Postby SAJewers » 1 year ago

Rednaxela wrote:
SAJewers wrote:or create some global lua thing so that we can put them in the top level folder.
This however is very easy/doable.
If you could make that work with the npc-xx.txt files, that would be great too. That way I also won't have to deal with people having moonwalking furbas and whatnot.
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 153
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Wohlstand » 1 year ago

SAJewers wrote:
SAJewers wrote:or create some global lua thing so that we can put them in the top level folder.
This however is very easy/doable.
If you could make that work with the npc-xx.txt files, that would be great too. That way I also won't have to deal with people having moonwalking furbas and whatnot.[/quote]
Anyway, a good idea to add support of GLOBAL npc.txts which are will declare default set, and I think, I'll add the automatical loading of playable calibrations INI files too and current way via lua will be used to customize them in real time. What about global NPC.txt's to re-declare global properties, I'll tell that to others

User avatar
SAJewers
A2XT Guy
Posts: 1974
Joined: 5 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Postby SAJewers » 1 year ago

I'd still add a lunaglobal.lua file or whatever, since the code we we'll have in lunaworld.lua will be re-used in future episodes and backported to Ep1 and PTTS anyway, so you'd be eliminating redundancy a bit.
DO NOT PM ME ABOUT A SECOND MARIO BROS X. THING. I WILL NOT RESPOND TO PMs.
Image
Head over to the ASMBXT Forums and join the discssion, or submit levels!
Image
Image
Image

User avatar
Wohlstand
PGE and LunaLUA developer
Posts: 153
Joined: 3 years ago

Re: LunaDLL/LunaLUA help thread

Postby Wohlstand » 1 year ago

SAJewers wrote:I'd still add a lunaglobal.lua file or whatever, since the code we we'll have in lunaworld.lua will be re-used in future episodes and backported to Ep1 and PTTS anyway, so you'd be eliminating redundancy a bit.
Anyway, I'll make calibrations for Raocow now and I'll put them into onedrive, so, will be possible to use them

User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

I need help,
The data class "bums" is always 1 when I load the level

Code: Select all

local encrypt = API.load("encrypt")
local myData = encrypt.Data(Data.DATA_LEVEL, true)

if myData:get("bums") == nil then
	myData:set("bums",0)
	myData:save()
end

function onLoad()
	if myData:get("bums") == 1 and player.powerup == PLAYER_SMALL then
		player.powerup = PLAYER_BIG
	end
end

function onTick()
	Text.print(Defines.jumpheight_bounce,0,0)
	Text.print(myData:get("bums"),0,20)
	if myData:get("bums") == 1 then
		if player:mem(0x160,FIELD_WORD) > 20 then
			player:mem(0x160,FIELD_WORD,20)
		end
	end
	if myData:get("bums") == 1 then
		if player:mem(0xFA,FIELD_WORD) == -1 or player:mem(0xFC,FIELD_WORD) == -1 then
			Defines.gravity = 2
		else
			Defines.gravity = 12
		end
	else
		Defines.gravity = 12
	end
	if myData:get("bums") == 1 then
		Defines.jumpheight_bounce = 22
		Defines.jumpheight = 22
	else
		Defines.jumpheight_bounce = 20
		Defines.jumpheight = 20
	end
	if myData:get("bums") == 1 then
		for k,v in pairs(NPC.get(13,player.section)) do
			v:mem(0xF0,FIELD_DFLOAT,2)
		end
	end
	if myData:get("bums") == 1 then
		player:mem(0x12,FIELD_WORD,-1)
	else
		player:mem(0x12,FIELD_WORD,0)
	end
end

function onNPCKill(eventObj, killedNPC, killReason)
	if killedNPC.id == 13 and myData:get("bums") == 1 then
		Misc.doBombExplosion(killedNPC.x + 8, killedNPC.y + 8, 0)
		Misc.doBombExplosion(killedNPC.x + 8, killedNPC.y + 32, 0)
		Misc.doBombExplosion(killedNPC.x + 8, killedNPC.y - 16, 0)
		Misc.doBombExplosion(killedNPC.x + 32, killedNPC.y + 8, 0)
		Misc.doBombExplosion(killedNPC.x - 16, killedNPC.y + 8, 0)
	end
end

function onEvent(eventName)
	if eventName == "hit" and myData:get("bums") == 1 then
		myData:set("bums",0)
		myData:save(0)
	else
		myData:set("bums",1)
		myData:save(0)
	end
end
Image

S1eth
Posts: 285
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby S1eth » 1 year ago

7NameSam wrote:I need help,
The data class "bums" is always 1 when I load the level
Here's your problem

Code: Select all

function onEvent(eventName) -- is called with the "Level - Start" parameter value when you load the level
   if eventName == "hit" and myData:get("bums") == 1 then -- this evaluates to false
      myData:set("bums",0)
      myData:save(0)
   else -- so then, "bums" is set to 1 whenever any event happens that is not "hit"
      myData:set("bums",1) 
      myData:save(0)
   end
end
There are 3 default events for "Level - Start", "P Switch - Start", and "P Switch - End". All of these, and any new events you create will set "bums" to 1.
Image

User avatar
Holy
Posts: 92
Joined: 6 years ago

Re: LunaDLL/LunaLUA help thread

Postby Holy » 1 year ago

Anything special I need to do when adjusting the music volume? I'm trying to do something kinda like this:

Code: Select all

function onLoad()
	Audio.SeizeStream(-1)
end

function onLoadSection0()
	Audio.MusicOpen("beep.ogg")
	Audio.MusicPlay()
end

function onLoopSection1()
	Audio.MusicVolume = (40 + player.speedY)
end
and I'm gettin nothin

User avatar
Pyro
cutest girl 2023
Posts: 866
Joined: 2 years ago
Pronouns: she/her
Location: meow
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Pyro » 1 year ago

Holy wrote: function onLoopSection1()
Audio.MusicVolume = (40 + player.speedY)
end[/code]
and I'm gettin nothin
Seems as if you're treating it like a variable, when Audio.MusicVolume is a function. Try Audio.MusicVolume(40+player.speedY).
professional meme
Image
Image
Image
Image
Image

User avatar
Holy
Posts: 92
Joined: 6 years ago

Re: LunaDLL/LunaLUA help thread

Postby Holy » 1 year ago

Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.

Yup, that was it.


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 2 guests

cron