Page 380 of 390

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 21, 2021 11:28 pm
by minmay
Sounds like you have a ScriptComponent somewhere that's trying to load mod_assets/scripts/monsters.lua as a source file. Search your dungeon.lua for "mod_assets/scripts/monsters.lua" and you should find it.

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 22, 2021 12:36 am
by Mal85
Yes I found it easily enough in my Dungeon.lua, but what do I do with it? Do I delete the entry? When I tried to outright remove the problematic script entity in my mod it threw even worse error and crashed editor.

Edit: Oh I figured it out... I must have switched the referenced script from the custom one to the monsters.lua by mistake. Geeze. Thanks Minmay at any rate, that fried my brain for literal months. :shock:

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 22, 2021 1:03 am
by Mal85
Ok, so I got it to load the floor finally by switching it to the correct script. But then it said something about not enough memory and CTD. Now when I attempt to load the mod it says-

mod_assets/scripts/dungeon.lua:13856: attempt to index a nil value.

that line of code reads as follows in dungeon.lua-

script_entity_8.script:loadFile("mod_assets/scripts/yunintemple.lua")

switching it back to monsters.lua has same error and same line.

As I feared, I broke it even worse now...

:?

Edit: I switched the little pulldown menu inside the editor from monster.lua to yunintemple.lua. Any way I can undo that little mistake? So close to be done with this mod, just need to get this last bit figured out and some coding hitches are killing me.

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 22, 2021 4:10 am
by minmay
It means that either script_entity_8 or its component named "script" don't exist yet. Did you accidentally delete the spawn() call that creates script_entity_8?

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 22, 2021 4:32 am
by Mal85
No I didn't delete anything. Basically the party grabs a sword off an altar which starts a boss battle. One of the connectors is to a script entity that is supposed to reference yunintemple.lua but was incorrectly referencing monsters.lua. Thinking I had solved the issue I switched the little pull down tab in the editor for that external script and changed it from monsters.lua to yunintemple.lua.

The floor loaded perfectly! Hurray! I fought the boss, the music and HP bar worked and everything, so I save the mod, finally it's fixed! Then try to load all the floors at once and get a CTD.

I tried to change the line in Dungeon.lua that you pointed me too and changed it to also reference yunintemple.lua as was intended. Yoink, now the mod fails to load at all with the above posted error and Im not sure what I can do. I tried changing it between Monsters.lua and yunintemple.lua but it seems that changing the little menu in game really broke it and I have no way to get back into it to revert that change...

Thanks Minmay!

EDIT: I did not delete the spawn call, it is still present there.

EDIT:Here is the script that references that.
https://hosting.photobucket.com/images/ ... &crop=fill

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 22, 2021 5:56 am
by minmay
The dropdown menu just changes the line that gets generated in the dungeon.lua. It doesn't do anything else. So if you want to "undo" it, you can just remove the

Code: Select all

script_entity_8.script:loadFile("mod_assets/scripts/yunintemple.lua")
line (or change it back to monsters.lua if you really want to get your old error back).

Of course, this doesn't really help with the error you describe. It's extremely strange that the code in the screenshot would result in that error. Neither of the possibilities seem very likely:
1. script_entity_8 is nil. It's just been spawned on a map, one line ago, so the only way this could happen is if you're loading the dungeon.lua from your init.lua, in which case I'd expect an error much sooner (for one, spawn would probably be nil!)
2. script_entity_8.script is nil. This could only happen if you have changed the definition of script_entity to remove or rename its ScriptComponent.

(The error can't can't be coming from within loadFile, because this is the complete source code of loadFile:

Code: Select all

function ScriptComponent:loadFile(filename)
	self.source = filename
	self.scriptType = "external"
end
The only indexes performed are to self, i.e. script_entity_8.script in this case, and if that were nil, you wouldn't get far enough to call loadFile)

Re: Ask a simple question, get a simple answer

Posted: Wed Sep 22, 2021 7:34 am
by Mal85
Deleting the lines worked and I even got the original script sorted thanks too you Minmay! Ever the legend, so glad your still around here! Cheers mate!

Edit: Pretty sure I changed something in my monster.lua after I also messed up the dungeon.lua and that was causing the nil. Thankfully I made a backup of that file and simply restored it. Whew, work can resume finally! Thanks again.

Re: Ask a simple question, get a simple answer

Posted: Sat Nov 20, 2021 6:37 pm
by ColdDeadStone
Some monsters like the Snake or the Warg have a "MonsterMove" component, does anyone have an idea how I can execute this?

Code: Select all

		{
			class = "MonsterMove",
			name = "moveForwardAndTurnRight",
			animations = { forward="moveForwardTurnRight" },
			sound = "warg_walk",
			turnDir = 1,
			cooldown = 2,
			resetBasicAttack = true,
		},
If that doesn't work I have to play the animation and move the monster, but that would be a bit inconvenient. monster_1.brain:moveForwardAndTurnRight() dont work.

If anyone has any ideas, please share them with me. :D Thank you!

Edit: Well, sometimes you can’t see the forest for the trees... :oops:

The solution: :arrow:
monster_1.brain:performAction("moveForwardAndTurnRight")

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 28, 2021 11:43 am
by Adrageron
While experimenting with the flooded levels, I discovered an unpleasant surprise: the game does not reproduce the sounds of underwater objects if the party is not underwater. For example, strikes against reeds growing out of the water are absolutely silent, and even a monster attacking a party from a neighboring underwater tile does it in absolute silence. Maybe someone knows how to get around this in a not too roundabout way? All that comes to my mind is adding additional scripts to each underwater object to track sounds, which does not seem like a particularly good solution...
SpoilerShow
Image

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 28, 2021 5:55 pm
by Isaac
I guess that I don't see the problem with that ——yet. :)

You have both submerged and adjacent open-air tiles in your maps? (...with no barriers between?)
Are some (or all) area tiles subject to variable water depths?

More detail about your level construction could help identify some solutions. What is fudementally different about your map, from the game's own flooded level?

Lacking the details... Is there a reason not to flag all of the map tiles as underwater?

It's posible to script the sounds with .brain and .animation events, but probably best to just make the party immune to drowning effects while in [faked] air tiles—if you have those.