Where to place AI-lua files?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
Sednaiur
Volcano Lotus
Volcano Lotus
Posts: 564
Joined: Fri Dec 20, 2013 2:16 pm

Where to place AI-lua files?

Postby Sednaiur » Sun Feb 09, 2020 9:04 am

Hello again.

I like to change some details about the giant colorswitches, like the amount of frames, the amount of bursts and the time inbetween each burst.
So I copied the palaceswitch file from the NPCs/AI-folder over to my level's folder and edited the corresponding values. But it seems that the file either isn't getting read or the edits I made are not sufficient to work out.

This is what I edited in the palaceswitch-AI file:

frames = 1 changed to frames = 4
bursts = 11 changed to bursts = 12
burstinterval = 50 changed to burstinterval = 30

I also tried to create an AI-folder in my level's folder and put the palaceswitch file in there, but no results whatsoever.

So, where do I actually have to put the AI-files for them to work, or what else do I need to edit to make the changes apply?

Image

愛している、ビアンカ!

Lua-rank:Image

Spoiler: show

User avatar
MrDoubleA
Posts: 308
Joined: Mon Aug 20, 2018 7:02 am
Pronouns: he/him
Contact:

Re: Where to place AI-lua files?

Postby MrDoubleA » Sun Feb 09, 2020 11:05 am

You may have to place it in a folder called "ai", which itself is in a folder called "npcs".
Hi. I make some stuff.
(MrDoubleA#3124 on Discord)

MrDoubleA's NPC Pack
rooms.lua - Quick respawn & Celeste-styled rooms
Extended Koopas

Image

More stuff: show
Shiny Medals ooo:

Image
Image
Image
Image
Image

I support:
Image
Image

User avatar
Sednaiur
Volcano Lotus
Volcano Lotus
Posts: 564
Joined: Fri Dec 20, 2013 2:16 pm

Re: Where to place AI-lua files?

Postby Sednaiur » Sun Feb 09, 2020 1:53 pm

Well, shortly after I made the post, I figured that it could not harm to test exactly that, but unfortunately to no avail. I even have edited this code to further test things out:

function bigSwitch.onDrawNPC(npc)
if not npc.isHidden then
local data = npc.data._basegame
local pressed = isPressed(NPC.config[npc.id], npc)

if pressed and data.effect ~= nil then
data.effect:Draw(-36)
npc.animationFrame = 1 >>> npc.animationFrame = 3
elseif pressed then
npc.animationFrame = 1 >>> npc.animationFrame = 3
else
npc.animationFrame = 0
end
end
end

But that leads me to think even more that the file just isn't read at all where I have placed it.

Image

愛している、ビアンカ!

Lua-rank:Image

Spoiler: show

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

Re: Where to place AI-lua files?

Postby Hoeloe » Sun Feb 09, 2020 2:30 pm

Why the heck did you edit the ai file? You know all those changes can just be done with npc.txt files right?

User avatar
Sednaiur
Volcano Lotus
Volcano Lotus
Posts: 564
Joined: Fri Dec 20, 2013 2:16 pm

Re: Where to place AI-lua files?

Postby Sednaiur » Mon Feb 10, 2020 12:52 pm

Hoeloe wrote:
Sun Feb 09, 2020 2:30 pm
Well, I tried that first but to no avail. Here is what I have put in the TXT-file:
frames=3
framestyle=0
framespeed=8
What I want to do is having the "unpressed"-state being animated with 3 frames, while the "pressed"-state is supposed to not have more than one frame. But the TXT-file does not work and the INI-file also does not work for that, so I tried to edit the AI-file to reflect that, but it also is not working.

Is it even possible to animate the colorswitches at all? Obviously, in PGE it works fine, just not ingame.

Edit: Also, these settings are not a given thing in TXT-files, just in the AI-files, or is it?:
pressedheight = 32,
synchronize = true, --Whether the switches of this type should be synced
switchon = true, --Whether the switch transforms "off" blocks into "on" blocks.
switchoff = true, --Whether the switch transforms existing "on" blocks into off blocks.
blockon = 1, --The ID of the switch's "on" blocks.
blockoff = 2, --The ID of the switch's "off" blocks.
exitlevel = true, --Whether or not the switch will work as a level exit.
save = true, --Whether or not the switch will actually save, or only work for the level. Best changed in conjunction with exitlevel.
bursts = 11, --number of switch bursts. Works best as 11 with exitlevel, and 1 without. >>> is supposed to be 12 for my settings
burstinterval = 50 --yeah >>> is supposed to be 30 for my settings

Image

愛している、ビアンカ!

Lua-rank:Image

Spoiler: show

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

Re: Where to place AI-lua files?

Postby Hoeloe » Mon Feb 10, 2020 4:43 pm

Anything that is inside the "setNPCSettings" call can be adjusted with npc.txt files.

User avatar
Sednaiur
Volcano Lotus
Volcano Lotus
Posts: 564
Joined: Fri Dec 20, 2013 2:16 pm

Re: Where to place AI-lua files?

Postby Sednaiur » Mon Feb 10, 2020 7:03 pm

Hoeloe wrote: Anything that is inside the "setNPCSettings" call can be adjusted with npc.txt files.
This code is from the red palace switch:
local bigSwitch = {}

local npcManager = require("npcManager")
local palaceSwitch = require("npcs/ai/palaceswitch")

local npcID = NPC_ID

local settings = {id=npcID, color="red", blockon=730, blockoff=731, iscustomswitch = true}

palaceSwitch.registerSwitch(settings)
return bigSwitch


I do not see a "setNPCSettings" call in there. The only settings close to the ones usually used in the normal TXT-files are in the "palaceswitch.lua", which are:
bigSwitch.sharedSettings = {
gfxwidth = 64,
gfxheight = 64,
width = 64,
height = 64,
nogravity = false,
frames = 2,
framestyle = 0,
framespeed = 8,
noblockcollision = false,
playerblock = true,
playerblocktop = true,
npcblock = true,
npcblocktop = true,
speed = 0,
jumphurt = true,
nohurt = true,
score = 0,
noiceball = true,
nowaterphysics = true,
foreground = true,
noyoshi = true,
notcointransformable = true,

--lua settings
pressedheight = 32,
synchronize = true, --Whether the switches of this type should be synced
switchon = true, --Whether the switch transforms "off" blocks into "on" blocks.
switchoff = true, --Whether the switch transforms existing "on" blocks into off blocks.
blockon = 1, --The ID of the switch's "on" blocks.
blockoff = 2, --The ID of the switch's "off" blocks.
exitlevel = true, --Whether or not the switch will work as a level exit.
save = true, --Whether or not the switch will actually save, or only work for the level. Best changed in conjunction with exitlevel.
bursts = 11, --number of switch bursts. Works best as 11 with exitlevel, and 1 without.
burstinterval = 50 --yeah
}

local switchColorFunctions = {}

I tried to edit that but without luck.

Image

愛している、ビアンカ!

Lua-rank:Image

Spoiler: show

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

Re: Where to place AI-lua files?

Postby Hoeloe » Mon Feb 10, 2020 10:02 pm

Those are all settings you can modify with npc.txt, yes.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 3 guests