Difference between revisions of "LeveledSpell"
imported>Egocarib |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
A [[LeveledSpell]] is a leveled list that will select a [[Spell]] based on the | A [[LeveledSpell]] is a leveled list that will select a [[Spell]] based on the npc's skill level (Destruction, Restoration, etc.), is does NOT work like regular [[LeveledItem|LeveledItems]] which are based on the player's level! LeveledSpell lists can only be used in the [[SpellList Tab|SpellList]] for an [[:Category:Actor|Actor]]. | ||
Since most Actors have fixed levels, they are usually assigned specific spells appropriate to their level, instead of LeveledSpells. However, LeveledSpells are still useful for selecting a random spell from among a fixed set (such as LSpellWalls or LSpellCloak50) or for assigning a level-appropriate spell to an Actor that levels with the player. | Since most Actors have fixed levels, they are usually assigned specific spells appropriate to their level, instead of LeveledSpells. However, LeveledSpells are still useful for selecting a random spell from among a fixed set (such as LSpellWalls or LSpellCloak50) or for assigning a level-appropriate spell to an Actor that levels with the player. | ||
Line 8: | Line 8: | ||
===Leveled Spell Form Data=== | ===Leveled Spell Form Data=== | ||
*'''ID:''' The Form ID of the object. | *'''ID:''' The Form ID of the object. | ||
*'''Calculate from all levels <= PC's level:''' If checked, the | *'''Calculate from all levels <= PC's level:''' If checked, the leveled list will use any spell at or below the npc's skill level in the list. If not checked, it uses the closest spell to the npc's skill level, but not exceeding it. | ||
*'''Calculate for each item in count:''' If this list is in another leveled list with a count greater than zero, this check box determines if each item in the count is the same, or is recalculated. This is frequently used for [[LeveledItem|LeveledItems]], but rarely for LeveledSpells, since there is no point in having multiple copies of the same spell. | *'''Calculate for each item in count:''' If this list is in another leveled list with a count greater than zero, this check box determines if each item in the count is the same, or is recalculated. This is frequently used for [[LeveledItem|LeveledItems]], but rarely for LeveledSpells, since there is no point in having multiple copies of the same spell. | ||
===Leveled Spell List=== | ===Leveled Spell List=== | ||
For each character in the list, this form indicates: | For each character in the list, this form indicates: | ||
*'''Level:''' The selected spell's associated level. | *'''Level:''' The selected spell's associated skill level. The npc must have at least have a skill as seen in the [[Stats Tab]] (Destruction, Restoration, etc.) | ||
*'''Count:''' Not used. | *'''Count:''' Not used. | ||
*'''Form Editor ID:''' The Form ID of the selected spell. | *'''Form Editor ID:''' The Form ID of the selected spell. | ||
*'''Object:''' The Form ID of the selected spell. | *'''Object:''' The Form ID of the selected spell. | ||
*'''Preview Calculated Result:''' Given a '''Preview Level''' and '''Preview Count''', generates sample output from this list. | *'''Preview Calculated Result:''' Given a '''Preview Level''' and '''Preview Count''', generates sample output from this list. '''Note: This preview doesn't work properly as it's based on algorithm for [[LeveledItem|LeveledItems]].''' | ||
== Spell Selection Algorithm == | |||
<syntaxhighlight lang="c#"> | |||
// The first spell in the list determines the magic skill that the LeveledSpell | |||
var listMagicSkill = leveledSpell.Entries[0].Spell.GetMagicSkill() | |||
var bestSpell = null | |||
foreach (var spellEntry leveledSpell.Entries) | |||
// Abort if the spell's magic skill doesn't the skill of the first entry | |||
if (spellEntry.Spell.GetMagicSkill() != listMagicSkill) { | |||
break; | |||
} | |||
// Abort if the npc's skill level is below the entry's required level | |||
if (spellEntry.Level > npc.ActorValues[listMagicSkill]) { | |||
break; | |||
} | |||
bestSpell = spell | |||
} | |||
return bestSpell | |||
</syntaxhighlight> | |||
=== Example === | |||
[[File:Leveled Spell Example.png|left|thumb|535x535px]] | |||
See this LeveledSpell as an example. Oakflesh is the first entry in the list, so it means that this is an Alteration LeveledSpell. Let's say the actor we want to apply this LeveledSpell to has 60 Alteration and 60 Destruction. First, Oakflesh is selected as the best spell, then Stoneflesh because the actor's 60 Alteration surpass the 25 requirement for Stonflesh. At Flames the loop breaks, because Flames is not an Alteration spell, but a Destruction spell, even though the npc surpasses the requirement for flames which is set to 50 with the actor's 60 Destruction value. In the end this means the selected spell here can never go beyond Stoneflesh, as Flames will be a cutoff point no matter what. | |||
In case Flames is not part of this list, it would go as you expect and starting with Alteration level 75 actors would get Ebonyflesh. This means that you should never mix different magic skills within the same list, unless you use the Use All Spells flag! | |||
Also note that this example used the minimum skill level set of Stoneflesh, Ironflesh and Ebonyflesh set in their [[Magic Effect]]. If the level requirements in the LeveledSpell was set differently, the npcs would still be able to obtain the spells based on their Alteration level, but they wouldn't be able to use them until they've suprassed the minimum skill level of the spell's magic effect. | |||
== Notes == | |||
* Make sure that the skill level that you set a spell in the list, is at least the '''Minimum Skill Level''' of the spell's [[Magic Effect]]. Otherwise the actor will get a spell that they '''can't use'''. | |||
* Make sure that you '''don't mix different magic skills''' within the same list, '''unless''' you use the '''Use All Spells''' flag. The spells with different magic skills will not be used, and will even block higher level spells of the right magic skill from appearing. The magic skill relevant for the list is based on the first spell. Inside the spell, the magic effects determine the magic skill of the spell. | |||
{{Languages|LeveledSpell}} | {{Languages|LeveledSpell}} | ||
[[Category:Magic]] | [[Category:Magic]] | ||
[[Category:Object Classes]] | [[Category:Object Classes]] | ||
[[Category:Leveled Lists]] | [[Category:Leveled Lists]] |
Latest revision as of 09:05, 18 August 2024
A LeveledSpell is a leveled list that will select a Spell based on the npc's skill level (Destruction, Restoration, etc.), is does NOT work like regular LeveledItems which are based on the player's level! LeveledSpell lists can only be used in the SpellList for an Actor.
Since most Actors have fixed levels, they are usually assigned specific spells appropriate to their level, instead of LeveledSpells. However, LeveledSpells are still useful for selecting a random spell from among a fixed set (such as LSpellWalls or LSpellCloak50) or for assigning a level-appropriate spell to an Actor that levels with the player.
Leveled Spell Dialog[edit | edit source]
Leveled Spell Form Data[edit | edit source]
- ID: The Form ID of the object.
- Calculate from all levels <= PC's level: If checked, the leveled list will use any spell at or below the npc's skill level in the list. If not checked, it uses the closest spell to the npc's skill level, but not exceeding it.
- Calculate for each item in count: If this list is in another leveled list with a count greater than zero, this check box determines if each item in the count is the same, or is recalculated. This is frequently used for LeveledItems, but rarely for LeveledSpells, since there is no point in having multiple copies of the same spell.
Leveled Spell List[edit | edit source]
For each character in the list, this form indicates:
- Level: The selected spell's associated skill level. The npc must have at least have a skill as seen in the Stats Tab (Destruction, Restoration, etc.)
- Count: Not used.
- Form Editor ID: The Form ID of the selected spell.
- Object: The Form ID of the selected spell.
- Preview Calculated Result: Given a Preview Level and Preview Count, generates sample output from this list. Note: This preview doesn't work properly as it's based on algorithm for LeveledItems.
Spell Selection Algorithm[edit | edit source]
// The first spell in the list determines the magic skill that the LeveledSpell
var listMagicSkill = leveledSpell.Entries[0].Spell.GetMagicSkill()
var bestSpell = null
foreach (var spellEntry leveledSpell.Entries)
// Abort if the spell's magic skill doesn't the skill of the first entry
if (spellEntry.Spell.GetMagicSkill() != listMagicSkill) {
break;
}
// Abort if the npc's skill level is below the entry's required level
if (spellEntry.Level > npc.ActorValues[listMagicSkill]) {
break;
}
bestSpell = spell
}
return bestSpell
Example[edit | edit source]
See this LeveledSpell as an example. Oakflesh is the first entry in the list, so it means that this is an Alteration LeveledSpell. Let's say the actor we want to apply this LeveledSpell to has 60 Alteration and 60 Destruction. First, Oakflesh is selected as the best spell, then Stoneflesh because the actor's 60 Alteration surpass the 25 requirement for Stonflesh. At Flames the loop breaks, because Flames is not an Alteration spell, but a Destruction spell, even though the npc surpasses the requirement for flames which is set to 50 with the actor's 60 Destruction value. In the end this means the selected spell here can never go beyond Stoneflesh, as Flames will be a cutoff point no matter what.
In case Flames is not part of this list, it would go as you expect and starting with Alteration level 75 actors would get Ebonyflesh. This means that you should never mix different magic skills within the same list, unless you use the Use All Spells flag!
Also note that this example used the minimum skill level set of Stoneflesh, Ironflesh and Ebonyflesh set in their Magic Effect. If the level requirements in the LeveledSpell was set differently, the npcs would still be able to obtain the spells based on their Alteration level, but they wouldn't be able to use them until they've suprassed the minimum skill level of the spell's magic effect.
Notes[edit | edit source]
- Make sure that the skill level that you set a spell in the list, is at least the Minimum Skill Level of the spell's Magic Effect. Otherwise the actor will get a spell that they can't use.
- Make sure that you don't mix different magic skills within the same list, unless you use the Use All Spells flag. The spells with different magic skills will not be used, and will even block higher level spells of the right magic skill from appearing. The magic skill relevant for the list is based on the first spell. Inside the spell, the magic effects determine the magic skill of the spell.
Language: | English • 日本語 |
---|