-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: automatically equip weapons/equipment if none are currently equipped #482
Comments
This seemed like a fun idea, so I had a quick look at it. I only implemented it for Swords/Shields/Tunics, not for C-buttons as you suggest here, but here's how I did it: diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index 14d6772..7be667a 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -1366,6 +1366,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
s16 i;
s16 slot;
s16 temp;
+ Player* player = GET_PLAYER(globalCtx);
slot = SLOT(item);
if (item >= ITEM_STICKS_5) {
@@ -1427,6 +1428,11 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
return ITEM_NONE;
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) {
gSaveContext.inventory.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD];
+ if (CVar_GetS32("gAutoEquips", 0)) {
+ gSaveContext.equips.buttonItems[0] = item;
+ Inventory_ChangeEquipment(EQUIP_SWORD, item - ITEM_SWORD_KOKIRI + 1);
+ Interface_LoadItemIcon1(globalCtx, 0);
+ }
if (item == ITEM_SWORD_BGS) {
gSaveContext.swordHealth = 8;
@@ -1448,9 +1454,17 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
return ITEM_NONE;
} else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) {
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]);
+ if (CVar_GetS32("gAutoEquips", 0)) {
+ Inventory_ChangeEquipment(EQUIP_SHIELD, item - ITEM_SHIELD_DEKU + 1);
+ Player_SetEquipmentData(globalCtx, player);
+ }
return ITEM_NONE;
} else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) {
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]);
+ if (CVar_GetS32("gAutoEquips", 0)) {
+ Inventory_ChangeEquipment(EQUIP_TUNIC, item - ITEM_TUNIC_KOKIRI + 1);
+ Player_SetEquipmentData(globalCtx, player);
+ }
return ITEM_NONE;
} else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) {
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]); The only particularly complicated thing here going on is the math around those enums, e.g.
If you've just picked up the Kokiri Sword, EDIT: I have no plans to go any further with this, it's all yours if you'd like to expand on it, or not as you prefer. |
@wawa1474 The D-pad work I believe is being worked on by others, and that's a good point about the blue tunic. Obviously this wouldn't stop people from changing it after the fact though. That's also a really good idea for the prompt, since that would make a good "default" option for people who don't want it to always go to a particular button but do want it equipped immediately. |
Also see the discussion between my comment here and what I'm replying to for other potential additions: https://discord.com/channels/808039310850130000/955997420288888902/987001838920400927 |
yeah, the blue tunic is... useless? i mean, really it could probably be auto equipped/unequipped any time iron boots are put on (assuming you have the tunic obv.). the only time you wear the iron boots and not be in water is if you're walking against fan currents (shadow temple, ganons tower, any others?), although, i suppose there is that one corridor in shadow temple where you have fans and the fire throwing eyes, so maybe auto equipping blue tunic with iron boots might not be so good. then again maybe when equipping iron boots check if the player is in water and if so equip blue tunic? that would keep it simple, and mean you wouldn't end up getting burnt to a crisp. as for the prompt, when first getting an item you get a prompt saying: You got a ... ! *text telling you what the item does* that prompt is shown the first time buying or picking up an item, and then not? shown again for said item. You got a ... ! though with the prompt also saying what the item is used for, like: You got a Deku Nut ! Set it to C and try it might be good to "swap" those paragraphs, like: You got a Deku Nut ! Press <, \/, or > to equip it, but i don't know which is better, or if it really possible to do that, just an idea i had. |
For what it's worth, you can drown underwater without having the boots on. If you e.g. dive under an alcove so that Link can't get back up to the surface, you can drown anywhere. It's time-based rather than boot-based. The discussion we had in the Discord was centered around equipping the Zora Tunic automatically when you're in water. It could either be set up to equip immediately on contact with water, or tied to the function which handles the drowning timer, before the timer is ever started or displayed. Then, presumably, you would drop back to the Goron Tunic as soon as you got out of the water if it was available. I don't think there's really that many (any?) situations where you're in the water and the Goron Tunic is a better option. There's no underwater fire enemies, etc. EDIT: I think behavior like this would definitely need to be under a separate CVar, or perhaps the CVar would have a range from "don't do anything different to the base game," "equip every new item you find," and "always equip optimum loadout" which would do things like the tunic behavior discussed above, equipping the Mirror Shield automatically in the Spirit Temple, etc. |
yeah, it's definitely a case of having an option to auto equip the zora tunic in water and goron tunic outside of water (if you have the appropriate tunic obv.) it might be a nice idea to also have the option for the goron tunic to auto equip/de-equip when in a hot room, for those who want link to be in the kokiri tunic most of the time. for auto equipping the mirror shield, while it could just be in the spirit temple, its maybe more accurate to be any time link stands in one of the light rays (IDK what they're called), or in the spirit temple/spirit temple boss room? |
I think what all of this discussion is hinting at is that there really are two levels of auto-equipping. Level 1, which is what I was initially thinking of, is just equipping something when you first obtain it. Level 2, which would be a lot more work, would be equipping something automatically any time you need it. Level 1 is all I was planning on doing myself, but even within that, I think there's room to treat the Zora tunic special given its drawbacks. One option would be to treat it as something Link just has instead of something he uses. We already know the game checks if Link is wearing it before starting a drowning timer, so all that would need to be done is add an additional check to that for if a flag like gAutoZora is enabled and if the tunic is in Link's inventory, and if it is, then just follow the same codepath as if he's wearing it. That's a single line change (or however many places they check before starting the drowning timer). Alternatively, automatically equipping Link whenever he's in water is basically what I would call the Level 2 approach. Of course, there are also different ways Level 2 could be triggered, as mentioned. It could be depending on if he's in a particular map/room, if he's currently interacting with a specific actor (which I assume the light rays used by Mirror Shield are), if he's got another item equipped, etc. Having not looked at the code, I imagine there are discrete functions for when Link is in water in some form, so it actually wouldn't be too hard to add auto equips and unequips for Zora tunic at least. In any case, that behavior would indeed be something that would just be covered under a general "Level 2" cvar. |
yeah, i guess having an option for it to work like the zora scales would work. in fact, if anything have it be the same for the goron tunic, once you get the tunic you instantly get fire resistance. then what tunic you wear could just be aesthetics, like, which look do you like the best kinda thing. and if, as said earlier, people are working to have randomizer-like boots and ocarina on d-pad, then the only thing that you'd have to change would be shield, and once you get mirror shield, you never really change it back... so in conclusion, if the goron and zora tunic worked like the scales and other things where it just checks if you have them, then the only things that you'd have to change would be boots and shields, of which shields aren't changed often, and boots could be either on c-buttons as they currently can be (assignable boots enhancement), or better yet have them on the d-pad. |
More discussion here: https://discord.com/channels/808039310850130000/955997420288888902/987857646335971378. After #501, future work still includes other sliders for shields, etc., and all C-button functionality for auto-equipping items and being able to unequip items. |
Mostly just leaving this here for myself so I don't forget the idea when I eventually have time to work on something. I was watching ZFG's commentary of the 100%, 2 pauses LOTAD, and it occurred to me how much of that constraint was due to the game not auto-equipping when there are available slots. And I know it was frustrating to them too since they expressed so much happiness over the times the game does auto-equip things. So, given how annoying it is even for me to have to immediately pause in a new game to equip the most basic equipment, I thought of a few things that would help.
First, for equipment, obtaining a new sword, shield, or tunic would automatically equip it, even if there is one already equipped. Or if that "even if" clause is contentious, then at minimum if there is currently none equipped, with maybe an option to also do the "even if" part. Boots, obviously, would be left out of this change.
Second, for new items, if there's an empty C button slot, automatically equip it to one of them. And since I'm already courting controversy, perhaps an option to automatically equip any new item as well, with which button it gets put on being easily customizable, just so there's parity with the equipment.
Finally, to make these changes actually useful beyond a few key points in the game, making it so equipment and items can be easily unequipable. For sword and shield, I say let Link go defenseless if he wants! Pressing the button on the equipment/item when it's already equipped would unequip it.
The text was updated successfully, but these errors were encountered: