Difference between revisions of "User talk:Lisselli"

Jump to navigation Jump to search
238 bytes removed ,  13:46, 6 November 2016
m
no edit summary
imported>Lisselli
imported>Lisselli
m
Line 2: Line 2:


<source lang="papyrus">
<source lang="papyrus">
Spell[] property DestructionSpells auto
Actor property PlayerRef auto
; Add every playable destruction spell to this array property. Fireball, Firebolt, etc..
; Do not add the ones that are suffixed with Left, Right or BothHands. Example: Don't add ThunderboltLeftHand


Spell SpellSource
Float CurrentSkillLevel
Float PreviousSkillLevel
Int iCount


Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
Function AdvanceSkillEx(String asSkillName, Float afValue, Int aiClampValue=0)
bool abBashAttack, bool abHitBlocked)
; Let's say Destruction is 50. This variable will store that.
If akSource as Spell
CurrentSkillLevel = PlayerRef.GetActorValue("asSKillName")
          SpellSource = akSource as Spell
if GetSpellSkill(SpellSource as Spell, DestructionSpells) == false
;If the skill is still 50. Keep counting the times advance skill was called.
debug.notification("The spell was not a Destruction Spell")
if CurrentSkillLevel == PlayerRef.GetActorValue("asSkillName")
return
if iCount != aiClampValue
                else
Game.AdvanceSkill(asSkillName, afValue)
                    GoToState("Done")
iCount += 1
                    ; Things you want to do with SpellSource
; Everytime advanceskill  is called, iCount goes up until it reaches the clamp value.
endif
endif
elseif PlayerRef.GetActorValue("asSkillName") > CurrentSkillLevel
; if the skill is greater than 50, it leveled up at some point. Reset iCount.
iCount = 0
; Have the function call itself recursively.
AdvanceSkillEx(asSKillName, afValue, aiClampValue)
endif
endif
EndEvent
STATE Done
ENDSTATE
Bool Function GetSpellSkill(Form kSource, Spell[] akSpells)
; This will return false if the source isn't a Destruction spell at all.
Int i = 0
Int iIndex = akSpells.Length
; loop through all spells til it reaches the last spell.
While i < iIndex
if kSource == akSpells[i]
return true
else
i += 1
endif
EndWhile
return false
EndFunction
EndFunction
</source>
</source>
Anonymous user

Navigation menu