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?
|
|
|
|
-
Yoshi021
- Gold Yoshi Egg

- Posts: 691
- Joined: Thu Jan 21, 2016 9:06 pm
- Flair: :)
- Pronouns: He/Him
Postby Yoshi021 » Tue Oct 18, 2016 11:40 pm
Ghostly_Guy wrote:
Code: Select all function onLoop()
if player:mem(PC+0x154, FIELD_WORD) == 87 then
player:mem(PC+0x154,FIELD_WORD) = 17;
end
end
When you want to set an offset you do this
player:mem(0x154,FIELD_WORD,17)
|
|
|
|
|
|
|
|
|
-
Ghostly_Guy
- Bot

- Posts: 55
- Joined: Thu Jun 11, 2015 10:46 pm
Postby Ghostly_Guy » Wed Oct 19, 2016 1:06 am
Ghostly_Guy wrote:
Code: Select all function onLoop()
if player:mem(PC+0x154, FIELD_WORD) == 87 then
player:mem(PC+0x154,FIELD_WORD) = 17;
end
end
PixelPest wrote:It's not PC+0x154, just 0x154. Also use onTick() instead of onLoop(); the latter is deprecated
Yoshi021 wrote:
When you want to set an offset you do this
player:mem(0x154,FIELD_WORD,17)
I made the edits, but I couldn't get the NPC to change.
My original idea was to let the player pick up the bowser fireballs, which would turn into bullet bills in their hands. This was a horrible idea, and I rethought it.
I looked around on this thread, and I found a way to change the NPC Bowser fires. Here's the new code, plagiarized straight from page 26:
Code: Select all function onTick()
local transform = NPC.get(87, -1)
for k,v in pairs(transform) do
v.id = 17
end
end
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Wed Oct 19, 2016 2:42 am
Ghostly_Guy wrote:
Code: Select all function onTick()
local transform = NPC.get(87, -1)
for k,v in pairs(transform) do
v.id = 17
end
end
When transforming NPCs from one to another, it's safer to import the "classExpander" library using API.load, and then use:
This will transform one NPC to another, but also account for inconsistencies that can occur.
|
|
|
|
|
|
|
|
|
-
Amine Retro
- Purple Yoshi Egg

- Posts: 520
- Joined: Mon Oct 10, 2016 7:20 am
Postby Amine Retro » Fri Oct 21, 2016 5:44 pm
what the heck are you talking about? my SMBX 2.0 is totally normal!
works perfectly, especially in the invasion 2 link ear rape! invasion 3!
screenshot of totally fine SMBX ver. 2.0

see? fine!
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Fri Oct 21, 2016 5:55 pm
I love it!
|
|
|
|
|
|
|
|
|
-
Amine Retro
- Purple Yoshi Egg

- Posts: 520
- Joined: Mon Oct 10, 2016 7:20 am
Postby Amine Retro » Fri Oct 21, 2016 6:04 pm
i know right?
i really liked the invasion 3, it should be featured as a default SMBX episode.
Last edited by Amine Retro on Sun Nov 13, 2016 5:33 am, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
Drachenbauer
- Blooper

- Posts: 174
- Joined: Sun Sep 13, 2015 3:24 pm
Postby Drachenbauer » Sat Nov 12, 2016 12:41 pm
Hello
If i trx to open the smbx.exe in the folder "LunaLUA_0.7.3-beta_smbxluna_sfx_mus_full" there comes two errors, that the files "MSVCP140.dll" and "VCRUNTIME140.dll" are missing.
What can i do to make it working?
|
|
|
|
|
|
|
|
|
-
loop
- Ninji

- Posts: 984
- Joined: Sun Apr 17, 2016 5:56 pm
- Flair: i may be dumb but im not stupid!
- Pronouns: he/him/they
Postby loop » Sat Nov 12, 2016 1:04 pm
Drachenbauer wrote:Hello
If i trx to open the smbx.exe in the folder "LunaLUA_0.7.3-beta_smbxluna_sfx_mus_full" there comes two errors, that the files "MSVCP140.dll" and "VCRUNTIME140.dll" are missing.
What can i do to make it working?
Run vcredist.exe.
|
|
|
|
|
|
|
|
|
-
Drachenbauer
- Blooper

- Posts: 174
- Joined: Sun Sep 13, 2015 3:24 pm
Postby Drachenbauer » Sat Nov 12, 2016 1:41 pm
now the smbx works.
now there cane an runtime error and it closed...
i tryed toopen a level, what´s placed in the "Worlds" folder (i copyed my own world there) of SMBX 2.
|
|
|
|
|
|
|
|
|
-
RPG_Magician
- Snifit

- Posts: 216
- Joined: Tue Sep 06, 2016 7:22 am
Postby RPG_Magician » Sat Nov 12, 2016 10:44 pm
Trying to make my playable lose all momentum and dropping straight down when I do Down-Stab.
function onInputUpdate()
if(player.downKeyPressing) then
player.downKeyPressing = true;
player.leftKeyPressing = false;
player.rightKeyPressing = false;
end
end
Something something terrible code.
Yeah it's simple code. Also I'm trying to get the momentum to stop after sprinting. Any tips?
|
|
|
|
|
|
|
|
|
-
Yoshi021
- Gold Yoshi Egg

- Posts: 691
- Joined: Thu Jan 21, 2016 9:06 pm
- Flair: :)
- Pronouns: He/Him
Postby Yoshi021 » Sat Nov 12, 2016 11:50 pm
You can use player.speedY and player.speedX to change the player's speed.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sun Nov 13, 2016 6:33 am
That code won't work because you're only cancelling button presses, which means that although the player can't gain any more momentum, they don't lose it either. Try:
Code: Select all function onTick()
if (player.downKeyPressing) and (player:mem(0x146, FIELD_WORD) ~= 2) and (player.character == 5) then --if Link is pressing down while in the air
player.speedX = 0; --stop the player's horizontal motion
end
end
|
|
|
|
|
|
|
|
|
-
RPG_Magician
- Snifit

- Posts: 216
- Joined: Tue Sep 06, 2016 7:22 am
Postby RPG_Magician » Mon Nov 14, 2016 12:07 am
PixelPest wrote:That code won't work because you're only cancelling button presses, which means that although the player can't gain any more momentum, they don't lose it either. Try:
Code: Select all function onTick()
if (player.downKeyPressing) and (player:mem(0x146, FIELD_WORD) ~= 2) and (player.character == 5) then --if Link is pressing down while in the air
player.speedX = 0; --stop the player's horizontal motion
end
end
Oh thank you! It works nicely, (I still have a long way to go with lunalua....)
|
|
|
|
|
|
|
|
|
-
Angelus
- Tweeter

- Posts: 132
- Joined: Tue Jun 21, 2016 9:38 am
Postby Angelus » Fri Nov 25, 2016 7:46 am
Is there any code which disables the run feature but maintain the grab/fireball ones? Because as far as I can tell these three abilities share the same key, so by disabling one I'll be disabling everything... I was able to do it but as said before, I just want to disable the run feature and nothing else. Is that even possible?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Nov 25, 2016 7:58 am
Yes. It would basically be something like this:
Code: Select all function onTick()
if player.speedX > 3 then
player.speedX = 3;
elseif player.speedX < -3 then
player.speedX = -3;
end
end
This should work most of the time. Exceptions would be moving layers and the conveyor belts. Also, different characters have different run speeds so the code above would likely only work for Mario.
Also, I'm not 100% sure that Mario's run speed is 3, however you can check by doing the following first before what I posted towards the top:
Code: Select all function onTick()
Text.print(player.speedX, 0, 0);
end
Then just hold the right or left button (without the run button) and see what that speed is after it stops going up.
I might look at writing a better script later today that allows for different characters, moving layers, conveyor belts, etc. to work too
|
|
|
|
|
|
|
|
|
-
Angelus
- Tweeter

- Posts: 132
- Joined: Tue Jun 21, 2016 9:38 am
Postby Angelus » Fri Nov 25, 2016 8:47 am
That's great to know, thank you very much!
By the way, I've managed to find Peach's speed, which is 2.7900000214577. While Toad's speed is totally random, it keeps going back and forth but I believe it's something around 3.1.
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Sat Nov 26, 2016 7:22 am
Why do this code crash SMBX...
Code: Select all while mask_X + 28 >= player.x - 96 or mask_X <= player.x + 128 do
mask_X = rng.randomInt(-139230, -139998)
end
...but this code does not???
Code: Select all while mask_X == player.x do
mask_X = rng.randomInt(-139230, -139998)
end
PS. it's included into onTick() function.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Nov 26, 2016 8:23 am
Please post the whole code (including the onTick() event and variables) and post exactly what the error message says
|
|
|
|
|
|
|
|
|
-
DeMuZ
- Fighter Fly

- Posts: 37
- Joined: Thu Aug 18, 2016 2:35 pm
Postby DeMuZ » Sat Nov 26, 2016 8:29 am
Code: Select all --APIs
local colliders = API.load("colliders")
local rng = API.load("rng")
local encrypt = API.load("encrypt")
--boss1 variables
local boss1_hp = 10
local boss1_time = 0
--boss2 variables
local boss2_hp = 10
--boss3 variables
local boss3_hp = 10
local boss3_time = 0
local mask_X = 0
local mask_Y = 0
--other variables
local boss_cooldown = 0
bossData = encrypt.Data(Data.DATA_WORLD,true)
for x = 1, 2 do
if bossData:get(tostring(x)) == nil then
bossData:set(tostring(x), 0)
bossData:save()
end
end
--block beaten bosses
function onLoad()
for x = 1, 11 do
if mem(0x00B251E0, FIELD_WORD) == x then
triggerEvent("boss"..tostring(x).." - defeat")
end
end
end
--boss1 main function
function onLoopSection1()
--if boss is still alive
if boss1_hp > 0 then
Text.print("HP: "..boss1_hp.."/10", 8, 8)
goombaSpawner()
end
for k,v in pairs(NPC.get(71, -1)) do
v.drawOnlyMask = false
if boss1_hp < 1 then
v:kill()
elseif colliders.bounce(player, v) then
if boss_cooldown == 0 then
colliders.bounceResponse(player, 3)
boss1_hp = boss1_hp - 1
boss_cooldown = 65 * 2
else
player:harm()
end
elseif colliders.collide(player, v) then
player:harm()
end
if boss_cooldown > 0 and boss1_hp > 0 and boss_cooldown % 20 > 9 then
v.drawOnlyMask = true
end
end
if boss_cooldown > 0 then
boss_cooldown = boss_cooldown - 1
end
end
--boss1 spawner function
function goombaSpawner()
if boss1_time == 0 then
goomba = NPC.spawn(1, rng.randomInt(-179744, -179488), -180616, player.section)
boss1_time = 100
end
for k,v in pairs(NPC.get(1, -1)) do
if v.speedY == 0 then
if v.x < player.x - 8 and v.speedX < 0 then
v.speedX = - v.speedX
elseif v.x > player.x + 8 and v.speedX > 0 then
v.speedX = - v.speedX
end
end
end
boss1_time = boss1_time - 1
end
--boss2 main function
function onLoopSection2()
--if boss is still alive
if boss2_hp > 0 then
Text.print("HP: "..boss2_hp.."/10", 8, 8)
chasingThwomp()
end
for k,v in pairs(NPC.get(180, 2)) do
v.drawOnlyMask = false
if boss2_hp < 1 then
v:kill()
elseif colliders.bounce(player, v) then
if boss_cooldown == 0 and player:mem(0x50, FIELD_WORD) == -1 then
colliders.bounceResponse(player, 3)
else
player:harm()
end
elseif colliders.collide(player, v) then
player:harm()
end
--red bricks
for k2,v2 in pairs(NPC.get(45, 2)) do
if colliders.bounce(v, v2) then
v2:kill()
boss_cooldown = 65 * 2
boss2_hp = boss2_hp - 1
end
end
--bricks
for k2,v3 in pairs(NPC.get(159, 2)) do
if colliders.bounce(v, v3) then
v3:kill()
end
end
if boss_cooldown > 0 and boss2_hp > 0 and boss_cooldown % 20 > 9 then
v.drawOnlyMask = true
end
end
if boss_cooldown > 0 then
boss_cooldown = boss_cooldown - 1
end
end
--boss2 behaviour function
function chasingThwomp()
for k,v in pairs(NPC.get(180, 2)) do
if v.ai1 ~= 2 and v.ai1 ~= 3 and boss_cooldown == 0 then
if v.ai1 ~= 0 then
if v.x + 48 < player.x then
v.speedX = 1.0
elseif v.x > player.x + 32 then
v.speedX = - 1.0
end
else
if v.x + 48 < player.x then
v.speedX = 1.5
elseif v.x > player.x + 32 then
v.speedX = - 1.5
end
end
else
v.speedX = 0
end
if boss_cooldown > 0 then
v.speedY = 0
end
end
end
--boss3 main function
function onLoopSection3()
if boss3_hp > 0 then
Text.print("HP: "..boss3_hp.."/10", 8, 8)
maskSpawner()
end
for k,v in pairs(BGO.get(150)) do
if boss_cooldown > 65 then
--???
end
--???
end
if boss_cooldown > 0 then
boss_cooldown = boss_cooldown - 1
end
end
--boss3 spawner function
function maskSpawner()
mask_X = 0
mask_Y = 0
if boss3_time == 0 then
while mask_X + 28 >= player.x - 96 or mask_X <= player.x + 128 do
mask_X = rng.randomInt(-139230, -139998)
end
while mask_Y == player.y do
mask_Y = rng.randomInt(-140608, -140032)
end
NPC.spawn(210, mask_X, mask_Y, player.section)
boss3_time = 100
end
boss3_time = boss3_time - 1
end
--onNPCKill function
function onNPCKill(eventObj, npcObj, npcKillReason)
--boss1 defeat
if npcObj.id == 71 then
star1 = NPC.spawn(196, -179616, -180640, player.section)
star1.speedY = 5.5
playSFX(21)
playMusic(16)
end
--boss2 defeat
if npcObj.id == 180 then
NPC.spawn(26, -159616, -160416, player.section)
star2 = NPC.spawn(196, -159616, -160640, player.section)
star2.speedY = 5.5
playSFX(21)
playMusic(16)
end
--boss3 defeat
--when star is taken
if npcObj.id == 196 then
triggerEvent("boss"..tostring(player.section).." - defeat")
end
end
line 206, in function maskSpawner()
There's no error. SMBX just crashes when I enter the section where it is called. 
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Nov 26, 2016 8:37 am
I'd suggest that the while loop is possibly running infinitely. Try replacing it with an if statement both times it appears in maskSpawner()
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 3 guests
|