Lineguide.lua (Layer Attachment Now Works!)

This is the place for discussion and support for LunaLua and related modifications and libraries.
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?
User avatar
Sambo
Blooper
Blooper
Posts: 190
Joined: Fri Jan 24, 2014 6:43 pm
Current Project: SMBX2, Mario & the 7 Orbs

Re: Lineguide.lua (Alternate Graphics Added)

Postby Sambo » Sat Apr 08, 2017 3:51 pm

Clearly, if it isn't working. I can't help you if you don't show me your code.

User avatar
Electriking
Posts: 4485
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Current Project: Something
Chat Username: ElectriKing
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Electriking » Sat Apr 08, 2017 3:59 pm

Sambo wrote:Clearly, if it isn't working. I can't help you if you don't show me your code.
It is the same code that was on the PGE wiki

local lineguide = API.load("lineguide")

Is there anything else I am supposed to add. I made sure the line BGOs are the default ones (same ID as from the included GFX pack).
SMM2 ID: JJF-P7G-FSF

User avatar
Sambo
Blooper
Blooper
Posts: 190
Joined: Fri Jan 24, 2014 6:43 pm
Current Project: SMBX2, Mario & the 7 Orbs

Re: Lineguide.lua (Alternate Graphics Added)

Postby Sambo » Sat Apr 08, 2017 4:01 pm

King of Eterity wrote:
Sambo wrote:Clearly, if it isn't working. I can't help you if you don't show me your code.
It is the same code that was on the PGE wiki

local lineguide = API.load("lineguide")

Is there anything else I am supposed to add. I made sure the line BGOs are the default ones (same ID as from the included GFX pack).
Nope, that should be all you need.
RudeGuy07 wrote:hey, sorry for bumping this topic, but i don't understand what to put in the lua file when you rename some bgos, and the page in the wiki doesn't say much about this. i've tried writing something like this:

Code: Select all

local lineHorizontal = 95;
but it doesn't work.

Code: Select all

lineguide.lineHorizontal = 95
Sorry, I missed your post. Whenever using a function or accessing a variable in an API, you generally put the name of it before that variable/function.

User avatar
Electriking
Posts: 4485
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Current Project: Something
Chat Username: ElectriKing
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Electriking » Sat Apr 08, 2017 4:04 pm

Sambo wrote:
King of Eterity wrote:
Sambo wrote:Clearly, if it isn't working. I can't help you if you don't show me your code.
It is the same code that was on the PGE wiki

local lineguide = API.load("lineguide")

Is there anything else I am supposed to add. I made sure the line BGOs are the default ones (same ID as from the included GFX pack).
Nope, that should be all you need.
Is there anything else that I could have done wrong outside the code? Are SMB3 platforms linked by default (which I thought they should be)
SMM2 ID: JJF-P7G-FSF

Westretroman
Nipper Plant
Nipper Plant
Posts: 704
Joined: Tue Mar 29, 2016 6:50 pm

Re: Lineguide.lua

Postby Westretroman » Sun Apr 09, 2017 9:57 am

King of Eterity wrote:
Westretroman wrote:
Sambo wrote: It is. Horikawa is adding it.

No problem. I enjoyed making this (except for the occasional hard-to-fix bug).

Added white and dotted lines to the graphics folder (the black ones are still included).
It went from just a cool experiment to being put in 2.0, this will be really useful for my episode!
You can already download it if you weren't aware of that already.
Actually​ I was aware of that, I just said it was a cool experiment because of how unique it was compared to the basic lines that SMBX had.

User avatar
Electriking
Posts: 4485
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Current Project: Something
Chat Username: ElectriKing
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Electriking » Sun Apr 09, 2017 11:29 am

OK, I have got the thing working. Realized that I incorrectly named the .lua file. But there is a bug:
Image
When the platform moves upwards an into this curve, instead of continuing around the curve, it just stops and freaks out.

Going up with these is also buggy:
Image
The platform falls to the right instead of going up and left like it should

And this:
Image
Basically a combination of the above 2. Stops, causes Mario to fall through, platform freaks out and then falls to the right.

The smaller curve, gentle slope and 90 angle works fine going up but the platform stops and freaks out when going the other way.
SMM2 ID: JJF-P7G-FSF

User avatar
timocomsmbx2345
Ninji
Ninji
Posts: 826
Joined: Sat Feb 06, 2016 1:44 pm
Current Project: i dont even know anymore. . . .
Chat Username: same as my username
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby timocomsmbx2345 » Fri Apr 14, 2017 4:58 pm

how do you get npcs to attach to the lines?
SMBX 2.0 β4 is here!!! How about 2.0 β5?
ImageImage
Image
Meepyglobix wrote:DON'T SAY "38A??". OR I'll SHOOT YOU.
Spoiler: show
Image Thanks Pixelpest!!!!
Image
Image

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby PixelPest » Fri Apr 14, 2017 5:05 pm

timocomsmbx2345 wrote:how do you get npcs to attach to the lines?
Did you read the documentation? It's linked in the OP

User avatar
timocomsmbx2345
Ninji
Ninji
Posts: 826
Joined: Sat Feb 06, 2016 1:44 pm
Current Project: i dont even know anymore. . . .
Chat Username: same as my username
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby timocomsmbx2345 » Fri Apr 14, 2017 6:35 pm

PixelPest wrote:
timocomsmbx2345 wrote:how do you get npcs to attach to the lines?
Did you read the documentation? It's linked in the OP
well, can i at least have an example?
never mind, i got the skull rafts to attach to the lines. jk, i need an example
come on i need an example so i cn do anything besised the colored blocks, because when i tried, i get a dumb error 9in retirurn!
and no one even respnded
Sambo wrote:Clearly, if it isn't working. I can't help you if you don't show me your code.
Well, All i did was insert the id of the skull raft, and nothing happened. . . .
Last edited by JupiHornet on Thu Apr 20, 2017 3:31 pm, edited 1 time in total.
Reason: merged quadruple post ;-;
SMBX 2.0 β4 is here!!! How about 2.0 β5?
ImageImage
Image
Meepyglobix wrote:DON'T SAY "38A??". OR I'll SHOOT YOU.
Spoiler: show
Image Thanks Pixelpest!!!!
Image
Image

User avatar
Rhosty
Ludwig von Koopa
Ludwig von Koopa
Posts: 2526
Joined: Sun Dec 11, 2016 8:02 pm
Flair: squid kid
Current Project: waiting on nintendo switch
Chat Username: Koopastea #8422

Re: Lineguide.lua (Alternate Graphics Added)

Postby Rhosty » Fri Apr 14, 2017 9:37 pm

timocomsmbx2345 wrote:and no one even respnded
People have other things to do rn, give them some time and somebody who knows how to fix your problem might come and help.

User avatar
Sambo
Blooper
Blooper
Posts: 190
Joined: Fri Jan 24, 2014 6:43 pm
Current Project: SMBX2, Mario & the 7 Orbs

Re: Lineguide.lua (Alternate Graphics Added)

Postby Sambo » Thu Apr 20, 2017 12:33 am

timocomsmbx2345 wrote:
Sambo wrote:Clearly, if it isn't working. I can't help you if you don't show me your code.
Well, All i did was insert the id of the skull raft, and nothing happened. . . .
When did you do it? You have to add the ID outside of all your functions, or in onStart.
Can I see your code?

BTW, skull rafts will attach automatically in 2.0.
King of Eterity wrote: ... bugs ...
I can't reproduce this. I tested all the curves you showed me and they worked. Are you doing something weird like overlapping them?

User avatar
Mosaic
Ludwig von Koopa
Ludwig von Koopa
Posts: 2850
Joined: Fri Feb 27, 2015 8:07 pm
Flair: All has a reason behind it, even if it's tough.
Current Project: The Mosaic Group's Journey, Toad's SMB Adventure, Mosaic Adventures and Other Secret Projects?
Chat Username: Mosaic
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Mosaic » Tue May 09, 2017 10:29 pm

Excuse me, but what code do you put in to allow other things to be attached to the lines?

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.
And Here's The Proof
My Rainbow Of Levels
Mosaic's Museum(My Discord Server, where I update on my streams, writing, and anything else I may be up to.

Cancelled...but not forgotten...
Image

Image

Danny wrote:Here's some constructive criticism: What the hell.
Witchking wrote:Approved!

Discord Quotes: show
Image


PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby PixelPest » Tue May 09, 2017 10:31 pm

"Other things" is pretty vague. If you mean NPCs it explains on the documentation.

Also btw Bubbles don't work with lineguides

User avatar
Mosaic
Ludwig von Koopa
Ludwig von Koopa
Posts: 2850
Joined: Fri Feb 27, 2015 8:07 pm
Flair: All has a reason behind it, even if it's tough.
Current Project: The Mosaic Group's Journey, Toad's SMB Adventure, Mosaic Adventures and Other Secret Projects?
Chat Username: Mosaic
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Mosaic » Tue May 09, 2017 10:37 pm

I meant the npcs, yeah it explains, but is this correct?

Code: Select all

local lineguide = API.load("lineguide")
timerApi = loadAPI("leveltimer");
lineguide.lineNpcs[209]

function onLoad()
     timerApi.setSecondsLeft(600);
     timerApi.setTimerState(true);
end

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.
And Here's The Proof
My Rainbow Of Levels
Mosaic's Museum(My Discord Server, where I update on my streams, writing, and anything else I may be up to.

Cancelled...but not forgotten...
Image

Image

Danny wrote:Here's some constructive criticism: What the hell.
Witchking wrote:Approved!

Discord Quotes: show
Image


User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2846
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby HenryRichard » Wed May 10, 2017 11:38 am

I'm not to familiar with how this works but if you don't set lineguide.lineNpcs[209] equal to something nothing will happen. In fact, I don't think that's how it works at all - you'd do something more like lineguide.lineNpcs = {209}.
Jesus is my savior.

User avatar
Kira Yoshikage
Shy Guy
Shy Guy
Posts: 6
Joined: Fri May 12, 2017 8:45 am

Re: Lineguide.lua (Alternate Graphics Added)

Postby Kira Yoshikage » Sat May 27, 2017 4:19 am

Nice and very usefull Api! Everything works fine,except one thing that i can't make work.I'm trying to make Green Cheep Cheep's jump speed be 10,but i keep getting "attempt to index a nil value" error
Do i have any errors in my code?'Couse im bad at programming,maybe i don't see a simple error there:

Code: Select all

local lineguide = API.load("lineguide")

lineguide.lineNpcs = {229}

lineguide.properties[229].jumpSpeed = 10

TDK
Kamikaze Koopa
Kamikaze Koopa
Posts: 1384
Joined: Wed Nov 11, 2015 12:26 pm

Re: Lineguide.lua (Alternate Graphics Added)

Postby TDK » Sun May 28, 2017 3:13 pm

I was using lineguide.lua, and there's 2 errors I found. The first one is the motherbrain doesn't work with lineguides. The second is that, if you have goombas on the lineguides and you stomp on 2 at once, it causes an error. It says "Invalid access of pNPC reference"

User avatar
Mosaic
Ludwig von Koopa
Ludwig von Koopa
Posts: 2850
Joined: Fri Feb 27, 2015 8:07 pm
Flair: All has a reason behind it, even if it's tough.
Current Project: The Mosaic Group's Journey, Toad's SMB Adventure, Mosaic Adventures and Other Secret Projects?
Chat Username: Mosaic
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Mosaic » Tue Jun 06, 2017 11:57 am

I have another problem, i tried to attach dount blocks to lines, and i actually put the code in, but it doesn't work, how do i fix it?

Code: Select all

local lineguide = API.load("lineguide")
local hasGenerated = false;
local hasTransformed = false; --if we've transformed an egg or not
local ran;
local frameCount = 0;
local pnpc = API.load("pnpc"); --init pnpc.lua API

timerApi = loadAPI("leveltimer");
lineguide.lineNpcs = {212}

function OnStart()
lineguide.registerNpcs({212})
end

function onLoad()
     timerApi.setSecondsLeft(600);
     timerApi.setTimerState(true);
end

function onTick()
      for _, n in pairs(NPC.get(40, -1)) do
            n.id = 172
      end
end

function onTick() --run the code every tick (a unit of time); most logic for NPCs, etc. is performed in this event
   for _, v in pairs(NPC.get(39)) do
      local birdo = pnpc.wrap(v);
   
      for _, w in pairs(NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)) do --iterate over all NPCs that are intersecting with its hitbox
         if w.id == 40 then --if the NPC is a hammer
            birdo.data.megg = pnpc.wrap(w).uid; --get the unique identifier of the hammer and save it to the Hammer Bro's data table
            w.friendly = true;
            w:transform(172);
         end
      end
   end
   
   for _, x in pairs(NPC.get(172)) do --iterate over all SMB1 green shells
      local shellID = pnpc.wrap(x).uid; --get the unique identifier of the shell
      local intersects = false; --a variable that will be set to true if the shell is still intersecting with the Hammer Bro that threw it
      
      for _, y in pairs(NPC.getIntersecting(x.x, x.y, x.x + x.width, x.y + x.height)) do --iterate over all NPCs that are intersecting with the shell
         if (y.id == 40) and (pnpc.wrap(y).data.megg == shellID) then --if the NPC is a Hammer Bro and its data table reference for "mHammer" is the shell's uid
            intersects = true; --the shell intersects still with the Hammer Bro that threw it, so this variable is set to true
         end
      end
      
      if not intersects then --if the variable intersects is false
         x.friendly = false; --make the shell not be friendly
      else --if the variable intersects is true
         x.friendly = true; --make the shell be friendly
      end
   end
end

function onNPCKill(eventObj, killedNPC, killReason) --an event run every time an NPC is killed; makes sure that if a Hammer Bro is killed before the shell it threw is set to not friendly (the shell was intersecting with the bro when it was killed still) that the shell is set to not friendly
   if killedNPC.id == 40 then --if the killed NPC is a Hammer Bro
      for _, v in pairs(NPC.get(172)) do --iterate over all shells
         if pnpc.wrap(killedNPC).data.megg == pnpc.wrap(v).uid then
            v.friendly = false;
         end
      end
   end
end
EDIT:
Nvm, it works, however, it still acts a bit glitchy

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.
And Here's The Proof
My Rainbow Of Levels
Mosaic's Museum(My Discord Server, where I update on my streams, writing, and anything else I may be up to.

Cancelled...but not forgotten...
Image

Image

Danny wrote:Here's some constructive criticism: What the hell.
Witchking wrote:Approved!

Discord Quotes: show
Image


User avatar
Kira Yoshikage
Shy Guy
Shy Guy
Posts: 6
Joined: Fri May 12, 2017 8:45 am

Re: Lineguide.lua (Alternate Graphics Added)

Postby Kira Yoshikage » Mon Jun 12, 2017 12:29 am

I found another error.If you attach some npc to lineguide,then attach something to that npc,attached npc,block,or background will not follow npc on lineguide.

User avatar
Cetus808
Bit
Bit
Posts: 135
Joined: Wed Jul 06, 2016 1:45 am
Current Project: a bunch of levels
Contact:

Re: Lineguide.lua (Alternate Graphics Added)

Postby Cetus808 » Fri Aug 04, 2017 9:48 pm

I love this, but it sucks that the background tiles seem to interfere with the line guides, because anything that's attached to them either falls through or get stuck in mid-air. Everything seemed to worked just fine when I got rid of the background tiles, though.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 5 guests