HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Emotes  (Read 1210 times)

Thazager

  • General Accounts
  • *
  • Posts: 1138
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Emotes
« on: Mar 04, 13, 03:22:40 AM »

Basic tutorial

This will make your character do some Emotes. (works with base character)

From the basic window tutorial
Make basic window here. This is a base window and will be used in many of my Tutorials. It uses the GUI pics from textures that all engines have. This can be skipped if you have the basic window already from another tutorial.

_______________________________________________________________
In the DOM, create a new (client side) class
name = TMP_Emotes
archtype = guicontrol
add a parent to the class, TMP_Window

click open script

In new (client side) script TMP_Emotes

Code: [Select]
// create main window
shared function Start()
  var win = getEmotesClass()
  if win <> None
    DestroyNode( win )
  .
  win = CreateNodeFromPrototype("TMP_Emotes")
  win.build = true
  MiscUtils:centerWindow(win)
.

// create list for player, when GUI opens
method onControlBuild()
  var box = me.getDropDownBox()
  if box <> None
    // items listed in box
    items as List of String
    add back "chat" to items
    add back "dance" to items
    add back "sleep" to items
    add back "stun" to items
    add back "wave" to items

    foreach i in items
      box.E_dropDownBox_addDropDownBoxItem(i)
    .
  .
.

// player changes which emote to show
method _onDropDownBoxValueChange(args references Class GUIValueFieldChangeEvent)
  meNode as NodeRef = GetPlayerCharacterNode()
  emote as String

  // removing old
  meNode["Behave"] = "input BasePosture Idle"       // clear old
  meNode["Behave"] = "input IdleType Normal"        // clear old

  // perform emote
  when args.value
    is "chat"
      emote = "input IdleType Conversation"
    .
    is "dance"
      emote = "input Emote FemaleDance"
    .
    is "sleep"
      emote = "input IdleType Dead"
    .
    is "stun"
      emote = "input BasePosture Paralyzed"
    .
    is "wave"
      emote = "input Special Wave"
    .
  .
  meNode["Behave"] = emote
.

//=================================================================================================
function getEmotesClass() as NodeRef of Class TMP_Emotes
  return FindGUIControlByName(None, "game.TMP_Emotes")
.

method getDropDownBox() as NodeRef of Class E_dropDownBox
  return FindGUIControlByName(me, "Emotes")
.

__________________________________________________________________________
In new (XML) script TMP_Emotes

Code: [Select]
<createControlType inheritFrom='TMP_Window' class='TMP_Emotes' type='TMP_Emotes' description='' treePath='' name="TMP_Emotes">
  <size x="200" y="50"/>
  <set name="TMP_Emotes.BGpanel">
    <size x="192" y="42"/>
  </set>
  <_label name="title" text="Emotes" dropShadowAlpha="1" justification="CENTER">
    <defaultStatePresentation>
      <color r="1" g="0" b="0"/>
    </defaultStatePresentation>
    <autoCenter horizontal="true"/>
  </_label>
  <E_dropDownBox name="Emotes">
    <position x="30" y="20"/>
    <autoCenter horizontal="true"/>
    <set name='TMP_Emotes.Emotes.E_dropDownList' attribute='layer' value="game"/>
    <set name='TMP_Emotes.Emotes.E_dropDownList.clientarea' attribute='layer' value="game"/>
  </E_dropDownBox>
</createControlType>

__________________________________________________________________________
In (client side) script E_PlayerAccountClassMethods under the chatwindow

Code: [Select]
        TMP_EmotesClassMethods:Start() // Create emote window
« Last Edit: May 30, 15, 10:48:42 PM by Thazager »
Logged

Viper155

  • World Owners
  • ****
  • Posts: 73
    • View Profile
Re: Emotes
« Reply #1 on: Mar 04, 13, 04:01:11 PM »

Im getting a error on the last part.

Code: [Select]
        // Emotes - tutorial
        emotes as NodeRef of Class TMP_Emotes = FindGUIControlByName(None, "TMP_Emotes")
        if emotes != None
          destroynode(emotes)
        .
        emotes = CreateNodeFromPrototype("TMP_Emotes ")
        emotes.build = true
        emotes.owner = 0

its saying that TMP_Emotes class not found in database
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1138
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Emotes
« Reply #2 on: Mar 04, 13, 07:21:23 PM »

Thanks, I have fixed error.
Remove the space after CreateNodeFromPrototype("TMP_Emotes ")

should be
CreateNodeFromPrototype("TMP_Emotes")
Logged