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: [QUESTION] SmartAI problem  (Read 1296 times)

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
[QUESTION] SmartAI problem
« on: November 18, 2015, 11:23:26 am »
Basically, I need an npc (by guid) to walk to a certain point, when an event starts.

Script:
Code: [Select]
DELETE FROM `smart_scripts` WHERE (`entryorguid`=15737508 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
(15737508, 0, 0, 1, 68, 0, 100, 0, 70, 0, 0, 0, 59, 0, , , , , , 1, , , , , , , , ""),
(15737508, 0, 1, , 68, 0, 100, 0, 70, , , , 69, 0, 0, 0, 0, , , 8, , , , 1632.454956, 226.362778, 62.593037, 1.057432, "");

Error:
[attachment=0:h2t6wxsv]smartaierror.jpg[/attachment:h2t6wxsv]
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] SmartAI problem
« Reply #1 on: November 18, 2015, 11:48:51 am »
You can't just have a list of commas. Give a value for all fields you specified or specify less fields.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] SmartAI problem
« Reply #2 on: November 18, 2015, 03:16:44 pm »
Thanks, the problem with execution is fixed. I also changed the guid in the script from 15737508 to -15737508, so its processed as a guid.

New script(s):
Code: [Select]
REPLACE 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 (15737508, 0, 0, 1, 68, 0, 100, 0, 70, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, '');

REPLACE 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 (15737508, 0, 1, 0, 68, 0, 100, 0, 70, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 1632.45, 226.363, 62.593, 1.05743, '');

Still, when I run the event (that triggers this smart script), the npc doesnt move.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] SmartAI problem
« Reply #3 on: November 20, 2015, 03:54:35 pm »
Can anyone help? please
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Смердокрыл

  • Registred Member
  • Creator of Worlds
  • *****
  • Posts: 445
    • View Profile
Re: [QUESTION] SmartAI problem
« Reply #4 on: November 27, 2015, 08:14:09 pm »
Ok, modcraft is dead
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
or no.
At least I tried.

Romzarah

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 62
    • View Profile
Re: [QUESTION] SmartAI problem
« Reply #5 on: November 27, 2015, 10:24:42 pm »
The only way I ever did a NPC moving is with way point commands.. Don't think that will help you much..
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

111tester

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 3
    • View Profile
Re: [QUESTION] SmartAI problem
« Reply #6 on: November 28, 2015, 05:40:03 am »
(-guid, 0, 0, 0, Eventid, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, Xcoord, Ycoord, Zcoord, 0, 'comment');

And in your situation you should use

(-guid, 0, 0, 0, 68, 0, 0, 0, Eventid(from_database), 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, Xcoord, Ycoord, Zcoord, 0, 'comment');

You must write your creature's guid, EventID and coords. This should work.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] SmartAI problem
« Reply #7 on: November 28, 2015, 10:00:05 am »
Your script with ID 0 has link 1, which means that it will be triggered AFTER script with ID 1 will. I just hope you wanted it so. It doesn't matter in this case, I just wanted to make sure you know what link field is for.

About the rest, I am not sure how action you used works and would not use it at all, it seems to be pretty specific about what it is for:
Code: [Select]
PointId is called by SMART_EVENT_MOVEMENTINFORM. Continue this action with the TARGET_TYPE column. Use any target_type, and use target_x, target_y, target_z, target_o as the coordinates
Probably not something you wanted to use at all.


I would spawn waypoint path, use action 53 for making NPC follow waypoint path and would set canRepeat=0. If NPC won't stop at the end of waypoint path, you will need to add another script which will make it do so by using event 40 and action 55. The only flaw about this is that when NPC unloads from memory (if you didn't turn this option off in worldserver.conf, this happens whenever palyers don't have that zone loaded long enough), when server loads it back, it will appear at its spawn point, which means that it will be standing at one place, where it was before event occured. That might be unpleasant.

So, you may also want to add another script which will despawn NPC when it reaches end of waypoint path (action 41 should do) and will spawn a new one instead of it. Note that Blizzard does so during quest - questgivers, escorted NPCs and such tend to be despawned and then spawned again when they reach their targeted position. I doubt Blizzard does so without pretty good reason.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz