Skip to main content

Avatar

Contains functions for interacting with avatars system.

info

This module can only be used in Entity scripts.

Functions​

playEmote(name, asyncMode)​

Plays emote on the current avatar.

Parameters​

  • name — The name of the emote. All the possible emotes should appear on your editor as an autocomplete option once you open quotes ("").
  • asyncMode — The AsyncMode which determines whether the task should wait for the function to complete before continuing.

Example​

Make a NPC dance forever.

function onStart()
while true do
Avatar.playEmote("dance.bart.0")
end
end

equipItem(avatarSlot, name)​

Equips item of certain type to the avatar.

Parameters​

  • avatarSlot — Enum with all the possible slots for the avatar (more info at the bottom of this module).
  • name — The ID of the item. All the possible IDs should appear on your editor as an autocomplete option once you open quotes ("").

Example​

Equip a baseball hat on a NPC.

function onStart()
Avatar.equipItem(AvatarSlot.Hat, "hat.baseball.0")
end

equipOutfit(outfitNumber)​

Equips outfit to the avatar.

Parameters​

  • outfitNumber — The outfit number.

Example​

Equip a pre-saved outfit (from slot #2) on a NPC.

function onStart()
Avatar.equipOutfit(2)
end

Enums​

AvatarSlot​

  • Bottom — value = 1
  • Top — value = 2
  • LeftHand — value = 3
  • RightHand — value = 4
  • LeftFoot — value = 5
  • RightFoot — value = 6
  • Necklace — value = 7
  • LeftBadge — value = 8
  • RightBadge — value = 9
  • LeftWrist — value = 10
  • RightWrist — value = 11
  • LeftRing — value = 14
  • RightRing — value = 15
  • Backpack — value = 16
  • Tail — value = 17
  • Head — value = 18
  • Hat — value = 19
  • Mask — value = 20
  • ClosedHelmet — value = 21
  • OpenHelmet — value = 22
  • Glasses — value = 23
  • Mustache — value = 24
  • LeftEarring — value = 25
  • RightEarring — value = 26