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?
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9886
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Thu Nov 01, 2018 5:56 pm
MarioRPGExpert93 wrote: ↑Thu Nov 01, 2018 4:14 pm
I have the sprites from the Fire Flower form, the Ice Flower form, and Hammer Suit forms have frames of the player throwing fireballs/iceballs/hammers while moving, jumping, falling, & swimming*. How do i use the .lua script to display the different sprite frames of the throwing frames while moving. :?:
Take a look at this chart:
http://i.imgur.com/1dnW3g3.png
If you overlay your spritesheet with this, you can find out the index of all different frames for your character.
There's a mem offset in the player class which uses these indices to display the appropriate player frame. You want to set it to the number you need during the appropriate frames:
Code: Select all player:mem(0x114, FIELD_WORD, myFrame)
When this is is something you need to determine for yourself. What I suggest in your situation is to perform a check for whether the player's frame index is equal to one of the standard fireball throwing frames and set it accordingly based on that:
Code: Select all local vanillaFrame = player:mem(0x114, FIELD_WORD)
if vanillaFrame == 12 then
if (falling) then
--set frame
elseif (runnig) then
--set frame
...etc
end
end
|
|
|
|
|
|
|
|
|
-
FireyPaperMario
- Toad

- Posts: 6206
- Joined: Sat Sep 27, 2014 1:39 pm
- Flair: 90's kid born in late 1993 ^_^"
- Pronouns: He/Him
-
Contact:
Postby FireyPaperMario » Thu Nov 01, 2018 6:04 pm
Okay, I'll go test it out, thanks
|
|
|
|
|
|
|
|
|
-
Daring Tombstone
- Blooper

- Posts: 160
- Joined: Mon Aug 28, 2017 10:57 pm
- Flair: What? Not 1000 posts? That means I suck right?
Postby Daring Tombstone » Fri Nov 02, 2018 2:38 pm
This script doesn't do what I want it to.
Code: Select all
function onTick()
local Air = BGO.get({137})
for k,v in pairs(Air) do
if player.x + player.width >= v.x and player.x <= v.x + 32 and player.y + player.height >= v.y and player.y <= v.y + 32 and not v.layer.isHidden then
collidesWithData = true
break
end
end
if collidesWithData then
AirofPlayer1 = 100
end
end
I added this in the LsBreathMeter API in an attempt to give the player air back when swimming through background bubbles but it doesn't work.
I tried using onNPCKill with bubbles but I have them on a generator. When the bubble gets offscreen it dies and registers as a kill. At the very least is there a way to make it where the onNPCKill only triggers if the player collects the bubble? I don't mind using an NPC bubble instead of a background bubble.
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Fri Nov 02, 2018 10:12 pm
Is that the right BGO ID? The regular bubble is 173. Otherwise it seems to work, though you should set collidesWithData to false beforehand or make it local.
Been thinking about picking up powerups lately too. The memory offset 0x122 gets set to true for powerups that get picked up by the player and will be destroyed next tick. It also applies in other cases like destroying an enemy with a spinjump. I wonder if there will be an event for picking up a powerup in the next beta, that could be useful.
|
|
|
|
|
|
|
|
|
-
Daring Tombstone
- Blooper

- Posts: 160
- Joined: Mon Aug 28, 2017 10:57 pm
- Flair: What? Not 1000 posts? That means I suck right?
Postby Daring Tombstone » Fri Nov 02, 2018 11:30 pm
I resprited the BGO 137 into some background bubbles but used the BGO 173 bubble to test it. The script works like it's supposed to because I can replace "AirofPlayer1" to "Defines.gravity" and when I enter the bubble gravity changes properly. For some reason though I can't set the "AirofPlayer1" in the same manner.
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Sat Nov 03, 2018 12:20 am
It works if I print a debug message while in the bubble. I can't tell what else would be wrong with "AirofPlayer1" without seeing the rest of your code. How is the value behaving?
|
|
|
|
|
|
|
|
|
-
Daring Tombstone
- Blooper

- Posts: 160
- Joined: Mon Aug 28, 2017 10:57 pm
- Flair: What? Not 1000 posts? That means I suck right?
Postby Daring Tombstone » Sat Nov 03, 2018 12:31 am
The value of "AirofPlayer1" doesn't change at all. It'd be a wall of text if I pasted the whole script here, but I'm editing the LsBreathMeter API that's in the beta 3 version. The info I gave earlier is basically just added in that API.
But I found a workaround involving respriting a turnip into a bubble instead of respriting an axe and making it where if you collide with a turnip(bubble) it dies. Putting that on onNPCKill to give air back gives me results I'm satisfied with. Appreciate the effort to help though.
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Sat Nov 03, 2018 12:42 am
Oh, I think it was just a capitalization error. It's AirOfPlayer1 but you had AirofPlayer1.
|
|
|
|
|
|
|
|
|
-
Daring Tombstone
- Blooper

- Posts: 160
- Joined: Mon Aug 28, 2017 10:57 pm
- Flair: What? Not 1000 posts? That means I suck right?
Postby Daring Tombstone » Sat Nov 03, 2018 1:16 am
Wow yeah that was it. Just a capitalization error. But now the AirOfPlayer1 is stuck at 100.
Probably just gonna do that workaround I mentioned earlier. Seems like too much trouble at this point.
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Sat Nov 03, 2018 9:34 pm
Can I use colliders.lua or something to make circular collision (player-collision)? If so, can I make it so I can slide on it, too?
On a separate note, could I add a conveyor-belt effect to something?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sun Nov 04, 2018 1:44 am
Colliders aren't intended in general to be used as a replacement for solid objects, they act more as trigger fields so trying to do get solid circular objects in that would be an immense amount of work.
In the case of the conveyor belt I'd be very surprised if there was a good way to simulate conveyor belt effects to a block/NPC so I'd honestly recommend just retaining them, or reskinning them to invisible and having a series of different BGOs to overlay on top which is what I generally do for cases like these
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9886
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sun Nov 04, 2018 11:15 am
Setting the speedX value of a block will cause the player and npcs to slide across it at that speed, like how they would if the block were moving on a layer.
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Sun Nov 04, 2018 8:58 pm
PixelPest wrote: ↑Sun Nov 04, 2018 1:44 am
Colliders aren't intended in general to be used as a replacement for solid objects, they act more as trigger fields so trying to do get solid circular objects in that would be an immense amount of work.
In the case of the conveyor belt I'd be very surprised if there was a good way to simulate conveyor belt effects to a block/NPC so I'd honestly recommend just retaining them, or reskinning them to invisible and having a series of different BGOs to overlay on top which is what I generally do for cases like these
The problem is, I need to have conveyor slopes. Or a conveyor-solid circle collider.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9886
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Mon Nov 05, 2018 1:05 am
For the former just read my post above yours.
For the latter please enjoy reprogramming collision from scratch. (Doing that is also a requirement for making an accurate Sonic playable and is what has been keeping people away from making one)
|
|
|
|
|
|
|
|
|
-
Daring Tombstone
- Blooper

- Posts: 160
- Joined: Mon Aug 28, 2017 10:57 pm
- Flair: What? Not 1000 posts? That means I suck right?
Postby Daring Tombstone » Tue Nov 06, 2018 2:54 pm
Sorry for this dumb question but I looked and couldn't find it. What's the default "Defines.player_walkspeed and runspeed" numbers? It's for a water current script I'm trying to do.
Edit: Nevermind I found it, should have looked for a few more minutes longer. Runspeed is 6 and walkspeed is 3.
So I won't waste a post, is there a way I can kill particle effects without using effect:KillParticles? KillParticles is just sudden, can I make it where the particles just fade away instead?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Tue Nov 06, 2018 4:04 pm
Daring Tombstone wrote: ↑Tue Nov 06, 2018 2:54 pm
Sorry for this dumb question but I looked and couldn't find it. What's the default "Defines.player_walkspeed and runspeed" numbers? It's for a water current script I'm trying to do.
Edit: Nevermind I found it, should have looked for a few more minutes longer. Runspeed is 6 and walkspeed is 3.
So I won't waste a post, is there a way I can kill particle effects without using effect:KillParticles? KillParticles is just sudden, can I make it where the particles just fade away instead?
You just stop emitting them but continue to draw the particles
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9886
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Tue Nov 06, 2018 5:16 pm
Daring Tombstone wrote: ↑Tue Nov 06, 2018 2:54 pm
So I won't waste a post, is there a way I can kill particle effects without using effect:KillParticles? KillParticles is just sudden, can I make it where the particles just fade away instead?
Emitters have an "enabled" flag. Set that to false to stop automatic particle emission.
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Wed Nov 07, 2018 5:13 pm
How to have a plain black texture?
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9886
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Nov 07, 2018 5:47 pm
Notxarb wrote: ↑Wed Nov 07, 2018 5:13 pm
How to have a plain black texture?
Code: Select all local left,top,right,bottom
local shouldRenderToScene
local renderPrio
Graphics.glDraw{
vertexCoords={left,top,right,top,right,bottom,left,bottom},
primitive=Graphics.GL_TRIANGLE_FAN,
sceneCoords=shouldRenderToScene,
color={0,0,0,1},
priority=renderPrio
}
Replace the variables and you're set. No texture needed.
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Wed Nov 07, 2018 6:19 pm
Enjl wrote: ↑Wed Nov 07, 2018 5:47 pm
Notxarb wrote: ↑Wed Nov 07, 2018 5:13 pm
How to have a plain black texture?
Code: Select all local left,top,right,bottom
local shouldRenderToScene
local renderPrio
Graphics.glDraw{
vertexCoords={left,top,right,top,right,bottom,left,bottom},
primitive=Graphics.GL_TRIANGLE_FAN,
sceneCoords=shouldRenderToScene,
color={0,0,0,1},
priority=renderPrio
}
Replace the variables and you're set. No texture needed.
I have absolutely no idea how imagic or drawing graphics works, but I tried to replace the texture with the color property and I got white instead.
Code:
Code: Select all overlays[k] = imagic.Circle
{
radius = r,
x = playerCenterX,
y = playerCenterY,
scene = true,
color={0,0,0,1},
filltype = imagic.TEX_FILL,
texoffsetX = (centerOnScreenX - 400)/800,
texoffsetY = (centerOnScreenY - 300)/600
}
overlays[k]:Draw(VE_PRIORITY[k] + .1, 0xffffffff)
Not sure if there's anymore relevant code I need to include.
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 3 guests
|