[GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Greed's Avatar Angry 12yearolds FTL
    Reputation
    -3
    Join Date
    Oct 2007
    Posts
    1,129
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc

    DBCUtil: DBCUtil.zip
    CSVED: http://home.hccnet.nl/s.j.francke/csved/csvedsetup.exe
    :Links Provided by PvPede:
    I WILL NOT be explaining what the code is, i will explain some parts of the code though!
    Also I would like to apologize in advance for the messiness of teh code, the post is not wide enough
    YOU MUST FIRST HAVE THE SOURCE CODE FOR ANTRIX, AND SOMETHING LIKE VISUAL STUDIO 2005 or 2003 otherwise you can't do this, I use Visual Studio so it will be based on that
    Inside Visual Studio create a new C++ source file by going to file->new->file->c++ file->click open
    save the file as NewScript inside the InstanceScripts Folder, and copy and paste this code
    or
    First make a text file in the InstanceScripts folder name it NewScript.cpp make sure it doesnt say NewScript.cpp.txt now open the file with notepad or whatever word processing tool you have and copy and paste this code
    Code:
    #include "StdAfx.h" //these are required otherwise it wont compile and just give you hundreads of errors
    #include "Setup.h"
    #define MOBNAME XXXXXX //You can change MOBNAME to Whatever you want, Make sure to keep it all capitals, the XXXXX can be changed to the mobs ID Number in the DB
    #define SPELL1 XXXXXX //Samething here almost, change SPELL1 to Whatever you want, just keep it all capital and change the XXXXX to a spell number
    #define SPELL2 XXXXXX //repeat for how many spells you want, for this tutorial im gonna keep it with 2
    #define SPELLSOUND XXXXX //this is for when they cast a spell they say something you can get all the sound ids in the soundentries.dbc you can turn it into a .csv with a convertor
    class MOBNAMEAI : public CreatureAIScript
    {
    public:
    ADD_CREATURE_FACTRY_FUCNTION(MOBNAMEAI); // Make sure to change MOBNAMEAI to The Name next to class
    SP_AI_Spell spells[2]; //where it says spells[2] you can change the 2 to however many spells you have
    bool m_spellcheck[2]; //same thing as above you can change the 2 to however many spells you have
    MOBNAMEAI(Creture *pCreature) : CreatureAIScript(pCreature)
    {
    nrspells = 2; //same as before change to 2 to however many spells you have
    for(int i=0;i<nrspells;i++)
      {
       m_spellcheck[i] = false;
      }
    spells[0].info = sSpellStore.LookupEntry(SPELL1); //change SPELL1 to the define you made it as
    spells[0].targettype = TARGET_VARIOUS; //I will put all the targettypes at the end
    spells[0].instant = true; //wether it is instant or not
    spells[0].perctrigger = 16.0f; //how often the spell is cast
    spells[0].attackstoptimer = 1000; //can't remember how this is handled
    spells[0].soundid = SPELLSOUND; // you can either put a number here or just use your define
    spells[0].speech = "You can make them say things when they cast spells by having text here!"; //text that the mob yells when they cast the spell
    spells[1].info = sSpellStore.LookupEntry(SPELL2); //change SPELL2 to the name of your spell 2 thing
    spells[1].targettype = TARGET_ATTACKING;
    spells[1].instant = true;
    spells[1].perctrigger = 9.0f;
    spells[1].attackstoptimer = 2000;
    spells[1].soundid = SPELLSOUND;
    spells[1].speech = "You can make them say other things for different spells";
    }
    void OnCombatStart(Unit* mTarget)
    {
    _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Have some text here for when you aggro him he yells it");
    _unit->PlaySoundToSet(XXXXXX); //change the XXXXXX to whatever number that is in the soundentries.dbc file
    RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
    }
    void OnTargetDied(Unit* mTarget)
     {
    if (_unit->GetHealthPct() > 0) // Hack to prevent double yelling (OnDied and OnTargetDied when creature is dying)
      {
    int RandomSpeach;
    sRand.randInt(1000);
    RandomSpeach=rand()%2;
    switch (RandomSpeach)
    {
    case 0: 
    _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Have some text here for when he kills a player");
    _unit->PlaySoundToSet(XXXXX); //change the XXXXXX to whatever number that is in the soundentries.dbc file
    break;
    case 1:
    _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "if there are two sounds then put some text here");          
     _unit->PlaySoundToSet(XXXXX); //change the XXXXXX to whatever number that is in the soundentries.dbc file
    break;
    }
    }
    }
    void OnCombatStop(Unit *mTarget)
     {
      _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
      _unit->GetAIInterface()->SetAIState(STATE_IDLE);
      RemoveAIUpdateEvent();
     } //dont change any of this unless you know what your doing
    void OnDied(Unit * mKiller)
     {
    _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Have some text here for when he dies");
    _unit->PlaySoundToSet(XXXXX); //change the XXXXXX to whatever number that is in the soundentries.dbc file
     
    RemoveAIUpdateEvent();
     }
    void AIUpdate()
     {
    Timer = Timer + 1;
    if (Timer == 200) //you cn change the number to whatever you want after the timer reaches that number it will cast the spell below it
    {
     _unit->CastSpell(_unit, spells[0].info, spells[0].instant); //you can change the numbers to whatever spell you want
    }
    else
    {
    float val = sRand.rand(100.0f);
    SpellCast(val);
    }
    } //leave the rest of it alone unless you know what your doing
    void SpellCast(float val)
     {
    if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())
    {
    float comulativeperc = 0;
    Unit *target = NULL;
    for(int i=0;i<nrspells;i++)
    {
    if(!spells[i].perctrigger) continue;
     
    if(m_spellcheck[i])
    {
    target = _unit->GetAIInterface()->GetNextTarget();
    switch(spells[i].targettype)
    {
    case TARGET_SELF:
    case TARGET_VARIOUS:
    _unit->CastSpell(_unit, spells[i].info, spells[i].instant); 
    break;
    case TARGET_ATTACKING:
    _unit->CastSpell(target, spells[i].info, spells[i].instant); 
    break;
    case TARGET_DESTINATION:
    _unit->CastSpellAoF(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), spells[i].info, spells[i].instant); 
    break;
    }
    if (spells[i].speech != "")
    {
    _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, spells[i].speech.c_str());
    _unit->PlaySoundToSet(spells[i].soundid); 
    }
    m_spellcheck[i] = false;
    return;
    }
    if(val > comulativeperc && val <= (comulativeperc + spells[i].perctrigger))
    {
    _unit->setAttackTimer(spells[i].attackstoptimer, false);
    m_spellcheck[i] = true;
    }
    comulativeperc += spells[i].perctrigger;
    }
    }
    }
    protected:
     int nrspells;
     int Timer;
    }; //DO NOT TOUCH ANYTHING HERE UNLESS YOU KNOW WHAT YOUR DOING!
    void SetupMOBNAME(ScriptMgr * mgr)
    {
     mgr->register_creature_script(MOBNAME, &MOBNAMEAI::Create); //change MOBNAME to the define you used, also change MOBNAMEAI to the one you used at the beginning
    }
    Now we aren't done yet we need to go into Setup.cpp and Setup.h
    In Setup.cpp
    Code:
    //Where it says SetupTheMechanar(mgr); put SetupMOBNAME(mgr);
    //Where MOBNAME = the define you used in the script so it wuld look like this
    SetupTheMechanar(mgr);
    SetupMOBNAME(mgr);
    //Simple as that
    Now for Setup.h
    Code:
    /*Find void SetupTheMechanar(ScriptMgr * mgr); and put void SetupMOBNAME(ScriptMgr * mgr); under it where MOBNAME = teh define you used in the script so it would look like this*/
    void SetupTheMechanar(ScriptMgr * mgr);
    void SetupMOBNAME(ScriptMgr * mgr);
    Now we need to add our file to the project Inside visual studio open up the InstanceScripts2005.vcproj or InstanceScripts2003.vcproj
    then click the + next to the project and right click the folder called scripts and put your cursor over to add and click existing item, navigate to the InstanceScripts folder, double click on NewScript.cpp and badda bing your done with that
    Now just compile and replace the InstanceScripts.dll in your script_bin folder for your server with the one in teh bin, script_bin folder!
    Here are all the targettypes
    Code:
    TARGET_SELF,
    TARGET_VARIOUS,
    TARGET_ATTACKING,
    TARGET_DESTINATION,
    TARGET_SOURCE,
    This Tutorial has been made by: Reknown

    [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc
  2. #2
    Gandair's Avatar Member
    Reputation
    3
    Join Date
    Sep 2007
    Posts
    32
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc

    This post makes me wish I were smarter =(. I'd love to get into this stuff someday.

  3. #3
    halolouie's Avatar Member
    Reputation
    1
    Join Date
    Oct 2007
    Posts
    22
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc

    very nice well explained +rep

  4. #4
    destroyah's Avatar Member
    Reputation
    1
    Join Date
    Oct 2007
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc

    excuse me but where can i find the antrix source?

  5. #5
    Arthas117's Avatar Knight-Champion
    Reputation
    151
    Join Date
    Mar 2007
    Posts
    483
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc

    now I wish i was a smartass programmer of antrix..don't understand a shit

  6. #6
    Tazjin's Avatar Active Member
    Reputation
    48
    Join Date
    Jul 2007
    Posts
    45
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc

    Well, I already knew that but its VERY great for beginners.

    +rep
    Apple > All

  7. #7
    csearle1's Avatar Member
    Reputation
    1
    Join Date
    Dec 2007
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice job. been searching for one of these specifically

Similar Threads

  1. [Guide] How to make a NPC cast spells. NO LUA!
    By Power of Illuminati in forum WoW EMU Guides & Tutorials
    Replies: 52
    Last Post: 05-06-2011, 07:13 AM
  2. [Script a Mob to cast spells] Guide
    By P1raten in forum WoW EMU Guides & Tutorials
    Replies: 7
    Last Post: 03-17-2009, 04:10 PM
  3. LUA scripting -- Making game objects cast spells.
    By Jotox in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 05-08-2008, 03:44 PM
  4. [Guide] Making GO`s cast spells.
    By Mr FlySquirrel in forum WoW EMU Guides & Tutorials
    Replies: 8
    Last Post: 02-27-2008, 02:39 PM
  5. [Question] hmm, how do i make a mob rapidly cast spells?
    By Creepfold in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 12-27-2007, 10:38 AM
All times are GMT -5. The time now is 12:27 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search