Setting Up A Basic Equipment Menu?

Started by Bagu, April 23, 2018, 04:21:56 AM

Previous topic - Next topic
Hi I'm new and I've been following along with Christopho's youtube tutorials and reading through the documentation, but I don't see this too comprehensively answered anywhere.

Basically I just want to be able to equip items to different slots to test them out. I've been able to pull things like enemies and items from the Mystery of Solarus DX/Return of the Hylian/Oni Link Begins source github and have them drop into the map easily, and I was able to replicate the "save on pause" process from Chistopho's video tutorial. Hoever I haven't been able to spot exactly which lua scripts to copy an equipment menu and where to reference it to actually get it to show up.

Can anyone point me in the right direction?

Sorry in advance if this seems like a lazy or stupid question.

I would like to help you, but I do not have the right skills.

Anyway, welcome to the community! :)

I can't really help you with a complete Pause menu, inventory and what knot....it involves a lot of drawing and specific tile placement and other things, its a lot of work. Or at least is for me. If you are trying to copy one, first read through the script and find out if you've got all the files it's going to need to use first. it might require an image that's in the language folder that you don't have or another script.
If you just want to test an item you can so it by putting something such as :


  game:get_item("boomerang"):set_variant(1)
  game:set_item_assigned(1,game:get_item("boomerang"))

  game:get_item("hookshot"):set_variant(1)
  game:set_item_assigned(2,game:get_item("hookshot"))


in your initial_game.lua, or wherever your starting values are made

Hopefully this helps, I may not have understood what you meant. Welcome to the community

Thanks all for the kind welcome.

Quote from: ponderitus on April 24, 2018, 12:04:51 AMIf you just want to test an item you can so it by putting something such as...

This is actually a big help. I had tried "game:set_item_assigned" on its own, but without being preceded by "game:get_item", it wasn't working even if I edited my save file to include the item in my inventory first. Following your example, I can at least test with the bow/boomerang/hookshot.


  game:get_item("pegasus_shoes"):set_variant(1)
  game:get_item("magic_bar"):set_variant(1)
  game:get_item("flippers"):set_variant(1)
 
those will let you test your boots, flippers and bar as they don't need to be assigned to use, or at least don't in mine. you can also do the same with the feather with a couple of tweaks

have a read of all the scripts you have, they may look like jibberish at first but after a while they will make sense I promise (could be months, I still don't understand most). But random bits will end up helping you. I couldn't get an Npc to change animation for the longest time, abandoned it, then read a random map from christopho and the team and saw I needed


  name:get_sprite():set_animation("")
  name:get_sprite():set_direction("")...ect

and the game changed....

Don't be afraid to ask a seemingly stupid question though, I've held back from asking lots of things and it's stunted my progression immensely. Someone could and would have given me the answer in seconds. Also, they might not be so stupid. Pretty sure I asked something like this when I started.

It's a shame the Youtube tutorials finished, they helped me sooooo much when I was starting, you don't even want to know what I was doing to get my bridges to work before that tutorial came out, I had hundreds of sensors. Hopefully they will come back one day, there's still a hell of a lot to cover. It would also be nice if there were more examples in 'Solarus 1.5 - Lua API reference'. That thing is confusing as hell sometimes.

What are you looking to make?

Thanks for the reminder; I'd been meaning to try out the feather and totally forgot to check it out.

Weird thing I noticed about the shield: by default it doesn't seem to have any effect on enemy projectiles (i.e. I pulled Octoroks from Return of the Hylian). So I added the "minimum_shield_needed" property to the Octoroks' projectiles, and now Link doesn't take damage when facing into them with the shield, but they pass through him and continue flying until they hit another obstacle.

Presumably the enemy class for the stone projectiles need to be modified to destroy themselves when hitting Link's shield, but is there a standardized method of doing this which I missed?

Long term, I would like a build a standalone Zelda-like game with an emphasis on challenging combat similar to Hyper Lighter Drifter or Elysis. Ideally it would include some custom sword and dash/dodge-roll mechanics. I noticed some users here have already posted scripts for similar ideas but I'm still trying to figure them out.

Anyway, I know my skills are present aren't nearly up to the task, so short term I'm just trying to familiarize myself with the engine. I have been playing around with some basic alterations to existing enemy AI and I hope to slowly build from there.

Yeah I added a enemy:on_custom_attack_received() to counter that, so they break when hit with swords. Haven't played with the shield yet just use it as a defense upgrade really. Seems like you know your stuff though. Let me know if you create anything interesting. I'm always after new enemies, mine suck! Been trying to create...essentially a Deku scrub for a few days, one that will be "sleeping" then will "wake up" when hero is within distance and shoot if he is in-line with x or y. Then if you are too close it will "sleep" again. so can't be killed with melee unless its frozen, so only by its own bullets being returned or arrows...I have no idea where to start.

The teleporting Octorok in Ocean's Heart is pretty cool, and his Ogre. If you haven't seen Ocean's Heart I'd go check it out. By Max.

http://forum.solarus-games.org/index.php/topic,1107.0.html

Hey Bagu- I agree, item menus are hard! I haven't figured one out yet either, I literally designed my game to only have two items so I wouldn't need to do one, in my opinion menus are definitely the hardest part of designing in Solarus. My best advice is to start learning by making a static menu- one that will come up and display information, but you can't interact with (a quest status screen, for example) before you get into an item menu. And once you start trying to figure that out, be sure to post a topic explaining how you're doing it so I can learn from you! : )

Ponderitus, thanks for the compliments. BTW, if you want that deku enemy, you'll need a function that has a "check hero" thing every 100ms or so and gets the distance to the hero, then if that distance is >100 or whatever, remain asleep, if it's <100 and >32, wake up and shoot, and if it's <32, go back to sleep. If you want more help, post a topic about it and I'm pretty confident I have code that will work.

mad that I mentioned your project and you answered. It was actually your mandrake that made me think of making it. When i walked up to it thinking it was a normal bush then boom, enemy. was great. but then left me looking for a shooting mandrake...
I've been looking through your enemies, I love your Ogre..or the "melee attacker", I wanted to replicate that so it attacks multiple co-ordinates, like the Club Moblins do. I love your game, the art style is amazing, and the dialog box!
I get how i need to go about making the enemy with those functions, I've read a lot of enemies now lol. I just don't really know how to make the functions yet tho, the whole finding where the hero is. this would be my 1st enemy. It's starting to make more sense every time I read them.

But for your inventory try copying over files from other projects that have working menus..but make sure you have all the files they do, check you have all the language strings as well as dialogs to make them work, then...edit them, that's how I got mine working eventually. Or the reverse. get a Master folder and delete everything until you have a blank project with nothing but a blank map and a working menu. then add your files into that project and edit around that...Obviously don't delete the Items in the project until afterwards

Creating an interactive menu really isn't all that difficult, especially if you already know how to create a static menu, which is the biggest hurdle in my opinion. Drawing all the various menu components at the correct location can be tedious.

Going from a static menu to an interactive menu needs the following components:

  • Draw an indicator highlighting the currently selected item in the menu. You can get fancy here an make it animated
  • process keyboard/gamepad inputs from the player. menu:on_command_pressed(command) can be used for this.
  • Move the indicator in response to player inputs. This part can be tricky because you'll have to plan out the layout of your menu (probably a grid) and define rules for how the indicator can move around.
  • Handle other actions in response to player inputs, such as making the currently selected item active or perhaps open a new menu to display a text box with a description for the current item, etc.