OpenMW-CS: autocalc does not work for NPCs added with OpenMW-CS
open the objects table view > open "Caius Cosades" > select "add record" in the objects table > copy every entry from Caius to the new NPC (except the skills and attributes) > check/uncheck the "autocalc" -> the skills and attributes will not change from 0
Setting level to 1 didn't help.
I guess "autocalc" is intended to do the same as the TES-CS: set standard values for skills and attributes based on race (,class, level, gender and faction+rank).
OSG: OpenMW version 0.36.0 (revision 712cef36b0)
non-OSG: OpenMW version 0.36.0 (revision 67f04e0ba1)
#2 Updated by Who Knows over 2 years ago
Attributes depend on wether or not "Auto calculate stats" is checked for an NPC in the CS. If not, then the NPC's stats were predetermined. If yes, it is calculated with Attribute = Base Attribute + (Level - 1) * (Sum of Modifiers for every skill governed by Attribute)
Where the modifiers are:
Major skill: 1
Minor skill: 0.5
Misc. skill: 0.2
So a level 6 Orc Warrior (Long Blade as a Major skill, Axe, Blunt weapon, Armorer as Minor and Acrobatics as Misc.) should have 55 + (6 - 1) * (1 + 0.5 + 0.5 + 0.5 + 0.2) = 68.5 Strength, Which is rounded down to 68. Values ending in .1 - .5 are rounded down, .6 - .9 are rounded up.
Also NPC Magicka is Intelligence * 2 without racial/birthsign bonuses.
Fatigue is Strength + Willpower + Agility + Endurance
NPC's health is calculated with: ([Current Strength] + [Current Endurance]) / 2 + (Level - 1) * [Constant]
Where [Constant] in based on the NPC's specialization:
If one of the NPC's favoured attributes is Endurance, then the constant increases by 1
I guess the above is implemented already, isn't it?
I think that the base attributes and skills are based on the race, gender and class.
I will play with the TES-CS and try to give a basic formula in a few hours.
#6 Updated by Who Knows over 2 years ago
Attribute calculation should be something like
// attributes = [ "str" , "int" , ... ]
// fav_attribute contains the two attributes that can be choosen when making an own class, otherwise they are set by the class
FOREACH attribute IN attributes DO
result.[$attribute] = race.gender.[$attribute]
IF $attribute==fav_attributes0 THEN result.[$attribute] += 10
IF $attribute==fav_attributes1 THEN result.[$attribute] += 10
// easier than I thought
#7 Updated by Marc Zinnschlag over 2 years ago
That is a complicated questions. Code duplication is out of the question. I agree that moving the code to a component feels wrong. I was going to suggest to do it anyway, but then I noticed another problem:
We are unlikely to keep the hard-coded form of autocalc as it is. I would expect this being moved to scripts eventually, which means we can not do it in OpenMW-CS at all.
#8 Updated by cc 9cii over 2 years ago
- Status changed from New to Resolved
- Assignee set to cc 9cii
- % Done changed from 0 to 100
- Operating system changed from Linux to Other
@Zini, it turns out there isn't much of code duplication - the way openmw keeps/accesses data are different to opencs. The algorithms are necessarily the same but that's about it.
#9 Updated by Who Knows over 2 years ago
Maybe you can put the algorithm in a separate file like a "library" and access/use it by the CS and the game engine? I bet there are cases like that already. Like - I assume - the renderig in the edit-view of instances or such? I guess it would be easy to extend that lib for using selfmade formulae by overloading once that should be offered to modders.
#18 Updated by Marc Zinnschlag 12 months ago
- Target version changed from openmw-cs-1.0 to openmw-future
I am moving this issue to future for now. As discussed the whole feature may become problematic with the post 1.0 changes. Better not waste time on it now and instead tackle (or reject) it after we know exactly where we stand with the post 1.0 enhancements.