-
Notifications
You must be signed in to change notification settings - Fork 83
Progress on recreating Arena item generation #308
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
Conversation
|
Thanks, looking this over. I don't love the string comparisons and Shield/shield stuff because that will break with translated mods. Need to think. |
|
Regarding Shield/shield, although it looks nicer to have "Kite Shield" and "Tower Shield" because the capitalization is consistent with other items (including "Round Shield"), the original game uses the names from If by translated mods you mean translations of the original game executable, wouldn't those then work because all the names are read from the executable? |
|
Ohhh it's because the two name arrays have inconsistent casing, lame. You tried mapping the original items to ItemLibrary items by name. This should probably do an itemID lookup instead. |
Need to provide armor material to the ItemLibrary predicate.
|
I think my fix should work for loot piles, they'll always be plate. |
Yes, but I see that as a mistake in the original game's code, currently replicated by the helper (I think it's supposed to randomly be leather, chain or plate). I was thinking eventually we would have an option to fix, such as by having multiple helper functions (fixed ones, original buggy ones, etc.). I don't think it should be hardcoded outside of the helper functions. The "always being plate" occurs for both loot piles and items on creatures, as they both call the same function, using -1 for material. I'm not sure about human enemies yet, although I believe they can have leather or chain by specifying the material instead of using -1. Also, you may have noticed but I don't think the new lookup functions are handling shields yet. |
Also allows any armor material, not just plate.
|
I see you changed it to random material, and fixed for shields. The random material patches the result of the helper function to what I theorize as the intended behavior, but shouldn't we just add an out parameter for base material to |
|
Okay, it's hardcoded to Plate in those ArenaEntityUtils functions. |
|
I think that's fine for now. Enemy humans can have leather or chain, but they will be using a new function to initiate armor generation. For them, we'll need to retrieve the base material from |
|
Will be glad once we're done with this ancient hacky game logic. |
|
I'm mostly just doing this as a hobby, as I get satisfaction out of the mental exercise and seeing the game slowly come to life. But I'd say don't feel like you have to quickly respond to my PRs or even keep the project going if you get tired of it. Who knows, in a few years we might be able to just ask an AI to finish the whole thing for us. |
This covers lots of things but they are all related to item generation.
First, there are some corrections to existing things:
armorNames("Cuirass", etc.) to get the names for plate armor items and hadplateArmorNamescommented out with a comment that you weren't sure "ordinary" plate exists in the game. The original game usesplateArmorNames("Plate Cuirass", etc.) for plate armor without a material bonus. This PR gets the names fromplateArmorNamesnow and has commented outarmorNamesuntil materials are handled.Next, the new things:
Gets non-magic weapons and armors for loot objects like the original game.
During this process the original game calls a function to get the item quality, but it doesn't use the result, overriding it with 16. The function is also called during magic item generation, which isn't implemented yet. The function is included in this PR for later use with magic item generation.
In the process of getting the non-magic weapon or armor, the original game refers to a set of values that looks like [0, 0, 1, 1, 0], which is accessed using the lootValueIndex. A 0 means to generate with either 25% condition, 75% condition or 100%, like with items on creatures, while a 1 means to generate with either 75%, 100% or 100% (2/3 chance of 100%). Effectively this means that these weapons and armor found in places with index 2 or 3 (NOBLE or DUNGEON) are more likely to have good condition. Since item condition isn't handled yet this isn't hooked up, but the code is there.
Added some simple functions to use the itemIDs returned by the Arena functions to get items from the OpenTESArena ItemLibrary via the item display names. Feel free to replace these if you want. While making them I discovered that there is a discrepancy in shield names. The armor lists for leather, chain and plate use "Kite shield" and "Tower shield" with a lowercase "s," and this (specifically, the plate list) is what the original game uses for getting the names of these items when generating a non-magic armor/weapon (BTW, the non-magic armor/weapon generation also means no material bonus). Meanwhile the
armorValueslist, which is used to create names of material plate armor, uses "Kite Shield" and "Tower Shield". ItemLibrary is getting the names for shields from this list, so in the itemID-to-name function, I replace "shield" with "Shield," since I am reading the names fromplateArmors, to match the names in ItemLibrary. I used these functions to hook up non-magic weapon and armor generation to item generation on creatures and in loot. Only plate armor will appear (as explained in Recreate Arena logic for weapon/armor generation #301). Any leather or chain items that appear are due to the test placeholder for magic weapons and armor, not these functions. The non-magic weapons/armor that appear on creatures are not 1-to-1 with the original game because they aren't affected by the can-equip check.