You are viewing an old version of this page. Return to the latest version.
Version of 16:13, 28 August 2013 by I need to Update My Profile
Difference between revisions of "LUA:GetOwner"
(Created page with "= LUA Functions: AddHate() = Adds hate to ''param2'' from ''param1'' ==== Syntax ==== AddHate(param1, param2, param3) ==== Parameters ==== ; Required - ''param1'' (Spawn), ''...") |
|||
| Line 1: | Line 1: | ||
| − | = LUA Functions: | + | = LUA Functions: GetOwner() = |
| − | + | Gets the owner of the given pet | |
==== Syntax ==== | ==== Syntax ==== | ||
| − | + | GetOwner(param1) | |
==== Parameters ==== | ==== Parameters ==== | ||
| − | ; Required - ''param1'' (Spawn | + | ; Required - ''param1'' (Spawn) |
| − | : ''param1'' is the spawn | + | : ''param1'' is the spawn who's owner we want to get |
| − | |||
| − | |||
==== Usage ==== | ==== Usage ==== | ||
<pre> | <pre> | ||
| − | function | + | function hailed(NPC, Spawn) |
| − | + | if IsPet(NPC) then | |
| − | + | local owner = GetOwner(Spawn) | |
| + | if owner ~= nil then | ||
| + | Say(NPC, "My owner is " .. GetName(Owner) .. ".") | ||
| + | end | ||
| + | end | ||
end | end | ||
</pre> | </pre> | ||
| − | This is a | + | This spawn script will respond with the name of its owner if it is a pet. |
== Notes == | == Notes == | ||
| − | + | While not required it is good practice to make sure you are dealing with a pet before calling this function. | |
Latest revision as of 17:18, 28 August 2013
LUA Functions: GetOwner()
Gets the owner of the given pet
Syntax
GetOwner(param1)
Parameters
- Required - param1 (Spawn)
- param1 is the spawn who's owner we want to get
Usage
function hailed(NPC, Spawn)
if IsPet(NPC) then
local owner = GetOwner(Spawn)
if owner ~= nil then
Say(NPC, "My owner is " .. GetName(Owner) .. ".")
end
end
end
This spawn script will respond with the name of its owner if it is a pet.
Notes
While not required it is good practice to make sure you are dealing with a pet before calling this function.