Difference between revisions of "LUA:GetSkill"

(Created page with "= LUA Functions: GetSkillValue() = Gets the current value of the given skill ==== Syntax ==== GetSkillValue(param1) ==== Parameters ==== ; Required - ''param1'' (Skill) : ''pa...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
= LUA Functions: GetSkillValue() =
+
= LUA Functions: GetSkill() =
Gets the current value of the given skill
+
Gets the skill for the given entity
  
 
==== Syntax ====
 
==== Syntax ====
GetSkillValue(param1)
+
GetSkill(param1, param2)
  
  
 
==== Parameters ====
 
==== Parameters ====
; Required - ''param1'' (Skill)
+
; Required - ''param1'' (Spawn), ''param2'' (string)
: ''param1'' is the skill who's current value we want
+
: ''param1'' is the entity who's skill we want to get
 +
: ''param2'' is the name of the skill we want
  
 
==== Usage ====
 
==== Usage ====
Line 15: Line 16:
 
     skill = GetSkill(Spawn, "Offence")
 
     skill = GetSkill(Spawn, "Offence")
 
     if skill ~= nil then
 
     if skill ~= nil then
         Say(NPC, "Your offence is at " .. GetSkillValue(skill))
+
         Say(NPC, "You have the offence skill")
 
     else
 
     else
 
         Say(NPC, "You do not have the offence skill")
 
         Say(NPC, "You do not have the offence skill")
Line 22: Line 23:
 
</pre>
 
</pre>
  
The hailed NPC will respond with the players skill value
+
The hailed NPC will respond if the player has the offence skill or not
 +
 
 +
== Notes ==
 +
This can only be used on an Entity

Latest revision as of 12:50, 22 November 2013

LUA Functions: GetSkill()

Gets the skill for the given entity

Syntax

GetSkill(param1, param2)


Parameters

Required - param1 (Spawn), param2 (string)
param1 is the entity who's skill we want to get
param2 is the name of the skill we want

Usage

function hailed(NPC, Spawn)
    skill = GetSkill(Spawn, "Offence")
    if skill ~= nil then
        Say(NPC, "You have the offence skill")
    else
        Say(NPC, "You do not have the offence skill")
    end
end

The hailed NPC will respond if the player has the offence skill or not

Notes

This can only be used on an Entity