Author Topic: Inventory  (Read 1379 times)

ponderitus

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Inventory
« on: March 03, 2017, 09:00:17 pm »
Can anyone explain how to get a pause menu (inventory and such) to work?

I'm only trying to get the one that Christopho uses in his French tutorial, I cant understand French so I'm just following what he does on his screen. I would be happy with the ALTTP inventory. I just need something which will enable me to switch between items.

Any help is greatly appreciated.

Neovyse

  • Administrator
  • Full Member
  • *****
  • Posts: 141
    • View Profile
Re: Inventory
« Reply #1 on: March 03, 2017, 10:22:42 pm »
Do you know you have the English version for the tutorial? https://www.youtube.com/playlist?list=PLzJ4jb-Y0ufxwkj7IlfURcvCxaDCSecJY

ponderitus

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Inventory
« Reply #2 on: March 03, 2017, 10:42:14 pm »
No, any idea which one? Ive watched these videos many times and never seen inventory help. The HUD tutorial is the closest i see and that doesnt explain it, neither does how to display an image...im currently scanning through them to see which one but I'm not having any luck

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Inventory
« Reply #3 on: March 03, 2017, 11:24:16 pm »
There is no English tutorial yet on how to make an inventory menu, but there is one about the pause feature.

Here is the tutorial on how to do something when the game is paused (in this example, a save dialog but you can do anything else, like showing an inventory menu): https://www.youtube.com/watch?v=fPdFOG24dE4&list=PLzJ4jb-Y0ufxwkj7IlfURcvCxaDCSecJY&index=9
And here is the tutorial on how to display an image: https://www.youtube.com/watch?v=5Jsh43NzHdw&index=17&list=PLzJ4jb-Y0ufxwkj7IlfURcvCxaDCSecJY
This is the base for a HUD or an inventory menu.

After that, you can study the pause scripts of Zelda ROTH SE here:
- https://github.com/solarus-games/zelda-roth-se/blob/dev/data/scripts/menus/pause.lua
- https://github.com/solarus-games/zelda-roth-se/blob/dev/data/scripts/menus/pause_inventory.lua

ponderitus

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Inventory
« Reply #4 on: March 04, 2017, 12:29:25 am »
Cheers, I've watched these tutorials a few times and I've had the scrips for ROTH and OLB for a while. I've been trying to do this with these methods for probably about 3 months lol, I'll be the 1st to tell you I have no idea what I'm doing but its fun trying...until i change to much and break it and have no idea how to fix it..ill rewatch the save game tutorial again a few times and see if that gives anymore help

I finally got a hammer weapon working yesterday only to have it make the hookshot error on collisions with enemies and make a new world of confusion for me...still fun though, maybe one day I'll figure that out...maybe I'll break down and come on here for help.

recieve_attack_consequence (a nil value)

   enemy:recieve_attack_consequence ("hookshot", reaction)

I hope your English tutorials start again soon. They were sooooo good and they taught you way more than the titles suggested. Thats why I tried (and still try) to watch the French ones even though I cant understand them, they still teach via watching what you do. I know you have far more important things to do though. I spend so much of my time on solarus I wish I understood the workings more, Its a good job theres so much to it, in the time ive been learning the console ive been able to replicate the ALTTP outside world and a couple dungeons and also make the OOT world (which is cool to walk around)...I've now started making a South Park game, Ive got a few basic enemies and some Hero's and an outside world tileset sort of made but again i cant progress in this without being able to load a menu. I'll keep trying...maybe one day

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Inventory
« Reply #5 on: March 04, 2017, 12:35:03 am »
Ok good to hear that!

enemy:recieve_attack_consequence() is a method that only exists in Zelda Roth scripts, not in the Solarus Lua API. If you look at the Solarus documentation, you won't find it. That's why you don't have it.
It is defined in this script: https://github.com/solarus-games/zelda-roth-se/blob/dev/data/scripts/quest_manager.lua#L101
You need to define it similarly in your project if you want custom weapons from Zelda Roth like the hammer and the scripted hookshot.

ponderitus

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Inventory
« Reply #6 on: March 04, 2017, 01:31:10 am »
Ahh, that makes sense..Although it also opens more questions...i dont have a quest_manager.lua in my game

I tried copying the file into my quest and then requiring it in main.lua but i didnt get any change.

Do i need to make a quest manager and put the attack_consequence script in or is there somewhere else it should be put?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Inventory
« Reply #7 on: March 04, 2017, 08:08:32 am »
Ok, it is even better if you don't have quest_manager.lua. In my recent quests I don't have one, instead of it the features are split in one file per type. It is more modular.
Concretely, use Zelda OLB SE as a model rather than Zelda ROTH SE.
enemy:receive_attack_consequence() is defined here:
https://github.com/solarus-games/zelda-olb-se/blob/dev/data/scripts/meta/enemy.lua
Copy this script into your project but only keep this function, you probably don't want the other 3 functions. Ans just require this file from features.lua.

ponderitus

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Inventory
« Reply #8 on: March 04, 2017, 09:44:27 am »
Wow...that worked a charm. OLB was the one I was using and was where I originally found the hammer.tunic. I did notice that this made enemies not immobilize on collision with the hookshot, a simple fix in the hookshot.lua fixed that. All you have said to me has made a lot of things clearer

Now I have noticed that when an enemy is immobilized, the hammer doesn't cause any damage but the sword/bombs etc still do. As soon as the enemy start to move again (unfreezes) the hammer causes damage again. I've had a look at the hammer.lua and the hookshot.lua to see if there's any on immobilized reaction or anything like that but I can't see anything, as i say the sword and everything else still work fine on an immobilized enemy but the hammer just gets ignored, as though it is on a different layer