by Selene310187 » Mon Jan 09, 2023 11:59 pm
Samuel's signature spell is done. It does 25 points of damage to the target's health and there is a 33 % chance that
one of the following additional effects is applied to the target:
- pushes the target away
- paralysis the target for 10 seconds
- depletes all magicka of the target for 10 seconds
I did my best to make the spell not too powerful by adding the 33 % chance, limiting the damage to 25 points only, and that the three additional effects cannot occur simultaneously. If you find that the spell is still too powerful you can exchange it with one of the default Apprentice Destruction spells (Firebolt, Ice Spike or Lightning Bolt) via the settings menu.
I also finished the assignation of the different combat styles (Mage, Spellsword, Two-Handed and Missile aka Archer) which happens automatically when the follower equips the corresponding weapon. So if Samuel equips a one-handed sword, his combat style changes to Spellsword, and if you remove the weapon from his inventory, the combat style changes back to Mage which is his default combat style. And he equips any weapon that you put in his inventory instantly.
Edit:
I will make the combat style auto-assignation and the auto-equip weapon feature both toggleable. If you prefer the combat style handling of AFT for example, you can turn the combat style auto-assignation off anytime.
Equip weapon and ammo automatically and execute the UpdateCombatSkills function:
Code: Select all
Actor Property Samuel Auto
Actor Property PlayerRef Auto
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
if akSourceContainer == PlayerRef
if (akBaseItem as Weapon) || (akBaseItem as Ammo)
Samuel.equipitem(akBaseItem)
endif
UpdateCombatSkills()
endif
EndEvent
Execute the UpdateCombatSkills function when a weapon is removed:
Code: Select all
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
if akDestContainer == PlayerRef
if (akBaseItem as Weapon)
UpdateCombatSkills()
endif
endif
EndEvent
The UpdateCombatSkills function modifies the combat skills according to the type of the equipped weapons (GetEquippedItemType):
Code: Select all
GlobalVariable Property CombatSpellGlobal Auto
GlobalVariable Property CombatStyleGlobal Auto
Spell Property SpellSignature Auto
Spell Property SpellFire Auto
Spell Property SpellFrost Auto
Spell Property SpellShock Auto
Function UpdateCombatSkills()
int CombatSpellInt = CombatSpellGlobal.getvalueint()
Samuel.removespell(SpellSignature)
Samuel.removespell(SpellFire)
Samuel.removespell(SpellFrost)
Samuel.removespell(SpellShock)
;=== setting the appropriate combat styles, spells and skills
if Samuel.GetEquippedItemType(0) == 0 && Samuel.GetEquippedItemType(1) == 0
;debug.notification("no weapon")
Samuel.forceav("destruction", Samuel.getbaseav("destruction"))
Samuel.forceav("destruction", Samuel.getbaseav("destruction") + 50)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
CombatStyleGlobal.setvalue(0)
; signature spell
if CombatSpellInt == 1
Samuel.AddSpell(SpellSignature)
; fire spell
elseif CombatSpellInt == 2
Samuel.AddSpell(SpellFire)
; frost spell
elseif CombatSpellInt == 3
Samuel.AddSpell(SpellFrost)
; shock spell
elseif CombatSpellInt == 4
Samuel.AddSpell(SpellShock)
endif
;--- one-handed swords, daggers, axes and maces
elseif (Samuel.GetEquippedItemType(1) > 0 && Samuel.GetEquippedItemType(1) < 5)
;debug.notification("one-handed")
Samuel.forceav("destruction", Samuel.getbaseav("destruction"))
Samuel.forceav("destruction", Samuel.getbaseav("destruction") + 25)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") +50)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
CombatStyleGlobal.setvalue(1)
; signature spell
if CombatSpellInt == 1
Samuel.AddSpell(SpellSignature)
; fire spell
elseif CombatSpellInt == 2
Samuel.AddSpell(SpellFire)
; frost spell
elseif CombatSpellInt == 3
Samuel.AddSpell(SpellFrost)
; shock spell
elseif CombatSpellInt == 4
Samuel.AddSpell(SpellShock)
endif
;--- two-handed swords and axes/maces
elseif Samuel.GetEquippedItemType(1) > 4 && Samuel.GetEquippedItemType(1) < 7
;debug.notification("two-handed")
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") +50)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
CombatStyleGlobal.setvalue(2)
;--- bows
elseif Samuel.GetEquippedItemType(0) == 7
;debug.notification("bow")
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") +50)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
CombatStyleGlobal.setvalue(3)
;--- staffs
elseif Samuel.GetEquippedItemType(1) == 8 || Samuel.GetEquippedItemType(0) == 8
;debug.notification("staffs")
Samuel.forceav("destruction", Samuel.getbaseav("destruction"))
Samuel.forceav("destruction", Samuel.getbaseav("destruction") + 25)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") +50)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
CombatStyleGlobal.setvalue(1)
; signature spell
if CombatSpellInt == 1
Samuel.AddSpell(SpellSignature)
; fire spell
elseif CombatSpellInt == 2
Samuel.AddSpell(SpellFire)
; frost spell
elseif CombatSpellInt == 3
Samuel.AddSpell(SpellFrost)
; shock spell
elseif CombatSpellInt == 4
Samuel.AddSpell(SpellShock)
endif
;--- crossbows
elseif Samuel.GetEquippedItemType(1) == 12 || Samuel.GetEquippedItemType(0) == 12
;debug.notification("crossbows")
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") +50)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
CombatStyleGlobal.setvalue(3)
endif
EndFunction
The CombatStyleGlobal is used as a condition for each combat package (which is set to "
Interrupt Override: Combat"; Template: Hold Position; Location: near package start location; Radius: 2500; and the Combat Style of your choice). The packages are part of a formlist which is assigned as Combat Override Package list to the ReferenceAlias of Samuel (see
Quest Alias Tab).
Samuel's signature spell is done. It does 25 points of damage to the target's health and there is a 33 % chance that [b][i][color=#BFFFFF]one[/color][/i][/b] of the following additional effects is applied to the target:
[list][*]pushes the target away
[*]paralysis the target for 10 seconds
[*]depletes all magicka of the target for 10 seconds[/list]
I did my best to make the spell not too powerful by adding the 33 % chance, limiting the damage to 25 points only, and that the three additional effects cannot occur simultaneously. If you find that the spell is still too powerful you can exchange it with one of the default Apprentice Destruction spells (Firebolt, Ice Spike or Lightning Bolt) via the settings menu.
I also finished the assignation of the different combat styles (Mage, Spellsword, Two-Handed and Missile aka Archer) which happens automatically when the follower equips the corresponding weapon. So if Samuel equips a one-handed sword, his combat style changes to Spellsword, and if you remove the weapon from his inventory, the combat style changes back to Mage which is his default combat style. And he equips any weapon that you put in his inventory instantly.
Edit:
I will make the combat style auto-assignation and the auto-equip weapon feature both toggleable. If you prefer the combat style handling of AFT for example, you can turn the combat style auto-assignation off anytime.
[spoiler title=Papyrus code snippets for those who are interested in the technical details]
[i]Equip weapon and ammo automatically and execute the UpdateCombatSkills function:[/i]
[code]
Actor Property Samuel Auto
Actor Property PlayerRef Auto
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
if akSourceContainer == PlayerRef
if (akBaseItem as Weapon) || (akBaseItem as Ammo)
Samuel.equipitem(akBaseItem)
endif
UpdateCombatSkills()
endif
EndEvent[/code]
[i]Execute the UpdateCombatSkills function when a weapon is removed:[/i]
[code]Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
if akDestContainer == PlayerRef
if (akBaseItem as Weapon)
UpdateCombatSkills()
endif
endif
EndEvent[/code]
[i]The UpdateCombatSkills function modifies the combat skills according to the type of the equipped weapons ([url=https://www.creationkit.com/index.php?title=GetEquippedItemType_-_Actor]GetEquippedItemType[/url]):[/i]
[code]
GlobalVariable Property CombatSpellGlobal Auto
GlobalVariable Property CombatStyleGlobal Auto
Spell Property SpellSignature Auto
Spell Property SpellFire Auto
Spell Property SpellFrost Auto
Spell Property SpellShock Auto
Function UpdateCombatSkills()
int CombatSpellInt = CombatSpellGlobal.getvalueint()
Samuel.removespell(SpellSignature)
Samuel.removespell(SpellFire)
Samuel.removespell(SpellFrost)
Samuel.removespell(SpellShock)
;=== setting the appropriate combat styles, spells and skills
if Samuel.GetEquippedItemType(0) == 0 && Samuel.GetEquippedItemType(1) == 0
;debug.notification("no weapon")
Samuel.forceav("destruction", Samuel.getbaseav("destruction"))
Samuel.forceav("destruction", Samuel.getbaseav("destruction") + 50)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
CombatStyleGlobal.setvalue(0)
; signature spell
if CombatSpellInt == 1
Samuel.AddSpell(SpellSignature)
; fire spell
elseif CombatSpellInt == 2
Samuel.AddSpell(SpellFire)
; frost spell
elseif CombatSpellInt == 3
Samuel.AddSpell(SpellFrost)
; shock spell
elseif CombatSpellInt == 4
Samuel.AddSpell(SpellShock)
endif
;--- one-handed swords, daggers, axes and maces
elseif (Samuel.GetEquippedItemType(1) > 0 && Samuel.GetEquippedItemType(1) < 5)
;debug.notification("one-handed")
Samuel.forceav("destruction", Samuel.getbaseav("destruction"))
Samuel.forceav("destruction", Samuel.getbaseav("destruction") + 25)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") +50)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
CombatStyleGlobal.setvalue(1)
; signature spell
if CombatSpellInt == 1
Samuel.AddSpell(SpellSignature)
; fire spell
elseif CombatSpellInt == 2
Samuel.AddSpell(SpellFire)
; frost spell
elseif CombatSpellInt == 3
Samuel.AddSpell(SpellFrost)
; shock spell
elseif CombatSpellInt == 4
Samuel.AddSpell(SpellShock)
endif
;--- two-handed swords and axes/maces
elseif Samuel.GetEquippedItemType(1) > 4 && Samuel.GetEquippedItemType(1) < 7
;debug.notification("two-handed")
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") +50)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
CombatStyleGlobal.setvalue(2)
;--- bows
elseif Samuel.GetEquippedItemType(0) == 7
;debug.notification("bow")
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") +50)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
CombatStyleGlobal.setvalue(3)
;--- staffs
elseif Samuel.GetEquippedItemType(1) == 8 || Samuel.GetEquippedItemType(0) == 8
;debug.notification("staffs")
Samuel.forceav("destruction", Samuel.getbaseav("destruction"))
Samuel.forceav("destruction", Samuel.getbaseav("destruction") + 25)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") +50)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") - Samuel.getbaseav("marksman") * 0.5)
CombatStyleGlobal.setvalue(1)
; signature spell
if CombatSpellInt == 1
Samuel.AddSpell(SpellSignature)
; fire spell
elseif CombatSpellInt == 2
Samuel.AddSpell(SpellFire)
; frost spell
elseif CombatSpellInt == 3
Samuel.AddSpell(SpellFrost)
; shock spell
elseif CombatSpellInt == 4
Samuel.AddSpell(SpellShock)
endif
;--- crossbows
elseif Samuel.GetEquippedItemType(1) == 12 || Samuel.GetEquippedItemType(0) == 12
;debug.notification("crossbows")
Samuel.forceav("marksman", Samuel.getbaseav("marksman"))
Samuel.forceav("marksman", Samuel.getbaseav("marksman") +50)
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded"))
Samuel.forceav("onehanded", Samuel.getbaseav("onehanded") - Samuel.getbaseav("onehanded") * 0.5)
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded"))
Samuel.forceav("twohanded", Samuel.getbaseav("twohanded") - Samuel.getbaseav("twohanded") * 0.5)
CombatStyleGlobal.setvalue(3)
endif
EndFunction[/code]
The CombatStyleGlobal is used as a condition for each combat package (which is set to "[url=https://www.creationkit.com/index.php?title=Interrupt_Override_Packages]Interrupt Override[/url]: Combat"; Template: Hold Position; Location: near package start location; Radius: 2500; and the Combat Style of your choice). The packages are part of a formlist which is assigned as Combat Override Package list to the ReferenceAlias of Samuel (see [url=https://www.creationkit.com/index.php?title=Quest_Alias_Tab]Quest Alias Tab[/url]).
[/spoiler]