Difference between revisions of "GetEffectiveSkill"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Tejón
m
imported>Low Post
(it's fActorLuckSkillMult, not iActorLuckSkillMult)
 
(4 intermediate revisions by 2 users not shown)
Line 26: Line 26:
  let callerSkill := caller.GetAVC skillAVC
  let callerSkill := caller.GetAVC skillAVC
  let value := caller.GetAV Luck
  let value := caller.GetAV Luck
  let value *= GetGameSetting iActorLuckSkillMult
  let value *= GetGameSetting fActorLuckSkillMult
  let value += GetGameSetting iActorLuckSkillBase
  let value += GetGameSetting iActorLuckSkillBase
  let value += callerSkill
  let value += callerSkill
  if value < 0
  if value < 0
  let callerSkill := 0
  let callerSkill := 0
  elseif value > 100
  elseif Eval value > 100 && !IsPluginInstalled "OBSE_Elys_Uncapper"
  if callerSkill < 100
  if callerSkill < 100
  let callerSkill := 100
  let callerSkill := 100
  endif
  endif
; Note: if the unmodified skill is over 100, it remains unmodified!
; Note: if the unmodified skill is over 100, it remains unmodified!
  else
  else
  let callerSkill := floor value
  let callerSkill := floor value

Latest revision as of 12:48, 20 March 2011

A User Function for use with Oblivion Script Extender

Syntax:

(effectiveSkill:short) reference.Call GetEffectiveSkill skillAVC:short

Returns the current effective value, adjusted by Luck, of the requested skill on the calling actor. The skill is passed as an Actor Value Code; see GetActorValueC.

Notes[edit | edit source]

  • This function must be called on a reference (Ref.call <function>)
  • Luck cannot increase a skill above 100. However, skills can exceed 100 for other reasons. This is correctly handled.
  • If the value given for SkillAVCode does not correspond to a skill, this function returns -1. Skills cannot be negative, so this is a recognizable error flag.

Code[edit | edit source]

ScN GetEffectiveSkill

short skillAVC			; Passed from calling script
ref caller			; The calling reference
short callerSkill		; Skill as reported by GetAVC
float value			; Temporary working variable

begin Function {skillAVC}
	if (skillAVC < 12) || (skillAVC > 32)
		SetFunctionValue -1
	else
		let caller := GetSelf
		let callerSkill := caller.GetAVC skillAVC
		let value := caller.GetAV Luck
		let value *= GetGameSetting fActorLuckSkillMult
		let value += GetGameSetting iActorLuckSkillBase
		let value += callerSkill
		if value < 0
			let callerSkill := 0
		elseif Eval value > 100 && !IsPluginInstalled "OBSE_Elys_Uncapper"
			if callerSkill < 100
				let callerSkill := 100
			endif
			; Note: if the unmodified skill is over 100, it remains unmodified!
		else
			let callerSkill := floor value
		endif
		SetFunctionValue callerSkill
	endif
end

See Also[edit | edit source]