Author Topic: [possible bug] Fatal: Cannot load image 'sprites/'  (Read 235 times)

jurassicjordan

  • Newbie
  • *
  • Posts: 1
    • View Profile
[possible bug] Fatal: Cannot load image 'sprites/'
« on: March 23, 2018, 12:34:59 am »
when setting the tunic in a directory other than hero, for ex: main_heroes, the game tester crashes. I have no idea why, I'm trying to change sprites upon entering a map, in the map's lua file, i set the tunic sprite id to a sprite in the main heros folder, upon testing, the whole thing crashed, is this a bug on my part or on solarus's part? thx
report, code, and log is attached

Diarandor

  • Hero Member
  • *****
  • Posts: 979
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #1 on: March 23, 2018, 11:24:04 am »
Do you get an error in the file "error.txt"?
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Lucifer

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Mon site
Re: [possible bug] Fatal: Cannot load image 'sprites/'
« Reply #2 on: March 24, 2018, 08:19:30 am »
In scripts\meta\hero.lua, you must change :
Code: Lua
  1. -- Initialize hero behavior specific to this quest.
  2.  
  3. require("scripts/multi_events")
  4.  
  5. local hero_meta = sol.main.get_metatable("hero")
  6.  
  7. local function initialize_hero_features(game)
  8.  
  9.   local hero = game:get_hero()
  10.   hero:set_tunic_sprite_id("main_heroes/eldran")
  11. end
  12.  
  13. -- Set up Eldran hero sprite on any game that starts.
  14. local game_meta = sol.main.get_metatable("game")
  15. game_meta:register_event("on_started", initialize_hero_features)
  16. return true
  17.  

by :

Code: Lua
  1. -- Initialize hero behavior specific to this quest.
  2.  
  3. require("scripts/multi_events")
  4.  
  5. local hero_meta = sol.main.get_metatable("hero")
  6.  
  7. local function initialize_hero_features(game)
  8.  
  9.   local hero = game:get_hero()
  10.   hero:set_tunic_sprite_id("that you want")
  11. end
  12.  
  13. -- Set up Eldran hero sprite on any game that starts.
  14. local game_meta = sol.main.get_metatable("game")
  15. game_meta:register_event("on_started", initialize_hero_features)
  16. return true
  17.