582 lines
22 KiB
Plaintext
582 lines
22 KiB
Plaintext
|
Scriptname _00E_Phasmalist_ApparationAlias extends ReferenceAlias
|
||
|
; on Abilities/_00E_A3_PhasmalistApparation
|
||
|
; script that controls the apparation stats calculation and initialization. Additionally, it is responsible for the control of the apparation communication while it is summoned
|
||
|
|
||
|
; we prefer to place new actors instead of using only one actor
|
||
|
; due to the problem of keeping track of all apparations,
|
||
|
; which might create memory leaks because of persistence;
|
||
|
; Additionally, temporary or accidental changes do not cumulate
|
||
|
; and lead to problems
|
||
|
|
||
|
; balancing data
|
||
|
float Property apparationManaRate = 1 AutoReadOnly Hidden
|
||
|
|
||
|
float Property playerStatsMultiplier = 0.20 AutoReadOnly Hidden
|
||
|
float Property playerConjSkillMultiplier = 0.10 AutoReadOnly Hidden
|
||
|
float Property playerEnchSkillMultiplier = 0.15 AutoReadOnly Hidden
|
||
|
|
||
|
float Property fArcaneFeverLevel01 = 7.00 AutoReadOnly Hidden
|
||
|
float Property fArcaneFeverLevel02 = 6.00 AutoReadOnly Hidden
|
||
|
float Property fArcaneFeverLevel03 = 5.00 AutoReadOnly Hidden
|
||
|
|
||
|
int Property fArcaneFeverModWarrior = -1 AutoReadOnly Hidden
|
||
|
int Property fArcaneFeverModRanger = 0 AutoReadOnly Hidden
|
||
|
int Property fArcaneFeverModHybrid = 0 AutoReadOnly Hidden
|
||
|
int Property fArcaneFeverModMage = 1 AutoReadOnly Hidden
|
||
|
|
||
|
int Property ghostlyMageBoostDestructionPowerMod1 = 7 AutoReadOnly Hidden
|
||
|
int Property ghostlyMageBoostDestructionPowerMod2 = 15 AutoReadOnly Hidden
|
||
|
int Property ghostlyMageBoostDestructionPowerMod3 = 25 AutoReadOnly Hidden
|
||
|
|
||
|
int Property ghostlyMageBoostMagicka1 = 15 AutoReadOnly Hidden
|
||
|
int Property ghostlyMageBoostMagicka2 = 40 AutoReadOnly Hidden
|
||
|
int Property ghostlyMageBoostMagicka3 = 75 AutoReadOnly Hidden
|
||
|
|
||
|
int Property ghostlyRangerBoostArchery1 = 7 AutoReadOnly Hidden
|
||
|
int Property ghostlyRangerBoostArchery2 = 17 AutoReadOnly Hidden
|
||
|
int Property ghostlyRangerBoostArchery3 = 30 AutoReadOnly Hidden
|
||
|
|
||
|
int Property ghostlyRangerBoostCritChance1 = 7 AutoReadOnly Hidden
|
||
|
int Property ghostlyRangerBoostCritChance2 = 15 AutoReadOnly Hidden
|
||
|
int Property ghostlyRangerBoostCritChance3 = 25 AutoReadOnly Hidden
|
||
|
|
||
|
int Property ghostlyWarriorBoostMelee1 = 7 AutoReadOnly Hidden
|
||
|
int Property ghostlyWarriorBoostMelee2 = 17 AutoReadOnly Hidden
|
||
|
int Property ghostlyWarriorBoostMelee3 = 30 AutoReadOnly Hidden
|
||
|
|
||
|
int Property ghostlyWarriorBoostArmorSkill1 = 7 AutoReadOnly Hidden
|
||
|
int Property ghostlyWarriorBoostArmorSkill2 = 17 AutoReadOnly Hidden
|
||
|
int Property ghostlyWarriorBoostArmorSkill3 = 30 AutoReadOnly Hidden
|
||
|
|
||
|
int Property iCallApparitionKeyCode = 34 Auto Hidden
|
||
|
|
||
|
Explosion Property enterWorldExplosion auto
|
||
|
|
||
|
Perk Property _00E_Class_Phasmalist_P04_Talent_SummonApparation auto
|
||
|
Perk Property _00E_Class_Phasmalist_P04_Talent_SummonApparation2 auto
|
||
|
Perk Property _00E_Class_Phasmalist_P04_Talent_SummonApparation3 auto
|
||
|
|
||
|
Static Property XMarker Auto
|
||
|
|
||
|
Perk Property _00E_Class_Phasmalist_P08a auto
|
||
|
|
||
|
Perk[] Property _00E_Class_Phasmalist_P05a_ABC auto ; ghostly mage
|
||
|
{ghostly mage perks, this array should have 3 elements for all 3 perks}
|
||
|
Perk[] Property _00E_Class_Phasmalist_P05b_ABC auto ; ghostly ranger
|
||
|
{ghostly ranger perks, this array should have 3 elements for all 3 perks}
|
||
|
Perk[] Property _00E_Class_Phasmalist_P05c_ABC auto ; ghostly warrior
|
||
|
{ghostly warrior perks, this array should have 3 elements for all 3 perks}
|
||
|
|
||
|
Location Property _00E_Dreamworld_Location auto
|
||
|
Keyword Property _00E_Phasmalist_NoSummonLocation auto
|
||
|
Message Property _00E_Phasmalist_NoSummoningMessage auto
|
||
|
Keyword Property _00E_Phasmalist_NoSummonLocationTown auto
|
||
|
Message Property _00E_Phasmalist_CurrentlyEquipped auto
|
||
|
Message Property _00E_Phasmalist_NoSummoningMessageTown auto
|
||
|
|
||
|
Sound Property MAGAlterationInvisibilityIn Auto
|
||
|
Sound Property MAGAlterationInvisibilityOut Auto
|
||
|
|
||
|
Perk Property _00E_Class_Phasmalist_P08b auto ; apparations can exist in towns
|
||
|
|
||
|
EffectShader Property _00E_Phasmalist_ApparitionShaderFXS Auto
|
||
|
|
||
|
ImageSpaceModifier Property _00E_ArkanistenfieberIMOD Auto
|
||
|
ImageSpaceModifier Property _00E_Phasmalist_ApparitionEnterWorldIMOD Auto
|
||
|
|
||
|
Sound Property _00E_FS_IncreaseArcaneFeverM Auto
|
||
|
;Sound Property _00E_FS_Phasmalist_EnterWorld_Male Auto
|
||
|
;Sound Property _00E_FS_Phasmalist_EnterWorld_Female Auto
|
||
|
|
||
|
_00E_GUI_ActorHealthBar Property _ActorHealthBarShower Auto
|
||
|
|
||
|
_00E_GUI_ActorHealthBar Property ActorHealthBarShower
|
||
|
_00E_GUI_ActorHealthBar Function Get()
|
||
|
If (_ActorHealthBarShower == None)
|
||
|
_ActorHealthBarShower = Game.GetFormFromFile(0x01024b66, "Enderal - Forgotten Stories.esm") as _00E_GUI_ActorHealthBar
|
||
|
EndIf
|
||
|
return _ActorHealthBarShower
|
||
|
EndFunction
|
||
|
EndProperty
|
||
|
|
||
|
Message Property _00E_BlitzheilungArkanistenfieber_sFeverIncreased Auto
|
||
|
GlobalVariable Property _00E_Phasmalist_IsApparationSummoned Auto
|
||
|
|
||
|
Keyword Property _00E_FS_Magic_Summon auto ; the apparation should not be able to learn certain spells
|
||
|
Keyword Property _00E_FS_Magic_Mystical auto
|
||
|
|
||
|
int currentBoostMagicka ; this is set in adjustBoost() to have the attribute set correctly in the stats calculation
|
||
|
|
||
|
_00E_Phasmalist_TrinketSC equippedTrinket
|
||
|
|
||
|
Actor Property PlayerREF Auto
|
||
|
|
||
|
Formlist Property _00E_AllAmmos Auto
|
||
|
|
||
|
; for a description, look to the function failsaveRefillOnLoad() of this script
|
||
|
Actor failsave_content
|
||
|
|
||
|
; functions that are called from the trinkets to keep track of the currently equipped trinket --------------------------------------------------------------------------------------------
|
||
|
|
||
|
function onTrinketEquipped(_00E_Phasmalist_TrinketSC trinket)
|
||
|
equippedTrinket = trinket
|
||
|
Endfunction
|
||
|
|
||
|
function onTrinketUnequipped(_00E_Phasmalist_TrinketSC trinket)
|
||
|
unsummonIfExists()
|
||
|
If trinket == equippedTrinket
|
||
|
equippedTrinket = None
|
||
|
EndIf
|
||
|
Endfunction
|
||
|
|
||
|
_00E_Phasmalist_TrinketSC function getEquippedTrinket()
|
||
|
return equippedTrinket
|
||
|
Endfunction
|
||
|
|
||
|
; summon and unsummon ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
||
|
function playEnterWorldVisualsAndSound()
|
||
|
ObjectReference expMarker = self.getRef().placeAtMe(XMarker)
|
||
|
expMarker.MoveTo(self.GetRef(), 0.0, 0.0, 15)
|
||
|
expMarker.PlaceAtMe(enterWorldExplosion)
|
||
|
expMarker.delete()
|
||
|
|
||
|
;If self.getActorRef().getActorBase().GetSex() == 0
|
||
|
;_00E_FS_Phasmalist_EnterWorld_Male.Play(Game.getPlayer())
|
||
|
;Else
|
||
|
;_00E_FS_Phasmalist_EnterWorld_Female.Play(Game.getPlayer())
|
||
|
;EndIf
|
||
|
Endfunction
|
||
|
|
||
|
function enterWorld(bool silent = false)
|
||
|
{Initializes the content of this alias; this includes calculating stats, placing an explosion and enabling the object}
|
||
|
failsave_content = self.getActorReference()
|
||
|
_00E_Phasmalist_IsApparationSummoned.setValue(1)
|
||
|
init() ; init stats before any armor buffs are applied
|
||
|
|
||
|
If !silent
|
||
|
_00E_Phasmalist_ApparitionEnterWorldIMOD.Apply()
|
||
|
EndIf
|
||
|
(failsave_content.GetActorBase() as _00E_Phasmalist_ApparationSC).inventoryContainer.removeAllItems(failsave_content, false, true)
|
||
|
addSpells()
|
||
|
failsave_content.blockActivation()
|
||
|
failsave_content.enable()
|
||
|
|
||
|
; empty function?
|
||
|
;(failsave_content.getActorBase() as _00E_Phasmalist_ApparationSC).onSummon(failsave_content)
|
||
|
|
||
|
If !silent
|
||
|
playEnterWorldVisualsAndSound()
|
||
|
EndIf
|
||
|
SendModEvent("Phasmalist_ApparationSummon")
|
||
|
Endfunction
|
||
|
|
||
|
function unsummon(bool silent = false)
|
||
|
{Unsummons the phasmalist apparation content of this alias; should be used instead of delete()}
|
||
|
Actor SelfREF = self.GetActorReference()
|
||
|
If (!silent)
|
||
|
SelfREF.placeAtMe(enterWorldExplosion)
|
||
|
addArcaneFever()
|
||
|
EndIf
|
||
|
|
||
|
; empty function?
|
||
|
;(SelfREF.getActorBase() as _00E_Phasmalist_ApparationSC).onUnsummon(SelfREF)
|
||
|
SelfREF.disable()
|
||
|
SelfREF.removeAllItems((SelfREF.GetActorBase() as _00E_Phasmalist_ApparationSC).inventoryContainer, false, true)
|
||
|
_00E_Phasmalist_IsApparationSummoned.setValue(0)
|
||
|
_RemoveApparationHealthBar()
|
||
|
SelfREF.delete()
|
||
|
self.clear()
|
||
|
failsave_content = None
|
||
|
SendModEvent("Phasmalist_ApparationUnSummon")
|
||
|
Endfunction
|
||
|
|
||
|
function unsummonIfExists()
|
||
|
If getRef()
|
||
|
unsummon()
|
||
|
EndIf
|
||
|
Endfunction
|
||
|
|
||
|
; utility functions ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
||
|
Function _RemoveApparationHealthBar()
|
||
|
ActorHealthBarShower.RemoveActorRaw(self.getActorReference())
|
||
|
EndFunction
|
||
|
|
||
|
Function _AddApparationHealthBar()
|
||
|
ActorHealthBarShower.AddActorRaw(self.getActorReference())
|
||
|
EndFunction
|
||
|
|
||
|
bool function canApparationExist(Location loc)
|
||
|
If loc && loc.hasKeyword(_00E_Phasmalist_NoSummonLocation)
|
||
|
return false
|
||
|
ElseIf loc && loc.hasKeyword(_00E_Phasmalist_NoSummonLocationTown) && !PlayerREF.hasPerk(_00E_Class_Phasmalist_P08b)
|
||
|
return false
|
||
|
EndIf
|
||
|
return true
|
||
|
Endfunction
|
||
|
|
||
|
function teleportToPlayer()
|
||
|
If getRef()
|
||
|
self.getRef().moveTo(PlayerREF)
|
||
|
self.getRef().placeAtMe(enterWorldExplosion)
|
||
|
EndIf
|
||
|
Endfunction
|
||
|
|
||
|
function showStatsMenu()
|
||
|
UIExtensions.initMenu("UIStatsMenu")
|
||
|
UIExtensions.openMenu("UIStatsMenu", self.getRef())
|
||
|
Endfunction
|
||
|
|
||
|
; sometimes reloading a save with a summoned apparation from a game state without one can result in the apparationAlias being cleared.
|
||
|
; To fix this, the script additionally keeps track of its content in a variable and refills itself onGameLoad
|
||
|
function failsaveRefillOnLoad()
|
||
|
If failsave_content
|
||
|
self.forceRefTo(failsave_content)
|
||
|
EndIf
|
||
|
Endfunction
|
||
|
|
||
|
string function getEquipmentString()
|
||
|
string text = _00E_Phasmalist_CurrentlyEquipped.GetName() + "\n\n"
|
||
|
Actor akSelf = self.getActorReference()
|
||
|
Weapon EquippedWeapon = akSelf.getEquippedWeapon()
|
||
|
If EquippedWeapon
|
||
|
text = text + EquippedWeapon.getName() + "\n" ;weapon
|
||
|
If EquippedWeapon.IsBow()
|
||
|
Form[] arrows = _00E_AllAmmos.ToArray()
|
||
|
Int i = 0
|
||
|
While i < arrows.Length
|
||
|
If akSelf.GetItemCount(arrows[i]) > 0
|
||
|
text = text + (arrows[i].GetName() + " (" + akSelf.GetItemCount(arrows[i]) +")") + "\n"
|
||
|
EndIf
|
||
|
i += 1
|
||
|
EndWhile
|
||
|
EndIf
|
||
|
EndIf
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00000200, text) ;shield
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00001000, text) ;circlet
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00000004, text) ;body
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00000008, text) ;hands
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00000080, text) ;feet
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00000020, text) ;amulet
|
||
|
text = addWordFormAsStringIfWorn(akSelf, 0x00000040, text) ;ring
|
||
|
|
||
|
return text
|
||
|
Endfunction
|
||
|
|
||
|
; local helper functions ---------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
||
|
string function addWordFormAsStringIfWorn(Actor a, int slot, string s) global
|
||
|
If a.getWornForm(slot)
|
||
|
return s + a.getWornForm(slot).getName() + "\n"
|
||
|
EndIf
|
||
|
return s
|
||
|
Endfunction
|
||
|
|
||
|
function addArcaneFever()
|
||
|
float healthLostPercentage = 0
|
||
|
If self.getActorReference().isDead()
|
||
|
healthLostPercentage = 1
|
||
|
Else
|
||
|
healthLostPercentage = 1 - self.getActorReference().GetActorValuePercentage("health")
|
||
|
EndIf
|
||
|
int TalentLevel = _00E_TalentLibrary.GetPlayerTalentLevel(_00E_Class_Phasmalist_P04_Talent_SummonApparation, _00E_Class_Phasmalist_P04_Talent_SummonApparation2, _00E_Class_Phasmalist_P04_Talent_SummonApparation3)
|
||
|
float maxArcaneFeverAdd = 0
|
||
|
|
||
|
If (TalentLevel == 1)
|
||
|
maxArcaneFeverAdd = fArcaneFeverLevel01
|
||
|
ElseIf (TalentLevel == 2)
|
||
|
maxArcaneFeverAdd = fArcaneFeverLevel02
|
||
|
Else
|
||
|
maxArcaneFeverAdd = fArcaneFeverLevel03
|
||
|
EndIf
|
||
|
|
||
|
If getEquippedTrinket().type == 0
|
||
|
maxArcaneFeverAdd = maxArcaneFeverAdd + fArcaneFeverModWarrior
|
||
|
ElseIf getEquippedTrinket().type == 1
|
||
|
maxArcaneFeverAdd = maxArcaneFeverAdd + fArcaneFeverModRanger
|
||
|
ElseIf getEquippedTrinket().type == 2
|
||
|
maxArcaneFeverAdd = maxArcaneFeverAdd + fArcaneFeverModMage
|
||
|
Else
|
||
|
maxArcaneFeverAdd = maxArcaneFeverAdd + fArcaneFeverModHybrid
|
||
|
EndIf
|
||
|
|
||
|
float arcaneFeverAdd = (maxArcaneFeverAdd * healthLostPercentage) as float
|
||
|
|
||
|
If arcaneFeverAdd > 0
|
||
|
|
||
|
PlayerREF.ModAV("LastFlattered", -arcaneFeverAdd)
|
||
|
_00E_ArkanistenfieberIMOD.ApplyCrossFade()
|
||
|
_00E_FS_IncreaseArcaneFeverM.Play(PlayerREF)
|
||
|
_00E_BlitzheilungArkanistenfieber_sFeverIncreased.Show(arcaneFeverAdd, -1*PlayerREF.GetAV("LastFlattered"))
|
||
|
|
||
|
EndIf
|
||
|
|
||
|
Endfunction
|
||
|
|
||
|
function adjustBoosts()
|
||
|
adjustBoostPerk(_00E_Class_Phasmalist_P05a_ABC, "mage")
|
||
|
adjustBoostPerk(_00E_Class_Phasmalist_P05b_ABC, "ranger")
|
||
|
adjustBoostPerk(_00E_Class_Phasmalist_P05c_ABC, "warrior")
|
||
|
Endfunction
|
||
|
|
||
|
function addClassBoost(int level, string boostClass)
|
||
|
Actor referenceActor = self.getActorReference()
|
||
|
If boostClass == "mage"
|
||
|
int boostDestructionPowerMod = 0
|
||
|
If level == 2
|
||
|
boostDestructionPowerMod = ghostlyMageBoostDestructionPowerMod2
|
||
|
currentBoostMagicka = ghostlyMageBoostMagicka2; since magicka is boosted later again, we have to save this boost and apply it later to prevent overwriting old boosts
|
||
|
ElseIf level == 3
|
||
|
boostDestructionPowerMod = ghostlyMageBoostDestructionPowerMod3
|
||
|
currentBoostMagicka = ghostlyMageBoostMagicka3
|
||
|
Else
|
||
|
boostDestructionPowerMod = ghostlyMageBoostDestructionPowerMod1
|
||
|
currentBoostMagicka = ghostlyMageBoostMagicka1
|
||
|
EndIf
|
||
|
;referenceActor.ForceAV("DestructionPowerMod", referenceActor.GetAV("DestructionPowerMod") + boostDestructionPowerMod)
|
||
|
referenceActor.ModAV("DestructionPowerMod", boostDestructionPowerMod)
|
||
|
ElseIf boostClass == "ranger"
|
||
|
int boostArchery = 0
|
||
|
int boostCritChance = 0
|
||
|
If level == 2
|
||
|
boostArchery = ghostlyRangerBoostArchery2
|
||
|
boostCritChance = ghostlyRangerBoostCritChance2
|
||
|
ElseIf level == 3
|
||
|
boostArchery = ghostlyRangerBoostArchery3
|
||
|
boostCritChance = ghostlyRangerBoostCritChance3
|
||
|
Else
|
||
|
boostArchery = ghostlyRangerBoostArchery1
|
||
|
boostCritChance = ghostlyRangerBoostCritChance1
|
||
|
EndIf
|
||
|
|
||
|
;referenceActor.ForceAV("Marksman", referenceActor.GetAV("Marksman") + boostArchery)
|
||
|
referenceActor.ModAV("Marksman", boostArchery)
|
||
|
;referenceActor.ForceAV("CritChance", referenceActor.GetAV("CritChance") + boostCritChance)
|
||
|
referenceActor.ModAV("CritChance", boostCritChance)
|
||
|
ElseIf boostClass == "warrior"
|
||
|
int boostMelee = 0
|
||
|
int boostArmorSkill = 0
|
||
|
If level == 2
|
||
|
boostMelee = ghostlyWarriorBoostMelee2
|
||
|
boostArmorSkill = ghostlyWarriorBoostArmorSkill2
|
||
|
ElseIf level == 3
|
||
|
boostMelee = ghostlyWarriorBoostMelee3
|
||
|
boostArmorSkill = ghostlyWarriorBoostArmorSkill3
|
||
|
Else
|
||
|
boostMelee = ghostlyWarriorBoostMelee1
|
||
|
boostArmorSkill = ghostlyWarriorBoostArmorSkill1
|
||
|
EndIf
|
||
|
|
||
|
;referenceActor.ForceAV("HeavyArmor", referenceActor.GetAV("HeavyArmor") + boostArmorSkill)
|
||
|
referenceActor.ModAV("HeavyArmor", boostArmorSkill)
|
||
|
;referenceActor.ForceAV("LightArmor", referenceActor.GetAV("LightArmor") + boostArmorSkill)
|
||
|
referenceActor.ModAV("LightArmor", boostArmorSkill)
|
||
|
;referenceActor.ForceAV("MeleeDamage", referenceActor.GetAV("MeleeDamage") + boostMelee)
|
||
|
referenceActor.ModAV("MeleeDamage", boostMelee)
|
||
|
EndIf
|
||
|
Endfunction
|
||
|
|
||
|
function adjustBoostPerk(Perk[] perks, string boostClass)
|
||
|
int i = perks.length
|
||
|
While i > 0
|
||
|
i = i - 1
|
||
|
If PlayerREF.HasPerk(perks[i])
|
||
|
addClassBoost(i + 1, boostClass)
|
||
|
return
|
||
|
EndIf
|
||
|
EndWhile
|
||
|
Endfunction
|
||
|
|
||
|
function init()
|
||
|
initBehaviour()
|
||
|
initNotPersistentStats()
|
||
|
|
||
|
Actor referenceActor = self.getActorReference()
|
||
|
;Actor player = Game.getPlayer()
|
||
|
|
||
|
float attributeRaisePercentage = playerConjSkillMultiplier * PlayerREF.getActorValue("Conjuration") + playerEnchSkillMultiplier * PlayerREF.getActorValue("Enchanting")
|
||
|
attributeRaisePercentage = attributeRaisePercentage / 100 + 1
|
||
|
|
||
|
adjustBoosts()
|
||
|
|
||
|
If (PlayerREF.hasPerk(_00E_Class_Phasmalist_P08a))
|
||
|
float maxAttributeValue = PlayerREF.getBaseActorValue("Health")
|
||
|
If PlayerREF.getBaseActorValue("Magicka") > maxAttributeValue
|
||
|
maxAttributeValue = PlayerREF.getBaseActorValue("Magicka")
|
||
|
EndIf
|
||
|
If PlayerREF.getBaseActorValue("Stamina") > maxAttributeValue
|
||
|
maxAttributeValue = PlayerREF.getBaseActorValue("Stamina")
|
||
|
EndIf
|
||
|
referenceActor.ForceAV("Health", ((referenceActor.getBaseActorValue("Health") + maxAttributeValue * playerStatsMultiplier) * attributeRaisePercentage) as int)
|
||
|
referenceActor.ForceAV("Magicka", ((referenceActor.getBaseActorValue("Magicka") + maxAttributeValue * playerStatsMultiplier) * attributeRaisePercentage) as int + currentBoostMagicka)
|
||
|
referenceActor.ForceAV("Stamina", ((referenceActor.getBaseActorValue("Stamina") + maxAttributeValue * playerStatsMultiplier) * attributeRaisePercentage) as int)
|
||
|
|
||
|
Else
|
||
|
referenceActor.ForceAV("Health", ((referenceActor.getBaseActorValue("Health") + PlayerREF.getBaseActorValue("Health") * playerStatsMultiplier) * attributeRaisePercentage) as int)
|
||
|
referenceActor.ForceAV("Magicka", ((referenceActor.getBaseActorValue("Magicka") + PlayerREF.getBaseActorValue("Magicka") * playerStatsMultiplier) * attributeRaisePercentage) as int + currentBoostMagicka)
|
||
|
referenceActor.ForceAV("Stamina", ((referenceActor.getBaseActorValue("Stamina") + PlayerREF.getBaseActorValue("Stamina") * playerStatsMultiplier) * attributeRaisePercentage) as int)
|
||
|
EndIf
|
||
|
|
||
|
Endfunction
|
||
|
|
||
|
function initBehaviour()
|
||
|
Actor akSelf = self.getActorReference()
|
||
|
If akSelf.GetRelationshipRank(PlayerREF) < 3 && akSelf.GetRelationshipRank(PlayerREF) >= 0
|
||
|
akSelf.SetRelationshipRank(PlayerREF, 3)
|
||
|
EndIf
|
||
|
|
||
|
akSelf.SetPlayerTeammate()
|
||
|
akSelf.SetActorValue("Confidence", 4) ; the apparation should never flee
|
||
|
akSelf.SetActorValue("Aggression", 0) ; the apparation should not initiate combat (-> stealth playstyle)
|
||
|
akSelf.SetActorValue("Sneak", 100)
|
||
|
akSelf.SetActorValue("Invisibility", 1) ; make the apparation undetectable when sneaking (-> stealth playstyle)
|
||
|
akSelf.IgnoreFriendlyHits() ; make the apparation ignore friendly fire from the PC
|
||
|
Endfunction
|
||
|
|
||
|
function initNotPersistentStats()
|
||
|
|
||
|
Actor akSelf = self.getActorReference()
|
||
|
If akSelf
|
||
|
akSelf.getActorBase().setCombatStyle(getEquippedTrinket().getUsedCombatStyle())
|
||
|
|
||
|
akSelf.setAV("HealRate", 50)
|
||
|
akSelf.setAV("MagickaRate", apparationManaRate)
|
||
|
|
||
|
;failsafe since setav doesn't work sometimes
|
||
|
akSelf.forceAV("HealRate", 50)
|
||
|
akSelf.forceAV("MagickaRate", apparationManaRate)
|
||
|
|
||
|
_AddApparationHealthBar()
|
||
|
EndIf
|
||
|
Endfunction
|
||
|
|
||
|
Function ChangeTeleportKey(int iKeyCode)
|
||
|
|
||
|
UnregisterForKey(iCallApparitionKeyCode)
|
||
|
iCallApparitionKeyCode = iKeyCode
|
||
|
RegisterForKey(iCallApparitionKeyCode)
|
||
|
|
||
|
EndFunction
|
||
|
|
||
|
; events -----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
||
|
Event OnActivate(ObjectReference akActivator)
|
||
|
UIExtensions.initMenu("UIWheelMenu")
|
||
|
UIExtensions.SetMenuPropertyIndexBool("UIWheelMenu", "optionEnabled", 0, true)
|
||
|
UIExtensions.SetMenuPropertyIndexBool("UIWheelMenu", "optionEnabled", 1, true)
|
||
|
UIExtensions.SetMenuPropertyIndexBool("UIWheelMenu", "optionEnabled", 4, true)
|
||
|
UIExtensions.SetMenuPropertyIndexBool("UIWheelMenu", "optionEnabled", 5, true)
|
||
|
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionText", 0, "$View_Attributes")
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionLabelText", 0, "$View_Attributes")
|
||
|
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionText", 1, "$Adapt_Combat_Style")
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionLabelText", 1, "$Adapt_Combat_Style")
|
||
|
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionText", 4, "$Currently_Equipped")
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionLabelText", 4, "$Currently_Equipped")
|
||
|
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionText", 5, "$Quit")
|
||
|
UIExtensions.SetMenuPropertyIndexString("UIWheelMenu", "optionLabelText", 5, "$Quit")
|
||
|
|
||
|
int choosenAction = UIExtensions.OpenMenu("UIWheelMenu", self.getActorReference())
|
||
|
|
||
|
If choosenAction == 0
|
||
|
showStatsMenu()
|
||
|
ElseIf choosenAction == 4
|
||
|
Debug.MessageBox(getEquipmentString())
|
||
|
ElseIf choosenAction == 1
|
||
|
getEquippedTrinket().modifyApparation()
|
||
|
EndIf
|
||
|
Endevent
|
||
|
|
||
|
Event OnLocationChange(Location akOldLoc, Location akNewLoc)
|
||
|
|
||
|
If !canApparationExist(akNewLoc)
|
||
|
If akNewLoc.hasKeyword(_00E_Phasmalist_NoSummonLocationTown)
|
||
|
_00E_Phasmalist_NoSummoningMessageTown.show()
|
||
|
Else
|
||
|
_00E_Phasmalist_NoSummoningMessage.show()
|
||
|
EndIf
|
||
|
RegisterForSingleUpdate(6)
|
||
|
EndIf
|
||
|
|
||
|
If _00E_Phasmalist_ApparitionShaderFXS == None
|
||
|
_00E_Phasmalist_ApparitionShaderFXS = Game.GetFormFromFile(0x0101ED85, "Enderal - Forgotten Stories.esm") as EffectShader
|
||
|
EndIf
|
||
|
|
||
|
Actor akSelf = self.getActorReference()
|
||
|
|
||
|
If akNewLoc && akNewLoc.hasKeyword(_00E_Phasmalist_NoSummonLocationTown) && PlayerREF.HasPerk(_00E_Class_Phasmalist_P08b)
|
||
|
If akSelf.IS3DLoaded()
|
||
|
MAGAlterationInvisibilityIn.Play(akSelf)
|
||
|
EndIf
|
||
|
akSelf.SetAlpha(0.1)
|
||
|
_00E_Phasmalist_ApparitionShaderFXS.Play(akSelf)
|
||
|
ElseIf (!akNewLoc || !akNewLoc.hasKeyword(_00E_Phasmalist_NoSummonLocationTown)) && PlayerREF.HasPerk(_00E_Class_Phasmalist_P08b)
|
||
|
If akSelf.IS3DLoaded()
|
||
|
MAGAlterationInvisibilityOut.Play(akSelf)
|
||
|
EndIf
|
||
|
akSelf.SetAlpha(0.6)
|
||
|
_00E_Phasmalist_ApparitionShaderFXS.Stop(akSelf)
|
||
|
EndIf
|
||
|
|
||
|
Endevent
|
||
|
|
||
|
Event OnUpdate()
|
||
|
If !canApparationExist(getRef().getCurrentLocation())
|
||
|
unsummonIfExists()
|
||
|
EndIf
|
||
|
Endevent
|
||
|
|
||
|
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
|
||
|
|
||
|
If akBaseItem as Armor
|
||
|
self.getActorReference().equipItem(akBaseItem)
|
||
|
EndIf
|
||
|
If akBaseItem as book
|
||
|
If (akBaseItem as book).getSpell()
|
||
|
self.getActorReference().addSpell((akBaseItem as book).getSpell())
|
||
|
EndIf
|
||
|
EndIf
|
||
|
|
||
|
Endevent
|
||
|
|
||
|
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
|
||
|
|
||
|
If akBaseItem as book
|
||
|
If (akBaseItem as book).getSpell()
|
||
|
self.getActorReference().removeSpell((akBaseItem as book).getSpell())
|
||
|
EndIf
|
||
|
EndIf
|
||
|
|
||
|
Endevent
|
||
|
|
||
|
function addSpells()
|
||
|
int index = self.getActorReference().getNumItems() - 1
|
||
|
While index >= 0
|
||
|
Form item = self.getActorReference().getNthForm(index)
|
||
|
If item as book && !item.hasKeyword(_00E_FS_Magic_Summon) && !item.hasKeyword(_00E_FS_Magic_Mystical)
|
||
|
If (item as book).getSpell()
|
||
|
self.getActorReference().addSpell((item as book).getSpell())
|
||
|
EndIf
|
||
|
EndIf
|
||
|
index = index - 1
|
||
|
EndWhile
|
||
|
Endfunction
|
||
|
|
||
|
Event OnKeyDown(int iKeyCode)
|
||
|
If iKeyCode == iCallApparitionKeyCode && Utility.IsInMenuMode() == False && UI.IsTextInputEnabled() == False && Game.IsFightingControlsEnabled() == true && UI.IsMenuOpen("Dialogue Menu") == False && PlayerREF.GetCurrentLocation() != _00E_Dreamworld_Location
|
||
|
teleportToPlayer()
|
||
|
EndIf
|
||
|
EndEvent
|
||
|
|
||
|
Event onDeath(Actor akKiller)
|
||
|
unsummon()
|
||
|
UnregisterForKey(iCallApparitionKeyCode)
|
||
|
Endevent
|
||
|
|
||
|
Event OnLoad()
|
||
|
RegisterForKey(iCallApparitionKeyCode)
|
||
|
EndEvent
|