Welcome to the MMOtop - Arcemu, Mangos, Trinity.
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Onlykl's Avatar
    Status : Onlykl is offline
    Join Date : Dec 2009
    Location : !!Serbia!!
    Posts : 117
    Thanks: 0
    Thanked 17 Times in 8 Posts
    Rep Power : 4
    Reputation:101Onlykl will become famous soon enough Onlykl will become famous soon enough

    Default [C++] LUNAR-Capture The Flag



    Alright guys while checking in the Requests section I've found that alot of people are looking for a Capture the flag script.

    Well, I'm pretty sure this isn't exactly what your looking for but Its a pretty good start. If anyone knows the spell id for the Alliance warsong gulch spells that are casted on you when you get the flag please tell me

    Well anyway here is the current script

    #begin - begins the event, only usable by GM's

    implemented a score system, once a faction gets 3 the score resets and the event is over til a GM begins it
    added spell visual to the person who has the flag

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #define ITEMID 38234//The object that is in your bag when you have the flag
    #define FLAG_ID 28342//The Object to be clicked to take the flag
    #define ALLYTURNINPOINT 26242//Alliance flag turn in object
    #define HORDTURNINPOINT 26242//Horde flag turn in object
    
    //Don't edit this
    #define SPELL 23335
    
    static bool IsHeld = false;
    static int allyscore = 0;
    static int hordescore = 0;
    static bool isactive = false;
    
    GameObject * flag;
    
    static string begin = "#begin";
    
    void PlayerChat(Player * pPlayer, uint32 Type, uint32 Lang, const char * Message, const char * Misc)
    {
       if(Message == begin)
       {
           if(pPlayer->GetSession()->HasGMPermissions())
           {
                isactive = true;
                allyscore = 0;
                hordescore = 0;
    
           }
       }
    }
    
    
    class FlagToCapture : public GameObjectAIScript
    {
    public:
        FlagToCapture(GameObject* goinstance) : GameObjectAIScript( goinstance ) {}
        static GameObjectAIScript *Create(GameObject * GO)
        {
            return new FlagToCapture(GO);
        }
    
        void OnSpawn()
        {
            flag = _gameobject;
            _gameobject->invisible = false;
        }
    
        void OnActivate(Player * pPlayer)
        {
            if(isactive)
            {
                _gameobject->invisible = false;
            if(IsHeld == false)
            {
            Item * item = objmgr.CreateItem(ITEMID,pPlayer);
            pPlayer->GetItemInterface()->AddItemToFreeSlot(item);
            IsHeld = true;
            _gameobject->invisible = true;
            pPlayer->AddAuraVisual(SPELL,1,true);
            }
            else
            {
                pPlayer->BroadcastMessage("The flag has already been picked up");
            }
            }
            else
            {
                _gameobject->invisible = true;
            }
        }
    };
    
    class HordeObject : public GameObjectAIScript
    {
    public:
        HordeObject(GameObject* goinstance) : GameObjectAIScript( goinstance ) {}
        static GameObjectAIScript *Create(GameObject * GO)
        {
            return new HordeObject(GO);
        }
    
        void OnSpawn()
        {
            RegisterAIUpdateEvent(1);
        }
    
        void AIUpdate()
        {
            Player * plr = _gameobject->GetMapMgr()->GetInterface()->GetPlayerNearestCoords(_gameobject->GetPositionX(), _gameobject->GetPositionY(), _gameobject->GetPositionZ());
            if(_gameobject->CalcDistance( _gameobject, plr ) <= 2.0f) // You need to standing 2 meters from the actual center of the pink ring
            {
                if(plr->GetItemInterface()->GetItemCount(ITEMID) >= 1 && plr->GetTeam() == 0)
                {
                    plr->GetItemInterface()->RemoveItemAmt(ITEMID,plr->GetItemInterface()->GetItemCount(ITEMID) && isactive);
                    IsHeld = false;
                    flag->invisible = false;
                    hordescore++;
                    if(hordescore == 3)
                    {
                        sWorld.SendWorldWideScreenText("The horde have won capture the flag");
                        sWorld.SendWorldText("score resetting");
                        allyscore = 0;
                        hordescore = 0;
                        isactive = false;
                    }
                    else
                    {
                    char * message;
                    sprintf(message,"%s has captured the flag for the horde",plr->GetName());
                    sWorld.SendWorldWideScreenText(message);
                    plr->RemoveAuraVisual(SPELL,1);
                    }
                }
            }
        }
    };
    
    class AllyObject : public GameObjectAIScript
    {
    public:
        AllyObject(GameObject* goinstance) : GameObjectAIScript( goinstance ) {}
        static GameObjectAIScript *Create(GameObject * GO)
        {
            return new AllyObject(GO);
        }
    
        void OnSpawn()
        {
            RegisterAIUpdateEvent(1);
        }
    
        void AIUpdate()
        {
            Player * plr = _gameobject->GetMapMgr()->GetInterface()->GetPlayerNearestCoords(_gameobject->GetPositionX(), _gameobject->GetPositionY(), _gameobject->GetPositionZ());
            if(_gameobject->CalcDistance( _gameobject, plr ) <= 2.0f) // You need to standing 2 meters from the actual center of the pink ring
            {
                if(plr->GetItemInterface()->GetItemCount(ITEMID) >= 1 && plr->GetTeam() == 1 && isactive)
                {
                    plr->GetItemInterface()->RemoveItemAmt(ITEMID,plr->GetItemInterface()->GetItemCount(ITEMID));
                    IsHeld = false;
                    flag->invisible = false;
                    allyscore++;
                    if(allyscore == 3)
                    {
                        sWorld.SendWorldWideScreenText("The alliance have won capture the flag");
                        sWorld.SendWorldText("score resetting");
                        allyscore = 0;
                        hordescore = 0;
                        isactive = false;
    
                    }
                    else
                    {
                    char * message;
                    sprintf(message,"%s has captured the flag for the alliance",plr->GetName());
                    sWorld.SendWorldWideScreenText(message);
                            plr->RemoveAuraVisual(SPELL,1);
                    }
                }
            }
        }
    };
    
    
    void SetupCaptureTheFlag(ScriptMgr * mgr)
    {
        mgr->register_gameobject_script(FLAG_ID, &FlagToCapture::Create);
        mgr->register_gameobject_script(ALLYTURNINPOINT, &AllyObject::Create);
        mgr->register_gameobject_script(HORDTURNINPOINT, &HordeObject::Create);
        mgr->register_hook(SERVER_HOOK_EVENT_ON_CHAT, &PlayerChat);
    }
    Without Spells -- Some errors in version with them
    [Only registered and activated users can see links. ]

    Just modify the definitions to what you want
    and create your game objects (sorry that i don't have them, i don't have an updated DB will anyone to make them)

    [Only registered and activated users can see links. ]

    Credits: Mager1794 Leader of Lunar Scriptors

    Enjoy leave feedback

  2. #2
    mattyboi's Avatar
    Status : mattyboi is offline
    Join Date : Nov 2010
    Location : Kyogle NSW, Australia
    Posts : 77
    Thanks: 8
    Thanked 0 Times in 0 Posts
    Rep Power : 2
    Reputation:10mattyboi is on a distinguished road

    Default

    thanks man


 

Similar Threads

  1. Lunar Scripters
    By Onlykl in forum Recruitment & Gamemasters
    Replies: 1
    Last Post: 05-31-2010, 02:08 AM
  2. Lunar Scriptor
    By mager1794 in forum Tools and Applications
    Replies: 5
    Last Post: 03-03-2010, 04:42 AM
  3. [Repack] Lunar Blizz 3.2.2a
    By Onlykl in forum Emulator Repacks
    Replies: 14
    Last Post: 02-28-2010, 01:24 PM
  4. [C++] Lunar-BossTrack v2.0
    By mager1794 in forum LUA / C++ Scripts
    Replies: 2
    Last Post: 12-26-2009, 03:18 PM
  5. [Share]Easy flag changer - ArcEmu
    By Jerry in forum Emulator Website / Script's Releases
    Replies: 0
    Last Post: 11-29-2009, 01:50 PM

Visitors found this page by searching for:

trinitycore capture the flag

capture the flag arcemu

capture the flag script

[c ] capture the flag

horde flag id object warsong

trinitycore capture the flag c

caprure the flag script wow

arcemu flag capturing

arcemu capture flag

capture the flag mangos

arcemu capture the flag

mangos create capture the flag event

Lunar Capture the Flag

what is luner search in c

SEO Blog

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts