Day & Night, what can we do ?


Summary

  • Introduction
  • Required tools
  • Day and Night
  • Useless or .. Useful ?

SATURDAY NIGHT FEVER

Hi people, today, as you can see, we will create two events, play with SmartAI, find a link between our events and SmartAI... Yes, we will create an event that starts at a time of day and ends at another, and an other will takes place to complete our empty time slot.

And... our NPCS will react with those two events !

Looks like it's time to gear up !

  • Navicat MySQL, PHPMyAdmin, SQLYog, HeidiSQL (the software one, not the little girl), any SQL editor you love !
  • Your WoW client
  • SAI Editor (WAIT ! Why we'll use a software ? Because... I am lazy.)

Actually I use SAIEditor 1.4.3, they did an update recently but I don't like it so much, something change and I allow only one thing to change...

tumblr_nv08t2DeVS1qiulxoo1_400.gif

Here is the 1.4.3 version : http://www.mediafire.com/download/tymxj4231uupa3x/SAI-Editor+1.4.3.rar

It's time to go !

 Day and Night

First, we need game_event. Structure of game_event

From there, create your events, here's mine :

5803562785.png

(Nuit means Night in French)

Night will start at 7:30pm and ends at 7:30am, Day will start at 7:30am and ends at 7:30pm, easy right ?

Yes ! But... ?

127da6232e.png

I didn't explained it a lot, yes, you're right... We'll play with those events to spawn npcs, and make them perform tasks. For example, it's 7pm and you want 5 npcs start a patrol around your city ? Create the patrol and place your NPCs GUIDs in game_event_creature with the night eventID.

Complicated ? Wait...

Even before all, why you should do this? To give attractiveness to your areas, an active city with NPCs who move helps immersion, more than stucked NPCs all day.

Let's start with one NPC, we'll make him appears and disappears following our events.

We need to open game_event_creature. Structure of game_event_creature

de46951c14.jpg

My NPC GUID is 2019864.

So, in the second column, I write 2019864.

When my server is restarted, my NPC won't be visible during my "Day" event, because I choose to show him only at night (with event 25).

Going back to my patrol's idea.

For this tutorial, I'll use only one NPC (I'm too lazy to create a full patrol :( )

What is he going to do ? At the time of night event, He will appear and begin to follow a waypoint path (I hope you know how to make a waypoint path) with SmartAI.

Here is Herigran Cayton.

807f4c7130.jpg

Herigran works all day, but when night comes, he becomes... Batm... No, he just goes home and sleep.

So it's time to help him to starts his path when it's 7:30pm. Open SAI Editor.

When you'll befinished setting up the software and found your creature's ID, you'll do this :

6a9550c127.png

Explanations :

First part : EVENT_GAME_EVENT_START
"When event starts"

Second part : ACTION_WP_START
"Start waypoint path"

Third part : TARGET_SELF

"On yourself."

When all of this settings are selected, the "parameters" parts update themselves (it's a king of magic ♫).

To better clarify the situation, you need to know Herigran's ID is 60077 and his waypoint path ID is 60077 too and this path is situated in waypoints_data. When you create a waypoint path with TrinityCore (same for Mangos) every point is added in waypoints, so, it means you MUST move your waypoints from waypoints to waypoints_data (be careful, the structure is different).

Well, we know Herigran starts his path at night, in technical language it gives :

"When event 25 starts, Creature 60077 starts her waypoints path 60077 on herself."

And you'll see him starts his path at 7:30pm BUT ! Problem. He won't move when night will end and day will start.

We will continue to use only our night event. if a EVENT_GAME_EVENT_START condition exists, a EVENT_GAME_EVENT_END condition exists too !

Herigran will do the reverted path we did for him before, actually we can't just make him follow the same path, you'll have to do an inverted one, let's call it waypoint 60078 (60077 arena => home, 60078 home => arena)

you can choose the same points you set before, just invert them, waypoint 1 becomes waypoint 30, waypoint 2 becomes waypoint 29...

Technical language :

"When event 25 ends, Creature 60077 starts her waypoints path 60078 on herself."

And tomorrow I'll see Herigran working in his office !

I know I used less images for this part, feel free to ask if you need one or two, I'll update my post !

I give you my SmartAI script (from Herigran) it could be useful or not ^^

-- Herigran Cayton SAI
SET @ENTRY := 60077;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,68,0,100,0,25,0,0,0,53,0,60077,0,0,0,0,1,0,0,0,0,0,0,0,"Herigran Cayton - On Game Event 25 Started - Start Waypoint"),
(@ENTRY,0,1,0,69,0,100,0,25,0,0,0,53,0,60078,0,0,0,0,1,0,0,0,0,0,0,0,"Herigran Cayton - On Game Event 25 Ended - Start Waypoint");

Here is one example you can do with SmartAI and events, you want more ideas ?
I'm working on Elwynn today, I'll make more wolves and thieves and at night, you'll meet more thieves, but at day, more wolves, only with everything I explained here ! The only limitation is your imagination :)

Have fun guys !

  • Thanks 1


Recommended Comments

Thank you for the tutorial man!! I just had a quick question, is it possible to create an event to actually effect a character?? Like i know you can effect npc's but how about characters themselves? Can they have something add or maybe have a quest that makes them a target or something in those lines?

Share this comment


Link to comment
Share on other sites
12 hours ago, abdalrahman9 said:

Thank you for the tutorial man!! I just had a quick question, is it possible to create an event to actually effect a character?? Like i know you can effect npc's but how about characters themselves? Can they have something add or maybe have a quest that makes them a target or something in those lines?

It should be possible, but it'll requires some C++ imo !

Share this comment


Link to comment
Share on other sites

Even it seems to be a really handy tutorial, the image links are broken and not shown. Is it possible somehow to be restored, just saying and hopping TOO much maybe.

Share this comment


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now