Difference between revisions of "LUA:SetSkillMaxValue"

(Created page with "= LUA Functions: GetSkillValue() = Gets the current value of the given skill ==== Syntax ==== GetSkillValue(param1) ==== Parameters ==== ; Required - ''param1'' (Skill) : ''pa...")
 
 
Line 1: Line 1:
= LUA Functions: GetSkillValue() =
+
= LUA Functions: SetSkillMaxValue() =
Gets the current value of the given skill
+
Sets the max value of the given skill
  
 
==== Syntax ====
 
==== Syntax ====
GetSkillValue(param1)
+
SetSkillMaxValue(param1, param2)
  
  
 
==== Parameters ====
 
==== Parameters ====
; Required - ''param1'' (Skill)
+
; Required - ''param1'' (Skill), ''param2'' (int16)
: ''param1'' is the skill who's current value we want
+
: ''param1'' is the skill who's max value we want to set
 +
: ''param2'' is the value we want to set it to
  
 
==== Usage ====
 
==== Usage ====
 
<pre>
 
<pre>
function hailed(NPC, Spawn)
+
function respec(Player)
     skill = GetSkill(Spawn, "Offence")
+
     skill = GetSkill(Player, "Offence")
 
     if skill ~= nil then
 
     if skill ~= nil then
         Say(NPC, "Your offence is at " .. GetSkillValue(skill))
+
         SetSkillMaxValue(skill, 35)
    else
 
        Say(NPC, "You do not have the offence skill")
 
 
     end
 
     end
 
end
 
end
 
</pre>
 
</pre>
  
The hailed NPC will respond with the players skill value
+
When this function is called the players offence skill max value will be set to 35
 +
 
 +
== Note ==
 +
If max value is set below the current value then current value will be changed to the given value as well

Latest revision as of 12:32, 22 November 2013

LUA Functions: SetSkillMaxValue()

Sets the max value of the given skill

Syntax

SetSkillMaxValue(param1, param2)


Parameters

Required - param1 (Skill), param2 (int16)
param1 is the skill who's max value we want to set
param2 is the value we want to set it to

Usage

function respec(Player)
    skill = GetSkill(Player, "Offence")
    if skill ~= nil then
        SetSkillMaxValue(skill, 35)
    end
end

When this function is called the players offence skill max value will be set to 35

Note

If max value is set below the current value then current value will be changed to the given value as well