Line 41: | Line 41: | ||
− | {{ScriptFunction|void|ResetOutfitToTemplate|(int outfitID);|Changes the current Avatar's outfit to outfitID only if the player running this code already owns that outfit. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.|5=<pre></pre>|6=<pre>--this script toggles between 3 different outfits when NPC Statue object is clicked | + | {{ScriptFunction|void|ResetOutfitToTemplate|(int outfitID);|Changes the current Avatar's outfit to outfitID only if the player running this code already owns that outfit. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.|5=<pre>Space.Host.ExecutingObject.AvatarAppearance.ResetOutfitToTemplate(10001)</pre>|6=<pre>--this script toggles between 3 different outfits when NPC Statue object is clicked |
--[Object needs to have an NPC Statue component] | --[Object needs to have an NPC Statue component] | ||
--For this function, the player needs to own this outfit. Use LoadOutfit if player might not own it | --For this function, the player needs to own this outfit. Use LoadOutfit if player might not own it | ||
Line 91: | Line 91: | ||
− | {{ScriptFunction|SColor|GetSkinTone|();|Return skin tone of avatar.|5=<pre></pre>|6=<pre>--this script updates a UIText with the current Skin Tone of the npc | + | {{ScriptFunction|SColor|GetSkinTone|();|Return skin tone of avatar.|5=<pre>SkinTone = Space.Host.ExecutingObject.AvatarAppearance.GetSkinTone()</pre>|6=<pre>--this script updates a UIText with the current Skin Tone of the npc |
thisObject = Space.Host.ExecutingObject | thisObject = Space.Host.ExecutingObject | ||
Line 104: | Line 104: | ||
− | {{ScriptFunction|SColor|GetEyeTone|();|Return eye tone of avatar.|5=<pre></pre>|6=<pre>--this script updates a UIText with the current Eye Tone of the npc | + | {{ScriptFunction|SColor|GetEyeTone|();|Return eye tone of avatar.|5=<pre> EyeTone = Space.Scene.PlayerAvatar.GameObject.AvatarAppearance.GetEyeTone()</pre>|6=<pre>--this script updates a UIText with the current Eye Tone of the npc |
thisObject = Space.Host.ExecutingObject | thisObject = Space.Host.ExecutingObject | ||
Line 121: | Line 121: | ||
− | {{ScriptFunction|long|OutfitID|{ get; }|Return the current outfit id.|5=<pre></pre>|6=<pre>--this script updates a UIText with the current outfit ID of the npc | + | {{ScriptFunction|long|OutfitID|{ get; }|Return the current outfit id.|5=<pre>outfitID= Space.Host.ExecutingObject.AvatarAppearance.OutfitID</pre>|6=<pre>--this script updates a UIText with the current outfit ID of the npc |
thisObject = Space.Host.ExecutingObject | thisObject = Space.Host.ExecutingObject | ||
Line 138: | Line 138: | ||
− | {{ScriptFunction|bool|Loaded|{ get; }|Returns true if the avatar is full loaded.|5=<pre></pre>|6=<pre>--this script updates a UIText with the loading status of the npc | + | {{ScriptFunction|bool|Loaded|{ get; }|Returns true if the avatar is full loaded.|5=<pre>isLoaded= Space.Host.ExecutingObject.AvatarAppearance.Loaded</pre>|6=<pre>--this script updates a UIText with the loading status of the npc |
thisObject = Space.Host.ExecutingObject | thisObject = Space.Host.ExecutingObject |
Changes the current Avatar's outfit to outfitID. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.
Space.Host.ExecutingObject.AvatarAppearance.LoadOutfit(160)
--this script toggles between 3 different outfits when NPC Statue object is clicked --[Object needs to have an NPC Statue component] outfits = {4134388, 4134385, 4134386} currentOutfit = 0 thisObject = Space.Host.ExecutingObject function OnClickFunction() if currentOutfit == #outfits then currentOutfit = 1 else currentOutfit = currentOutfit + 1 end thisObject.AvatarAppearance.LoadOutfit(outfits[currentOutfit]) end thisObject.AddClickable() thisObject.Clickable.OnClick(OnClickFunction)
Changes the current Avatar's outfit and resets it to outfitID 0. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.
Space.Host.ExecutingObject.AvatarAppearance.ResetOutfit()
--this script makes a UIButton reset an NPC statue outfit when clicked --[UIButton object needs to be linked in scripting runtime references with name "button1"] --[Object needs to have an NPC Statue component] thisObject = Space.Host.ExecutingObject refButton = Space.Host.GetReference("button1") function OnClickFunction() thisObject.AvatarAppearance.ResetOutfit() end refButton.UIButton.OnClick(OnClickFunction)
Changes the current Avatar's outfit to outfitID only if the player running this code already owns that outfit. For a player Avatar, this only works on white-label grid. For NPC avatars, this works on all grids.
Space.Host.ExecutingObject.AvatarAppearance.ResetOutfitToTemplate(10001)
--this script toggles between 3 different outfits when NPC Statue object is clicked --[Object needs to have an NPC Statue component] --For this function, the player needs to own this outfit. Use LoadOutfit if player might not own it outfits = {4134388, 4134385, 4134386} currentOutfit = 0 thisObject = Space.Host.ExecutingObject function OnClickFunction() if currentOutfit == #outfits then currentOutfit = 1 else currentOutfit = currentOutfit + 1 end thisObject.AvatarAppearance.ResetOutfitToTemplate(outfits[currentOutfit]) end thisObject.AddClickable() thisObject.Clickable.OnClick(OnClickFunction)
Return the value of Appearance Sliders.
FaceLength = Space.Host.ExecutingObject.AvatarAppearance.GetSlider(AppearanceSlider.FaceLength)
--this script updates a UIText with the current Face Length of the npc thisObject = Space.Host.ExecutingObject uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime OnUpdateFunction = function() uiText.Text = Space.Host.ExecutingObject.AvatarAppearance.GetSlider(AppearanceSlider.FaceLength) end thisObject.OnUpdate(OnUpdateFunction)
Return height of avatar.
height = Space.Host.ExecutingObject.AvatarAppearance.GetHeight()
--this script updates a UIText with the height of this NPC statue thisObject = Space.Host.ExecutingObject uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime OnUpdateFunction = function() uiText.Text = Space.Host.ExecutingObject.AvatarAppearance.GetHeight() end thisObject.OnUpdate(OnUpdateFunction)
Return skin tone of avatar.
SkinTone = Space.Host.ExecutingObject.AvatarAppearance.GetSkinTone()
--this script updates a UIText with the current Skin Tone of the npc thisObject = Space.Host.ExecutingObject uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime OnUpdateFunction = function() uiText.Text = Space.Scene.PlayerAvatar.GameObject.AvatarAppearance.GetSkinTone().ToString() end thisObject.OnUpdate(OnUpdateFunction)
Return eye tone of avatar.
EyeTone = Space.Scene.PlayerAvatar.GameObject.AvatarAppearance.GetEyeTone()
--this script updates a UIText with the current Eye Tone of the npc thisObject = Space.Host.ExecutingObject uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime OnUpdateFunction = function() uiText.Text = Space.Scene.PlayerAvatar.GameObject.AvatarAppearance.GetEyeTone().ToString() end thisObject.OnUpdate(OnUpdateFunction)
Return the current outfit id.
outfitID= Space.Host.ExecutingObject.AvatarAppearance.OutfitID
--this script updates a UIText with the current outfit ID of the npc thisObject = Space.Host.ExecutingObject uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime OnUpdateFunction = function() uiText.Text = Space.Scene.PlayerAvatar.GameObject.AvatarAppearance.OutfitID end thisObject.OnUpdate(OnUpdateFunction)
Return the GameObject of avatar skeleton.
Returns true if the avatar is full loaded.
isLoaded= Space.Host.ExecutingObject.AvatarAppearance.Loaded
--this script updates a UIText with the loading status of the npc thisObject = Space.Host.ExecutingObject uiText = Space.Host.GetReference("thetext").UIText --Add this object with UIText component as reference in Scripting Runtime OnUpdateFunction = function() uiText.Text = Space.Scene.PlayerAvatar.GameObject.AvatarAppearance.Loaded end thisObject.OnUpdate(OnUpdateFunction)
|