Importing an AI

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Importing an AI

Postby DrMekar » Fri Feb 05, 2021 4:52 am

I'd like to import the Scuttlebug A.I for my Bulbul NPC, since it's reflects his agressive 3D-Enviroment Attacking Style the best, though I'm not sure how to do this.

Help would great.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9254
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Importing an AI

Postby Enjl » Fri Feb 05, 2021 5:45 am

copy and rename the npc-n.lua file for the scuttlebug (dunno scuttlebug id off the top of my head)
All my assets from packs and episodes are free to use for non-Stargate levels and projects, as long as proper credit is given.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 6:33 am

Enjl wrote:
Fri Feb 05, 2021 5:45 am
copy and rename the npc-n.lua file for the scuttlebug (dunno scuttlebug id off the top of my head)
Hmm.. okay, though isen't there a Way to import it? My Bulbul NPC already has set Lives.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9254
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Importing an AI

Postby Enjl » Fri Feb 05, 2021 7:07 am

DrMekar wrote:
Fri Feb 05, 2021 6:33 am
Enjl wrote:
Fri Feb 05, 2021 5:45 am
copy and rename the npc-n.lua file for the scuttlebug (dunno scuttlebug id off the top of my head)
Hmm.. okay, though isen't there a Way to import it? My Bulbul NPC already has set Lives.
If scuttlebugs have an ai file you can read the npc-n file to see how it uses it and just do that.
All my assets from packs and episodes are free to use for non-Stargate levels and projects, as long as proper credit is given.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 7:41 am

Enjl wrote:
Fri Feb 05, 2021 7:07 am
DrMekar wrote:
Fri Feb 05, 2021 6:33 am
Enjl wrote:
Fri Feb 05, 2021 5:45 am
copy and rename the npc-n.lua file for the scuttlebug (dunno scuttlebug id off the top of my head)
Hmm.. okay, though isen't there a Way to import it? My Bulbul NPC already has set Lives.
If scuttlebugs have an ai file you can read the npc-n file to see how it uses it and just do that.
I reconsidered to use the Snailcorn AI and added this line: local = require("npcs/ai/snailicorn") to it like the Snailcorn NPC did it too.
I'm however receiving this Error:

Image
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9254
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Importing an AI

Postby Enjl » Fri Feb 05, 2021 9:01 am

Either read line 3 for your npc-n.lua and find this error yourself or post line 3 and I'll show you how ridiculously simple it is to find.

Image
All my assets from packs and episodes are free to use for non-Stargate levels and projects, as long as proper credit is given.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 9:17 am

Enjl wrote:
Fri Feb 05, 2021 9:01 am
Either read line 3 for your npc-n.lua and find this error yourself or post line 3 and I'll show you how ridiculously simple it is to find.

Image
This is Line 3.

Code: Select all

local = require("npcs/ai/snailicorn")
I've got AI Folder in my Episode Folder aswell.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9254
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Importing an AI

Postby Enjl » Fri Feb 05, 2021 9:51 am

DrMekar wrote:
Fri Feb 05, 2021 9:17 am

This is Line 3.

Code: Select all

local = require("npcs/ai/snailicorn")
The error message says "<name> expected near =", meaning the code read a = when it expected there to be a variable name.
Look at your line. Look at other require calls for comparison (for example the one snailicorns use). I think you will be able to find the issue within seconds.
All my assets from packs and episodes are free to use for non-Stargate levels and projects, as long as proper credit is given.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 9:59 am

Enjl wrote:
Fri Feb 05, 2021 9:51 am
DrMekar wrote:
Fri Feb 05, 2021 9:17 am

This is Line 3.

Code: Select all

local = require("npcs/ai/snailicorn")
The error message says "<name> expected near =", meaning the code read a = when it expected there to be a variable name.
Look at your line. Look at other require calls for comparison (for example the one snailicorns use). I think you will be able to find the issue within seconds.
Okay, I found the issue and removed the former Main AI of my NPC, though now he just stands there. Do you mind taking a look at it?
https://pastebin.com/E6BsK2db
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
Hoeloe
Foo
Foo
Posts: 1403
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Importing an AI

Postby Hoeloe » Fri Feb 05, 2021 10:25 am

Code: Select all

local bulbulNPC = require("npcs/ai/snailicorn")
 
--Create the library table
local bulbulNPC = {}
Don't do this. You're loading the snailicorn AI file, and then immediately overwriting it with your own table. Make sure variable names are unique.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 10:30 am

Hoeloe wrote:
Fri Feb 05, 2021 10:25 am

Code: Select all

local bulbulNPC = require("npcs/ai/snailicorn")
 
--Create the library table
local bulbulNPC = {}
Don't do this. You're loading the snailicorn AI file, and then immediately overwriting it with your own table. Make sure variable names are unique.
Okay, so what do I have to remove now? I removed the this

Code: Select all

local bulbulNPC = {}
so it didn't changed anything.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
Hoeloe
Foo
Foo
Posts: 1403
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Importing an AI

Postby Hoeloe » Fri Feb 05, 2021 10:47 am

No, you don't remove that, you call the snailicorn library something else, so that you can reference it and then actually register your NPC with it.

I suggest you actually look at how the snailicorns themselves are doing it, rather than guessing randomly.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 10:52 am

Hoeloe wrote:
Fri Feb 05, 2021 10:47 am
No, you don't remove that, you call the snailicorn library something else, so that you can reference it and then actually register your NPC with it.

I suggest you actually look at how the snailicorns themselves are doing it, rather than guessing randomly.
Okay, I did that. It still doesn't work:

Code: Select all

local npcManager = require("npcManager")
local bulbulNPC = require("AI/bulbul")
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Fri Feb 05, 2021 1:02 pm

I took a close look at everything and can't figure what to do diffrent. I'd really apperiate the help and I'm not going to learn it by being ignored, so I'd be really thankful if that didn't happend.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
Hoeloe
Foo
Foo
Posts: 1403
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Importing an AI

Postby Hoeloe » Fri Feb 05, 2021 1:45 pm

DrMekar wrote:
Fri Feb 05, 2021 10:52 am
Hoeloe wrote:
Fri Feb 05, 2021 10:47 am
No, you don't remove that, you call the snailicorn library something else, so that you can reference it and then actually register your NPC with it.

I suggest you actually look at how the snailicorns themselves are doing it, rather than guessing randomly.
Okay, I did that. It still doesn't work:

Code: Select all

local npcManager = require("npcManager")
local bulbulNPC = require("AI/bulbul")
AI/bulbul doesn't exist. You changed something completely different to what I told you to. Let's take a look at what the snailicorns do:

Code: Select all

local npcManager = require("npcManager")
local snailai = require("npcs/ai/snailicorn")

local snailicorn = {}
They load the ai file into a separate variable, and then make their own table. From there, they use a number of functions that interact with the snailai variable.

You'd be best off just copying the npc-623 file and using that as a base, rather than trying to make your own from scratch.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Sat Feb 06, 2021 10:55 am

Hoeloe wrote:
Fri Feb 05, 2021 1:45 pm
DrMekar wrote:
Fri Feb 05, 2021 10:52 am
Hoeloe wrote:
Fri Feb 05, 2021 10:47 am
No, you don't remove that, you call the snailicorn library something else, so that you can reference it and then actually register your NPC with it.

I suggest you actually look at how the snailicorns themselves are doing it, rather than guessing randomly.
Okay, I did that. It still doesn't work:

Code: Select all

local npcManager = require("npcManager")
local bulbulNPC = require("AI/bulbul")
AI/bulbul doesn't exist. You changed something completely different to what I told you to. Let's take a look at what the snailicorns do:

Code: Select all

local npcManager = require("npcManager")
local snailai = require("npcs/ai/snailicorn")

local snailicorn = {}
They load the ai file into a separate variable, and then make their own table. From there, they use a number of functions that interact with the snailai variable.

You'd be best off just copying the npc-623 file and using that as a base, rather than trying to make your own from scratch.
You told me to change the Snailcorn to something else, so that's what I did.

After that I do the except same thing in the beginning. I did not know that I have to mention it during the Code, which is why this Topic exists.

I'm not. I already made the compromise to import the AI, instead of doing my own, since the Bulbul practically does the same thing as the Snailcorn. It exists on its own, until it sees the Player. Upon doing that, it chases him.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
Hoeloe
Foo
Foo
Posts: 1403
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Importing an AI

Postby Hoeloe » Sat Feb 06, 2021 1:02 pm

I feel like you don't understand what you're doing in the slightest, or what I'm trying to explain to you, and it's really hampering your ability to get this done. I strongly suggest learning some basic Lua before tackling this, because you're effectively guessing at random and you will not make progress like that.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Sat Feb 06, 2021 2:46 pm

Hoeloe wrote:
Sat Feb 06, 2021 1:02 pm
I feel like you don't understand what you're doing in the slightest, or what I'm trying to explain to you, and it's really hampering your ability to get this done. I strongly suggest learning some basic Lua before tackling this, because you're effectively guessing at random and you will not make progress like that.
I do understand some of it, though far from everything, which is why I asked. I did already gave my NPC the Health of 4 and made him behave like a Goomba, which is not much, but still something. I'm not planning on starting to do NPC Packs all the time, I just want to do this one NPC and then some simple Bosses, like a Porcu Puffer who behaves like one, just with Jumps and multiple Lives, only able to be deducted via Spinjump.

There are just almost no Lua Bosses right now and my one request I made got ignored on the forum and Discord, so what should I do? I'm drifting away though. My Question would just be how do I simply import an AI to an NPC? I looked at the Sledge Bro NPC and there were barely any lines written in it and then theres the Snailcorn.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image

User avatar
Hoeloe
Foo
Foo
Posts: 1403
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Importing an AI

Postby Hoeloe » Sat Feb 06, 2021 3:26 pm

You've been told multiple times. You import the library into a variable (which you still don't seem to understand how to do, even though it's literally been written out for you multiple times), then call functions on that table to execute certain behaviours. Some behaviour libraries just require registering, some are more general-purpose, and require a lot more work, such as snailicorn, which is why I suggested working from a copy of the snailicorn code, since you want the same behaviour with some slight tweaks. It's easier to take that behaviour and modify it than to built it up again.

User avatar
DrMekar
Eerie
Eerie
Posts: 746
Joined: Sat Apr 08, 2017 7:16 am
Flair: CUSTOM CHARACTER CREATOR
Contact:

Re: Importing an AI

Postby DrMekar » Sat Feb 06, 2021 3:33 pm

Hoeloe wrote:
Sat Feb 06, 2021 3:26 pm
It's easier to take that behaviour and modify it than to built it up again.
Okay, got that. The First Time it sounded more like a less Advanced Method, though if it works diffrent per NPC, it makes alot of sense.

I did of course read everything else and will try to get behind it far better. Thanks.
My Youtube Channel: https://www.youtube.com/channel/UC-8fzX ... subscriber

My Episodes & Projects:
ImageImage


If you want to support my Projects, put this in your signature. Thanks :)
Spoiler: show

Code: Select all

[url=https://www.supermariobrosx.org/forums/viewtopic.php?f=36&t=25110[/url]
Great Folks who support/ed my projects/in the past:

Suecra
jaf
Suckerman7 GM

Image


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest