Author Topic: Multiple Entities Sponaneously Broken  (Read 297 times)

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 22
    • View Profile
Multiple Entities Sponaneously Broken
« on: April 08, 2019, 11:57:42 pm »
Hey again,

So I'm starting to near the end of my first dungeon, but just when I thought it was safe to move on, all of my locked doors broke (they no longer load in the game as an entity, as if they never existed), and what really confounds me is that a cutscene event I wrote that was working just fine before no longer works as well. Doors that are locked by switches are still functioning normally. There are multiple exceptions generated upon loading the game, none of which existed for most of the development process thus far. Below's an exhaustive list of those exceptions. If this has happened to you, I beg that you let me know what I need to go in and edit. Thanks much for your time.

1)
Code: [Select]
Error: In on_created: items/dungeons/small_key.lua:6: module 'sprites/items/dungeons/small_key' not found:
2)
Code: [Select]
Error: In create_door: bad argument #1 to ? (Bad field 'opening_condition' (equipment item 'dungeons/small_key' is not saved))
3) Error: In on_created: enemies/bosses/armos_knight.lua:18: attempt to call method 'set_arrow_reaction' (a nil value)

4) Error: In on_pickable_created: items/consumables/heart.lua:50: bad argument #1 to set_animation (Animation 'heart_falling' does not exist in sprite 'entities/items')

Important note: I have not tampered with any of the files pertaining to doors, pickables, or items. I have checked, and heart_falling & dungeons/small_key indeed exist and do so in their proper placement in the directory.

llamazing

  • Full Member
  • ***
  • Posts: 184
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #1 on: April 09, 2019, 01:15:43 am »
That first error indicates that line 6 of the items/dungeons/small_key.lua script encountered an error because it could not find the small key sprite located at sprites/items/dungeons/small_key.

I would start by adding that sprite to your quest. Errors that follow don't necessarily mean anything because when a script encounters an error it halts execution of the remainder of that script, so other scripts often have errors because of that script was not loaded fully.

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #2 on: April 09, 2019, 01:34:55 am »
That sprite already exists in that directory, correctly named, and in the correct directory though.

llamazing

  • Full Member
  • ***
  • Posts: 184
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #3 on: April 09, 2019, 02:41:13 am »
Then post the code from your on_created() event. You must have an error in there somewhere.

EDIT Also, try posting the following code in the console of the quest editor while your game is running:
Code: (lua) [Select]
print(sol.main.resource_exists("sprite", "items/dungeons/small_key"))
« Last Edit: April 09, 2019, 02:47:20 am by llamazing »

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #4 on: April 10, 2019, 08:50:46 pm »
I've printed the diagnostic you suggested, and it returned false. However, in on_created, I can't find any method looking for that sprite either. Other than that, it stopped generating that exception for some reason and replaced it with the In create_door exception upon booting the project. This is just so bizzare, I don't know where to even start. Also, where's the script the governs doors? I can't find it in the entities directory.

Anyway's here's the script for the small keys I'm using. Thanks again for all your help.

Code: [Select]
local item = ...


function item:on_created()
  require("scripts/equipment")
  self:set_shadow("small")
  self:set_brandish_when_picked(false)
  self:set_sound_when_picked("picked_small_key")
end

function item:on_obtaining(variant, savegame_variable)

  self:get_game():add_small_key()
end

froggy77

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #5 on: April 11, 2019, 01:20:51 am »

That sprite already exists in that directory, correctly named, and in the correct directory though.
Your answer is incomplete.The fact that a sprite (image file and .dat file) and a script already exist in the correct directory, with the correct name, does not mean that they were added to the quest.
« Last Edit: April 11, 2019, 01:25:58 am by froggy77 »

llamazing

  • Full Member
  • ***
  • Posts: 184
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #6 on: April 11, 2019, 01:26:44 am »
I don't see the .dat file in that screenshot... that may be your problem.

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #7 on: April 11, 2019, 09:54:30 pm »
So I added an animation for it now, checked the file and saw the new .dat file, double checked for naming, and then ran the quest, but no changes in the exception changed. I required the key sprite, but it said that the file still didn't exist? I don't know how to tell the engine that this sprite exists any better than I already am. Any ideas?

llamazing

  • Full Member
  • ***
  • Posts: 184
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #8 on: April 11, 2019, 11:40:11 pm »
So I added an animation for it now

You can't just go adding any old animation, it has to be the correct one. You should import the .dat file from the project where you got the small_key png file, then the dat file will be setup correctly and automatically get added to your quest (sprites need both the .png and .dat files to work correctly, so make sure you get both when importing).

If you simply copy the .dat file over to your project without using the import feature then it doesn't get added to your quest automatically, and in that case you will have to find the sprite in the quest tree (left sidebar of the quest editor), which will have a '?' icon. Right-click it then choose the option to add it to your quest.

Diarandor

  • Hero Member
  • *****
  • Posts: 1044
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #9 on: April 12, 2019, 05:42:50 pm »
General remarks:

1) Do not mix these 2 different concepts:
sprites (which  are dat files with metadata) and source images (the image files). In other forums or for other engines, image files are called sprites, but that is not the case with the Solarus API.
2) Do not mix these other 2 concepts:
adding a file (copy-pasting files to the data folder) and adding a resource to the quest (right click with the mouse and select the option to add it, or use the import feature that the others mentioned before).

It may seem annoying for newbies to learn these things, but it is very important when you have a problem and need others to understand you.
« Last Edit: April 12, 2019, 05:44:35 pm by Diarandor »
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

gmanplays@gmail.com

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #10 on: April 20, 2019, 07:14:31 am »
So I don't see the option to add these items to the quest; nor can I import them from another quest. Should I go back to the CoS github and download the entire thing so I can import it from there?

Diarandor

  • Hero Member
  • *****
  • Posts: 1044
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: Multiple Entities Sponaneously Broken
« Reply #11 on: April 22, 2019, 02:52:27 pm »
So I don't see the option to add these items to the quest; nor can I import them from another quest. Should I go back to the CoS github and download the entire thing so I can import it from there?

If you took them from CoS it is better to import them, because that will automatically add the author/license metadata. Otherwise, right click on the file at the Quest Tree, then select the option "Add to quest" or something like that.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”