This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [Tutorial-Trinity-SAI] Responding to, and Playing, Emotes  (Read 2641 times)

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
[Tutorial-Trinity-SAI] Responding to, and Playing, Emotes
« on: June 26, 2014, 08:30:09 pm »
Before I start typing out this guide, I will admit that I’m no expert on SAI and that some of this information may be incorrect. If you know of any additional information, notice an error, etc.. just comment and I’ll do my best to keep this post updated.

There are a few things that you’ll need before creating and editing your smart scripts. I've seen a handful of different programs for editing smart scripts, but only one of them seems to be updated and does everything that I require. I’ll only be recommending the programs that work for me. So, before you continue reading, please download this and this; the first link contains the majority of programs which I most commonly use, and the second is the SAI editor which I've found to work best. These programs will only work on Windows as far as I know.

Just in case anyone wants to know what I’m running:

  • Windows 8, x64 — Home
  • Debian 7 x32 — Server
  • TrinityCore — Latest version as of 15/June/2014
  • WoTLK 3.3.5a

-----------------------------------------------------------------------------------------------------------------------------------

In this tutorial I will assume that you have knowledge of how to view the contents of both the Emotes.dbc and EmotesText.dbc files which we will be using. If you do not know how to do this you may view these converted files. The Emotes.dbc file contains all of the emotes for player characters and the EmotesText.dbc file contains all of the emotes for non-player characters, keep this in mind when working with emotes and SAI!

Assuming that you have opened up SAI-Editor, logged in, and are ready to edit a human NPC, using the id 80000, which you have already created, lets begin.

-----------------------------------------------------------------------------------------------------------------------------------

Quote
Valkryst's SAI-Editor Preferences:

  • Lock smart_scripts.id -- CHECKED
  • List actionlists too -- CHECKED
  • Use phase colors -- CHECKED
  • Show basic information -- CHECKED
  • Allow changing static info -- UN-CHECKED
  • Use permanent tooltips - CHECKED

The first thing you should do is set the Source type: to SCRIPT_TYPE_CREATURE and then  type in the ID of the NPC we're working with, which is 80000, into the Entry or guid: field. This tells the program and script that this script should apply to all creatures that have the ID 80000. The next step is to set the event, action, and target, but before you do this you need to click the New Line button to create a new script piece. In the case of this tutorial we will be using EVENT_RECEIVE_EMOTE, ACTION_PLAY_EMOTE, and TARGET_SELF. These are all fairly obviouss, but I will note that the third one tells the NPC to do the action, ACTION_PLAY_EMOTE, on itself.

Now that we have our Dynamic script information: set, we can move onto the script Parameters. As you can see there are three tabs under the parameters section and each handles a separate piece of the script. In the Event tab you will set the Emote id to whatever emote you want the NPC to respond to. The ID for this emote can be found in the EmotesText.dbc file, but for this tutorial just put in 5 for the Emote id. The next two fields, RepeatMin & RepeatMax, can be set to 5000. I haven't fiddled around too much with the repeat fields, but my best guess is that they control the amount of time, in milliseconds, until the NPC will respond to the emote again. If my guess it true, then setting this too low and having a lot of players interacting with the NPC through emotes may cause some lag on your server. Now switch to the Action tab and enter 66 for the Emote id. You can find the proper IDs for the Emote id field of the Action tab in the Emotes.dbc file. Because the target is set to TARGET_SELF, we don't need to worry about the Target tab.

One last thing to note before we finish up this SAI entry... If you use the Generate comments button with an emote script such as this, it will only comment something along the lines of  "Receive emote 5 - Play emote 66". Because of this I strongly recommend using your own comment writing convention. For this sort of SAI entry I would write "NPC NAME -  Received Emote APPLAUD - Play Emote SALUTE". After you write up your comment just click the Generate SQL button, then Execute script, and finally click Ok and exit the program.

Quote
Tip:

When creating a new SAI entry, I believe you need to restart world for it to be used. After that you can edit the entry all you like and then use the .reload smart_scripts command to test your edits. If something doesn't seem to work after using the .reload command, just to a server restart and it may begin working again.

If you wish to add another emote response just follow the tutorial, but remember to leave the Link to: and Link from: fields of the Dynamic script information section as it's default value and None respectively. This just says that each SAI entry can be triggered without requiring the previous SAI entry being executed.

-----------------------------------------------------------------------------------------------------------------------------------

Before I end this tutorial I feel it best to mention that any complex questions you have should be asked in this thread on the official Trinity forums. I also suggest that you always use this page as a reference when creating any and all of your SAI scripts.

-----------------------------------------------------------------------------------------------------------------------------------

If you want to stay up-to-date with my latest tutorials or if you just want an easier way to view all of my tutorials and releases in one place then take a look at my blog.
« Last Edit: June 28, 2014, 06:47:42 pm by Admin »
MY BLOG IS NOW HERE.

kojak488

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 351
    • View Profile
Re: [Tutorial-Trinity-SAI] Responding to, and Playing, Emote
« Reply #1 on: June 28, 2014, 12:02:07 pm »
Quote
When creating a new SAI entry, I believe you need to restart world for it to be used. After that you can edit the entry all you like and then use the .reload smart_scripts command to test your edits.

Personally I just restart the world every time when testing scripts.  I've had loads of times where the .reload command wasn't sufficient.  So if you change something and it's not working properly, I'd consider doing a restart as the first step.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Valkryst

  • Moderators
  • Model Change Addict
  • *****
  • Posts: 224
    • View Profile
    • http://valkryst.com/blog/
Re: [Tutorial-Trinity-SAI] Responding to, and Playing, Emote
« Reply #2 on: June 28, 2014, 06:48:23 pm »
Quote from: "kojak488"
Personally I just restart the world every time when testing scripts.  I've had loads of times where the .reload command wasn't sufficient.  So if you change something and it's not working properly, I'd consider doing a restart as the first step.

Thanks for mentioning that. I've added a note about this case to the tutorial.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
MY BLOG IS NOW HERE.