Yeah, I probably should just give up trying to do everything from scratch (which is what I would like to do given a model/instructions or whatever and not just copy/pasting Mystery of Solarus's luas) for the moment. I know that it's more efficient to work off of the Solarus game and work my way from there, but I want to add way more items than Mystery of Solarus has. So by that reason alone I can't really use its menu. I did read over the code (all the luas to make the game run) and apparently there's like a million things I have to have going on in order to even make a Zelda game possible (before the player being even able to start a quest). I can design maps and dungeons and puzzles and items but in the end, all I can do is test. I can't really get a game started until I'm able to develop the system of equipping items.
That being said, I decided to try and code my item into Mystery of Solarus (and force equipping it) which actually works given what you suggested. So I really have no idea what's wrong with my own game. However, to move past my problem of something as simple as equipping the thing and try to at least make the item work before I can implement it in my own game, I'm trying to make the Book of Mudora. So I'll work off of Mystery of Solarus to at least test my items. I would like to be able to contribute as well in item scripting because my game is really ambitious and I'm working on a whole bunch of other things (I got an Iron Boots concept to work wonderfully and simply, so at least I'm happy for that, lol). As soon as I'm able to get my bearings in Solarus I can be able to share my discoveries with the community (like after I finish getting the Book of Mudora to work, lol).
Using this item requires a change in the hero's graphics (already created an animation and directions for it and set them up in the appropriate place in the hero tab) and named it 'book'. This is the code for the book:
local item = ...
function item:on_created()
self:set_savegame_variable("possession_book")
self:set_assignable(true)
end
function item:on_using()
sol.audio.play_sound("bush")
end
Ok, as I was getting the info you asked in order to help on the other game, now I can't get this to work in Mystery of Solarus either. Lemme first check again to see what I did wrong...
UPDATE:
Here's what I want the book to do:
local item = ...
local game = map:get_game()
function item:on_created()
self:set_savegame_variable("possession_book")
self:set_assignable(true)
end
function item:on_using()
hero:freeze()
hero:set_animation(book)
game:start_dialog("book.test")
hero:unfreeze()
end
The item is equipped as you say and everything works until I make the item do something. As long as the only thing in the book.lua is
local item = ...
function item:on_created()
self:set_savegame_variable("possession_book")
self:set_assignable(true)
end
it works. If I add the item:on_using() function to the book.lua, the error goes so far as to not even force equip it as you say. So basically, I can only force equip the item via the map script you gave me in the 1st slot so long as the book.lua has no other lines of code besides being created. The mystery continues...