GetBehaviorVariable
From MaratisWiki
(Difference between revisions)
(Created page with "getBehaviorVariable(object, behaviorId, "variableName") #Short description #*object : The object with the active behavior #*behaviorId : If your behavior is the first on the...") |
Dahnielson (Talk | contribs) m |
||
| (2 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | getBehaviorVariable | + | {{lua-function|getBehaviorVariable|object, behaviorId, variableName}} |
| − | + | Get value of the behavior variable. | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | * '''object:''' The object with the active behavior | |
| + | * '''behaviorId:''' If your behavior is the first on the list, behaviorId will be 0, the second will be 1, etc. | ||
| + | * '''variableName:''' Behavior parameter name | ||
| − | For example, you can display the value of a certain parameter | + | For example, the "Follow" Behavior has 4 parameters: target, delay, offset, local. |
| + | |||
| + | '''Example:''' For example, you can display the value of a certain parameter. | ||
object = getObject("object") | object = getObject("object") | ||
| Line 15: | Line 16: | ||
if isKeyPressed("key") then print(ObjBehav) end -- will print the "delay" value of object behavior | if isKeyPressed("key") then print(ObjBehav) end -- will print the "delay" value of object behavior | ||
end | end | ||
| + | |||
| + | [[Category:Lua scripting]] | ||
| + | [[Category:Lua function]] | ||
| + | [[Category:Behavior]] | ||
Latest revision as of 17:56, 8 February 2014
getBehaviorVariable(object, behaviorId, variableName)
Get value of the behavior variable.
- object: The object with the active behavior
- behaviorId: If your behavior is the first on the list, behaviorId will be 0, the second will be 1, etc.
- variableName: Behavior parameter name
For example, the "Follow" Behavior has 4 parameters: target, delay, offset, local.
Example: For example, you can display the value of a certain parameter.
object = getObject("object")
function onSceneUpdate()
ObjBehav = getBehaviorVariable(object, 0, "delay")
if isKeyPressed("key") then print(ObjBehav) end -- will print the "delay" value of object behavior
end