User talk:Lisselli

From the CreationKit Wiki
Revision as of 13:46, 6 November 2016 by imported>Lisselli
Jump to navigation Jump to search

Sandbox Page for when I need to post code on the forums. Because it doesn't allow indention..

Actor property PlayerRef auto

Float CurrentSkillLevel
Float PreviousSkillLevel
Int iCount

Function AdvanceSkillEx(String asSkillName, Float afValue, Int aiClampValue=0)
	; Let's say Destruction is 50. This variable will store that.
	CurrentSkillLevel = PlayerRef.GetActorValue("asSKillName")
	
	;If the skill is still 50. Keep counting the times advance skill was called.
	if CurrentSkillLevel == PlayerRef.GetActorValue("asSkillName")
		if iCount != aiClampValue
			Game.AdvanceSkill(asSkillName, afValue)
			iCount += 1
			; Everytime advanceskill  is called, iCount goes up until it reaches the clamp value.
		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
EndFunction