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?
|
|
|
|
-
Kevsoft
- Ripper II

- Posts: 375
- Joined: Sun Jul 27, 2014 8:03 am
Postby Kevsoft » Tue Feb 16, 2016 9:15 am
You define it where you write it.
|
|
|
|
|
|
|
|
|
-
Nat The Porcupine
- Monty Mole

- Posts: 123
- Joined: Tue Nov 10, 2015 2:55 pm
Postby Nat The Porcupine » Tue Feb 16, 2016 11:15 pm
Are there any other LunaLua 0.7.3 BETA users experiencing this issue with the SMB3 Overhaul API?
Before anybody asks, I checked, and there are no missing graphics. I also used the example level to test this whole thing out, so this being the result of improper setup is impossible. I've also tested both the version included with LunaLua 0.7.3 as well as the latest version from the actual forum post; the result is the same. Even a fresh reinstall of the LunaLua did not solve the issue. However, I did NOT test this in older versions of LunaLua.
What's really weird is that P-meter and Clock icon still render. In the case of the P-meter, only the red arrows and red letter "P" ever render. Furthermore, the red P-meter arrows bleed into the screen, so it still looks like it's full even after I've been standing still for awhile. I hope this is just a quick fix and not something that requires a fresh rewrite of the code...
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Wed Feb 17, 2016 1:31 am
@Nat The Porcupine
Yup I'm getting the same result I was thinking my self maybe it was because I fucked up the files when editing other lua
but apparently you got the same things.
try minimal Overhaul api you have the setup of the SMB Advance 4 but you dont have the blue hud rectangle just minimal stuff of the look
of SMB3 and it work fine. (probably something can conflict with his old code like place sprite something)
But I was recreating from strach few hud from alot of game with an menu hud who you can control want you want to toggle parts.
I have so far the SMB Advance 4 done SMB2 and a Mix of Zelda2 and Zelda 3 , but not sure when I will release it.
|
|
|
|
|
|
|
|
|
-
Nat The Porcupine
- Monty Mole

- Posts: 123
- Joined: Tue Nov 10, 2015 2:55 pm
Postby Nat The Porcupine » Wed Feb 17, 2016 6:28 am
@lotus006
Well, it's good to know I'm not the only one. Just thought it was weird that the api was included in the Beta in its current state. If this ends up working in older versions LunaLua, then it may actually be something wrong with the LunaLua Beta itself. I kind of believe that may be the root cause, but I don't know for sure.
EDIT: I just tested this in LunaLua 0.7.0.3 and it worked without issue. It looks like the Beta may be the root cause of the issue after all.
|
|
|
|
|
|
|
|
|
-
Ness-Wednesday
- Purple Yoshi Egg

- Posts: 1658
- Joined: Sun Jun 28, 2015 3:50 pm
- Flair: Diverse Scouts
- Pronouns: He/Him
Postby Ness-Wednesday » Wed Feb 17, 2016 11:12 am
Am I able to do the following things with peach?
Change Peach's attack via Tanooki suit to a projectile based attack and maker active in statue form?
And change her bomb attack to Link's sword attack?
I also wonder if I am able to make Peach spinjump without anyone else triggering her to do so?
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Feb 17, 2016 11:40 am
Yes, yes, yes. All you need for these are the player and npc class, and their offset pages on the wiki.
I'm assuming Peach's spinjump would work like the one Rednaxela made for Link.
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Fri Feb 19, 2016 1:19 am
I got a question about table , is there a way to get the last key in the table (i mean not the highest value the last value)
in example:
Code: Select all stuff= {
1 = cat,
5 = dog,
3 = red,
4 = green }
I need to get 4 in the result
thanks
|
|
|
|
|
|
|
|
|
-
underFlo
- Wart

- Posts: 4456
- Joined: Mon Jul 14, 2014 10:44 am
- Flair: sup im lesbiab
- Pronouns: They/She
-
Contact:
Postby underFlo » Fri Feb 19, 2016 1:33 am
Pretty sure that table's aren't saved in the order you create them and instead order them when they store them. Only idea would be to put {5, dog} where dog is and the key to 2 etc. so the keys you used are now just elemente of the inner table. That way, the keys to the elements can be ordered normally, and you'd access the last key with
I don't know what you're planning to do here, but of you wanna use a table to execute code for multiple elements, I'd really recommend for the keys to be in order. So that way, your table would be
Code: Select all stuff= {
{1, cat},
{5, dog},
{3, red},
{4, green}}
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Fri Feb 19, 2016 1:50 am
Spinda wrote:Pretty sure that table's aren't saved in the order you create them and instead order them when they store them. Only idea would be to put {5, dog} where dog is and the key to 2 etc. so the keys you used are now just elemente of the inner table. That way, the keys to the elements can be ordered normally, and you'd access the last key with
I don't know what you're planning to do here, but of you wanna use a table to execute code for multiple elements, I'd really recommend for the keys to be in order. So that way, your table would be
Code: Select all stuff= {
{1, cat},
{5, dog},
{3, red},
{4, green}}
oh thanks, dont worry I wont use this table its just to be in an example to make understand I wont want the value 5.
it's just because I wanna want to display stuff with Text.print like this
just to see how much block I'm trying to detect when I'm colliding it.
in that example under, this code will be ok ?
Code: Select all Text.print( tonumber(stuff[#stuff][1]) , 10 , 100 )
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Feb 20, 2016 11:46 am
Having a bit of an issue here with my bomb boo AI:
Code: Select all local bombboo = {}
function bombboo.onInitAPI()
registerEvent(bombboo, "onLoop", "onLoop", false)
end
function bombboo.onLoop()
tableOfBombBoos = NPC.get(43, -1);
end
function onKeyDown(keycode)
if (keycode == KEY_RUN) then
for _,v in pairs(NPC.get(43,player.section)) do
if NPC.getIntersecting(player.x,player.y,player.x + player.width,player.y + player.height) > 0 then
tableOfBombBoos[table.getn(tableOfBombBoos)].id = 137;
end
end
end
end
return bombboo
It doesn't do anything when I grab npc-43 (boo with grabside = 1), when it should transform into npc-137. Any ideas?
|
|
|
|
|
|
|
|
|
-
underFlo
- Wart

- Posts: 4456
- Joined: Mon Jul 14, 2014 10:44 am
- Flair: sup im lesbiab
- Pronouns: They/She
-
Contact:
Postby underFlo » Sat Feb 20, 2016 12:14 pm
You'd need to do v.id
What you're doing is transforming the last bomb boo into npc-137.
Also, why do you define tableOfBombBoos?
Also, you haven't registered the event "onKeyDown"
Also, you should just do the NPC.getIntersecting for loop, since there's no point in doing it twice.
Just do
Code: Select all for _, v in pairs(NPC.getIntersecting(what you put there)) do
if v.id == 43 then
v.id = 137
break
end
end
(The break is so only one bomb boo gets transformed)
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Feb 20, 2016 12:52 pm
Thanks Spinda.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Feb 20, 2016 4:58 pm
I found kind of an issue in Lua, when doing anything like this:
Code: Select all function onLoop()
for _,v in pairs(NPC.get(229,player.section)) do
if #Block.getIntersecting(v.x,v.y,v.x + v.width,v.y + v.height) > 0 then
v:kill(9)
end
end
end
If you have something happening too an NPC, block, etc., it is also affected by hidden objects. For example, in this code, when NPC 229 collides with a block, you kill the NPC without any effects. If you had an invisible layer, this would still be considered a collision and the NPC would randomly disappear.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sat Feb 20, 2016 5:04 pm
You can check for Layer.isHidden to circumvent this.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Sat Feb 20, 2016 5:05 pm
Enjl wrote:You can check for Layer.isHidden to circumvent this.
Thanks. Good to know.
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Sun Feb 21, 2016 2:36 am
I have just two small questions :
1. is there a way to get the images (icons) and show them with Graphics.drawImageWP from the editor but in game about the items, blocks, npcs, etc... ?
2. is it possible to have a picture and made it hide with transparency layer image ? (like clipping picture) with png ?
Thanks
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Tue Feb 23, 2016 6:48 am
Experimental NPC reference system. SMBX shuffles NPC addresses around between loops sometimes, which can cause incorrect references if you try to keep track of a specific NPC.
This assigns a unique key to the NPC using otherwise unused memory bytes. It would require referencing and destroying 4 billion NPCs for it to run out of keys. If the memory address is moved, the system will try to find the correct NPC and update the pointer.
Are there any obvious flaws? Also, if this is used in LoadSharedAPI, will everything still use the same nextkey variable correctly?
Code: Select all --NPC reference system can be used to store references to a specific NPC over multiple loops
--Uses normally unused offsets. For this to work, do not alter these memory offsets:
--0x64-65, generator type flag (don't change the NPC to/from a generator)
--0x6C-6F in non-generators (generator delay)
--0xE8-EB in generators (animation timer)
--NPCref takes the NPC pointer and returns a table containing a the pointer and a unique key
--NPCfromref takes the table and returns the NPC pointer
--If the NPC address is moved by SMBX between loops,
--the key will mismatch and the system will attempt to find the correct NPC
--NPCfromref will return nil if the NPC no longer exists. Ensure your code accounts for this.
local NPCrefsystem = {}
local nextkey = 1
function NPCref(NPCpointer)
local key = 0
local ref = {}
if NPCpointer:mem(0x64,FIELD_WORD) == 0 then
key = NPCpointer:mem(0x6C,FIELD_DWORD)
else
key = NPCpointer:mem(0xE8,FIELD_DWORD)
end
if key == 0 then
key = nextkey
if NPCpointer:mem(0x64,FIELD_WORD) == 0 then
NPCpointer:mem(0x6C,FIELD_DWORD,key)
else
NPCpointer:mem(0xE8,FIELD_DWORD,key)
end
nextkey = nextkey + 1
if nextkey == 2147483648 then nextkey = -2147483648 end
if nextkey == 0 then nextkey = 1 end
end
ref.pointer = NPCpointer; ref.key = key
return ref
end
function NPCfromref(ref)
local key = ref.key
local k
local n = ref.pointer
if key == nil then return nil end
if n ~= nil and not n.isValid then n = nil end
if n ~= nil then
if n:mem(0x64,FIELD_WORD) == 0 then
k = n:mem(0x6C,FIELD_DWORD)
else
k = n:mem(0xE8,FIELD_DWORD)
end
end
if n == nil or k ~= key then
for _,v in pairs(NPC.get(-1,-1)) do
if v:mem(0x64,FIELD_WORD) == 0 then
k = v:mem(0x6C,FIELD_DWORD)
else
k = v:mem(0xE8,FIELD_DWORD)
end
if k == key then n = v; ref.pointer = v; break end
end
end
if k == key then return n
else ref.pointer = nil; ref.key = nil; return nil
end
end
return NPCrefsystem
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Tue Feb 23, 2016 6:57 am
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Tue Feb 23, 2016 8:25 am
Okay, now I'm embarrassed.
Edit: Is there a simple way to detect if a simulated NPC would be hit and take damage from NPCs or explosions intersecting a collider area? I'm trying to make something that's a rotatable 64x32 rectangle, and my current method of using 3 dummy rippers appears to work well, but is there a better way?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Fri Feb 26, 2016 6:09 pm
Code: Select all local leveltimer = loadSharedAPI("leveltimer")
function onStart()
leveltimer.setSecondsLeft(200);
leveltimer.setTimerState(true);
end
function onLoop()
local seconds = leveltimer.getSecondsLeft()
if timetrialsactive == true then
if gold11 == true then
Graphics.drawImageWP(gold, 0, 0, 5)
end
if gold11 ~= true then
if sliver11 == true then
Graphics.drawImageWP(silver, 0, 0, 5)
end
if silver11 ~= true then
if bronze11 == true then
Graphics.drawImageWP(bronze, 0, 0, 5)
end
end
end
end
end
function onEvent(calledEvent)
if calledEvent == "Collected" then
if seconds == 175 then
if gold11active == true then
gold11 = true
gold11active = false
silver11active = false
bronze11active = false
Graphics.drawImageWP(gold, 0, 0, 5)
end
end
if seconds == 165 then
if silver11active == true then
silver11 = true
silver11active = false
bronze11active = false
Graphics.drawImageWP(silver, 0, 0, 5)
end
end
if seconds == 155 then
if bronze11active == true then
bronze11 = true
bronze11active = false
Graphics.drawImageWP(bronze, 0, 0, 5)
end
end
end
end
Where do I draw these images such that they appear in the top left hand corner of the screen when their criterias are met? Right now they just don't show up. (Don't worry, I already have variables defined in my lunaworld.lua for everything needed.)
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 1 guest
|