View Full Version : SAI Tutorial w/ Pictures

05-16-2014, 02:06 AM
SAI is a database scripting tool. It's complexity is below LUA and C++ but it can do some powerful things. It's great for simple spell casting, random movement, quests, etc.
So first off you will want to get the SAI-Editor by Discover here. (http://www.trinitycore.org/f/files/file/17-sai-editor/)
Once it's downloaded open it up and enter in your Mysql and database information.

So now lets go over the program:

Now we are going to make a creature have a random movement waypoint.
We want to set the Event as "EVENT_RESPAWN" This will trigger the script when the creature spawns. (This means when the creature grid is loaded, not just when he respawns).

Next we want the action to be "ACTION_RANDOM_MOVE" now go to the action tab.
Then we will set the distance to 4. (I generally will set indoor movements from 3-5 and outside from 10-15).

Finally set target to "TARGET_SELF"
Then click on "Generate Comments" then "Generate SQL" and then "Execute Script"

Let's make a creature cast a spell now.
Click on "New Line"

Set the event to "EVENT_AGGRO" This will trigger the action when the creature has aggro. You can also set it to "EVENT_UPDATE_IC" (IC stands for In Combat) Which will cast a spell on a timer in Milliseconds. If you set it to 1000, 2000, 4000, 4000 it will call the action between 1 to 2 seconds and repeat it every 4 seconds.

Set the action to "ACTION_CAST" go to the "Action" Tab and put in a spell ID.

For future reference this is a list of what the cast flags does:
SMARTCAST_INTERRUPT_PREVIOUS: Interrupt any spell casting
SMARTCAST_TRIGGERED: Triggered (this makes spell cost zero mana and have no cast time)
CAST_AURA_NOT_PRESENT: Only casts the spell if the target does not have an aura from the spell
SMARTCAST_COMBAT_MOVE: Prevent combat movement on cast, allow on fail range, mana, LOS

Next set the target to "TARGET_VICTIM"

There is also:

Now click "Generate Comments" then "Generate SQL" and then "Execute Script"

And there you have it. The creature will now have a random waypoint and it will cast a spell. There is a lot more and I'll add more guides in the future. If anyone has questions please feel free to ask them here.

05-16-2014, 02:44 AM
:bump: Nice release thank you.

05-16-2014, 03:52 AM
Awesome, thanks for sharing this with us!

05-16-2014, 04:07 PM
Awesome helpful!