Results 1 to 7 of 7
  1. #1
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired

    [AS3] Battle Arena (Multiplayer & Singleplayer)

    [AS3] Battle Arena (Multiplayer & Singleplayer)
    Here is a guide for you, who use as3. This time i'll show you how to add a Battle Arena for you'r server that challenges you and your friends to survive against respawning monsters in a arena. Its is both possible to play co-operative or singleplayer Without further to do lets begin.

    Note: During this tutorial you will experience a few errors, but dont mind as they will get fixed through the tutorial, as long you follow theese steps correctly, your arena will work at the end!

    1 - Adding the Map
    We start of by implementing our map. Look at the buttom of this file to find a download of my map, but you can make your own aswell, all it actually requires is walls and a spawn region.

    2 - Adding the Map
    Import you'r wmap and jm map file to: wServer>Realm>Worlds
    Click 1 time at the arena.wmap file, and set the build action to "Embedded Resource" (Look at image blow this)

     


    3 - Adding the Map
    Open RealmManager.cs, and add this:
    Code:
      AddWorld(World.ARENA, new BattleArena());
    Below you'r latest world added. This could for an example be under:
    Code:
    AddWorld(World.GAUNTLET, new GauntletMap());
    4 - Adding the Map
    Now go to world.cs and add this:
    Code:
     public const int ARENA = -8;
    NOTE: The number you see in the end of the code (-8 got to be the id after the map above. Here is an Example:

    Try to find GAUNTLET = -7; As you see its id is 7, so if you have pasted the arena code below that the arenas id has to be 8 because thats the number after 7.

    5 - Adding the Map
    Go to UsePortalPacketHandler.cs, and add this:
    Code:
                        case 0x0f69:
                            world = player.Manager.AddWorld(new BattleArena());
                            break;
    Below this:

    Code:
    case 0x071f:                      
                            world = player.Manager.AddWorld(new GauntletMap());
                            break;

    6 - Adding the Portal and the Key
    Key: Go to dat20.xml, and paste this code in the
    Code:
    <Object type="0x0f70" id="Battle Arena Key">
        <Class>Equipment</Class>
        <Item/>
        <Texture>
          <File>lofiObj3</File>
          <Index>0xf4</Index>
        </Texture>
        <SlotType>10</SlotType>
        <Description>Challenge your ability, in surviving against monsters in a trapped room.</Description>
        <Sound>use_key</Sound>
        <Consumable/>
        <Soulbound/>
        <Activate id="Battle Arena Portal">Create</Activate>
      </Object>
    Portal: Open dat19.xml, and paste this at the buttom:
    Code:
    <Object type="0x0f69" id="Battle Arena Portal">
        <Class>Portal</Class>
        <IntergamePortal/>
        <DungeonName>Battle Arena</DungeonName>
        <Texture>
         <File>lofiObj3</File>
          <Index>0x33f</Index>
        </Texture>
      </Object>
    7 - Adding Portal & Key to client
    open you'r client source and do the same with the xmls. Note that the xml files in the client is called Dat files and they have different names. But don't worry just follow the steps below this.

    Key: Open _y8.dat and paste in this at the buttom:
    Note: I suggest you rename _y8.dat to: dat20.dat, it will make it easier to remember the name.
    Code:
     <Object type="0x0f70" id="Battle Arena Key">
        <Class>Equipment</Class>
        <Item/>
        <Texture>
          <File>lofiObj3</File>
          <Index>0xf4</Index>
        </Texture>
        <SlotType>10</SlotType>
        <Description>Challenge your ability, in surviving against monsters in a trapped room.</Description>
        <Sound>use_key</Sound>
        <Consumable/>
        <Soulbound/>
        <Activate id="Battle Arena Portal">Create</Activate>
      </Object>
    Portal: Open _0H_y and paste in this at the buttom:
    Note: I suggest you rename _0H_y.dat to: dat19.dat, it will make it easier to remember the name.
    Code:
    <Object type="0x0f69" id="Battle Arena Portal">
        <Class>Portal</Class>
        <IntergamePortal/>
        <DungeonName>Battle Arena</DungeonName>
        <Texture>
         <File>lofiObj3</File>
          <Index>0x33f</Index>
        </Texture>
      </Object>
    Now we have the world added, but if you enter it, its just empty and nothing will happen. But no reasons to worry! We will add that now.

    7 - Coding the Arena
    Go to: wServer>Realm>Worlds. Right click on the "Worlds" folder and click "Add">"New Item.." Name the file: Arena.cs

    8 - Coding the Arena
    Replace everything in there with this:

     
    Code:
    using System;
    using System.Collections.Generic;
    using wServer.networking;
    using wServer.networking.svrPackets;
    
    using wServer.realm.terrain;
    using wServer.realm.entities;
    
    namespace wServer.realm.worlds
    {
        public class BattleArena : World
        {
            private bool ready = true;
            private bool waiting;
            public int wave = 1;
    
              public List<string> Participants = new List<string>();
    
            public BattleArena()
            {
                Id = ARENA;
                Name = "Battle Arena";
                Background = 1;
                AllowTeleport = false;
                // SetMusic("Arena");
                // Blocking = true;
                // Difficulty = 5;
            }
            protected override void Init()
            {
                base.FromWorldMap(typeof(RealmManager).Assembly.GetManifestResourceStream("wServer.realm.worlds.maps.Arena.wmap"));
            }
    
            public override World GetInstance(Client Client)
            {
                return Manager.AddWorld(new BattleArena());
            }
            private readonly string[] WeakEnemies =
               {
                "Flamer King", "Lair Skeleton King", "Native Fire Sprite", "Native Ice Sprite", "Native Magic Sprite", "Nomadic Shaman", "Ogre King", "Orc King", "Red Spider", "Sand Phantom",
                "Swarm", "Tawny Warg", "Vampire Bat", "Wasp Queen", "Weretiger"
            };
            private readonly string[] NormalEnemies =
            {
                "Aberrant of Oryx", "Abomination of Oryx", "Adult White Dragon", "Assassin of Oryx", "Bile of Oryx", "Gigacorn",
                "Great Lizard", "Minotaur", "Monstrosity of Oryx", "Phoenix Reborn", "Shambling Sludge", "Urgle"
            };
            private readonly string[] Gods =
            {
                "Beholder", "Ent God", "Flying Brain", "Djinn", "Ghost God", "Leviathan", "Medusa", "Slime God", "Sprite God", "White Demon"
            };
            private readonly string[] Bosses =
            {
                "Tomb Defender", "Tomb Attacker", "Tomb Support", "Arachna the Spider Queen", "Archdemon Malphas", "Crystal Prisoner", "Grand Sphinx", "Limon the Sprite God",
                "Lord Ruthven", "Oryx the Mad God 1", "Septavius the Ghost God", "Stheno the Snake Queen", "Thessal the Mermaid Goddess"
            };
    
            public bool OutOfBounds(float x, float y)
            {
                if (Map.Height >= y && Map.Width >= x && x > -1 && y > 0)
                    return (Map[(int)x, (int)y].Region == TileRegion.Outside_Arena);
                else
                    return true;
            }
    
            public override void Tick(RealmTime time)
            {
                base.Tick(time);
                CheckOutOfBounds();
    
                if (CheckPopulation())
                {
                    if (ready)
                    {
                        if (waiting) return;
                        ready = false;
                        wave++;
                        foreach (KeyValuePair<int, Player> i in Players)
                        {
                            i.Value.Client.SendPacket(new NotificationPacket
                            {
                                Color = new ARGB(0xffff00ff),
                                ObjectId = i.Value.Id, //Can be disabled/enabled depending on solo/multiplayer
                                Text = "Wave " + wave.ToString() + " - Next round begins in: 5 Seconds"
    
                            });
                        }
                        waiting = true;
                        Timers.Add(new WorldTimer(5000, (world, t) =>
                        {
                            ready = false;
                            SpawnEnemies();
                          //  SpawnBosses(); //Only activate every 10th round.
                            waiting = false;
                        }));
                    }
                    ready = true;
                }
            }
            private void SpawnEnemies() //Spawn function, using wmap.pos.
            {
                
                try
                {
                    List<string> enems = new List<string>();
                    Random r = new Random();
    
                    for (int i = 0; i < wave / 3 + 1; i++)
                    {
                        enems.Add(Gods[r.Next(0, Gods.Length)]);
                    }
                    for (int i = 0; i < wave / 3 + 1; i++)
                    {
                        enems.Add(NormalEnemies[r.Next(0, NormalEnemies.Length)]);
                    }
                    for (int i = 0; i < wave / 3 + 1; i++)
                    {
                        enems.Add(WeakEnemies[r.Next(0, WeakEnemies.Length)]);
                    }
                    Random r2 = new Random();
                    foreach (string i in enems)
                    {
                        ushort id = Manager.GameData.IdToObjectType[i];
                        int xloc = r2.Next(10, Map.Width) - 6;
                        int yloc = r2.Next(10, Map.Height) - 6;
                        Entity enemy = Entity.Resolve(Manager, id);
                        enemy.Move(xloc, yloc);
                        EnterWorld(enemy);
                    }
                }
                catch // (Exception ex)
                {
                  //  Log.Error(ex);
                }
            }
    
            private void SpawnBosses()
            {
                List<string> enems = new List<string>();
                Random r = new Random();
                for (int i = 0; i < (1); i++)
                {
                    enems.Add(Bosses[r.Next(0, Bosses.Length)]);
                }
                Random r2 = new Random();
                foreach (string i in enems)
                {
                    ushort id = Manager.GameData.IdToObjectType[i];
                    int xloc = r2.Next(10, Map.Width) - 6;
                    int yloc = r2.Next(10, Map.Height) - 6;
                    Entity enemy = Entity.Resolve(Manager, id);
                    enemy.Move(xloc, yloc);
                    EnterWorld(enemy);
                }
            }
    
            private bool CheckPopulation()
            {
                if (Enemies.Count == 0)
                {
                    return true;
                }
                return false;
            }
    
            private void CheckOutOfBounds()
            {
                foreach (KeyValuePair<int, Enemy> i in Enemies)
                {
                    if (OutOfBounds(i.Value.X, i.Value.Y))
                    {
                        LeaveWorld(i.Value);
                    }
                }
            }
        }
    }


    9 - Coding the Arena
    Go to: Wmap.cs, and this:
    Code:
     Outside_Arena,
    Below this:
    Code:
    Enemy,
    And now you'r done. If you want to modify you'r arena difficulty and what the arena should spawn, you can always go into the BattleArena.cs file and change theese strings:

     
    Code:
     private readonly string[] WeakEnemies =
               {
                "Flamer King", "Lair Skeleton King", "Native Fire Sprite", "Native Ice Sprite", "Native Magic Sprite", "Nomadic Shaman", "Ogre King", "Orc King", "Red Spider", "Sand Phantom",
                "Swarm", "Tawny Warg", "Vampire Bat", "Wasp Queen", "Weretiger"
            };
            private readonly string[] NormalEnemies =
            {
                "Aberrant of Oryx", "Abomination of Oryx", "Adult White Dragon", "Assassin of Oryx", "Bile of Oryx", "Gigacorn",
                "Great Lizard", "Minotaur", "Monstrosity of Oryx", "Phoenix Reborn", "Shambling Sludge", "Urgle"
            };
            private readonly string[] Gods =
            {
                "Beholder", "Ent God", "Flying Brain", "Djinn", "Ghost God", "Leviathan", "Medusa", "Slime God", "Sprite God", "White Demon"
            };
            private readonly string[] Bosses =
            {
                "Tomb Defender", "Tomb Attacker", "Tomb Support", "Arachna the Spider Queen", "Archdemon Malphas", "Crystal Prisoner", "Grand Sphinx", "Limon the Sprite God",
                "Lord Ruthven", "Oryx the Mad God 1", "Septavius the Ghost God", "Stheno the Snake Queen", "Thessal the Mermaid Goddess"
            };




    Virus Scan:

    If this helped you i would apreciate a thank, alot, otherwise leave your issues below, and i'll answer them Enjoy

    Credits:
    @C453 for some code bits from the Mmoe source.
    @ossimc82 for some code bits from the Fabiano Swagger of Doom Source.
    <b>Downloadable Files</b> Downloadable Files
    Last edited by lkdjnfoskjednfblksjdfn; 05-06-2016 at 12:10 PM.

  2. The Following 8 Users Say Thank You to lkdjnfoskjednfblksjdfn For This Useful Post:

    Breezattak (10-15-2017),cxydsaewq (05-06-2016),Kloki123 (01-28-2017),Luis (05-06-2016),Matrix1101 (07-11-2016),MetroiDD (09-02-2016),MoonMan1 (02-22-2017),OGgurk (05-22-2016)

  3. #2
    Luis's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    2,801
    Reputation
    348
    Thanks
    1,846
    My Mood
    Psychedelic
    Map file approved, good luck rebuilding your rep.

  4. #3
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired
    Quote Originally Posted by Luis View Post
    Map file approved, good luck rebuilding your rep.
    Wow thank you dud, i would've never expected you guys to actually give me another chance. Warms my heart. Me and artisan have made peace btw, so anyone thinking that the war is still going should know that it's not Thanks for the approvement luis

  5. The Following User Says Thank You to lkdjnfoskjednfblksjdfn For This Useful Post:

    OGgurk (05-06-2016)

  6. #4

  7. The Following User Says Thank You to cxydsaewq For This Useful Post:

    lkdjnfoskjednfblksjdfn (05-06-2016)

  8. #5
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired
    Quote Originally Posted by cxydsaewq View Post
    Nice Tutorial
    Thank you m8 <3

  9. #6
    Chiroy's Avatar
    Join Date
    Jun 2014
    Gender
    male
    Location
    127.0.0.1:80
    Posts
    1,500
    Reputation
    28
    Thanks
    2,295
    Quote Originally Posted by thenired View Post
    Wow thank you dud, i would've never expected you guys to actually give me another chance. Warms my heart. Me and artisan have made peace btw, so anyone thinking that the war is still going should know that it's not Thanks for the approvement luis
    *hears gunshots*

  10. #7
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired
    Quote Originally Posted by Fox10 View Post
    *hears gunshots*
    Are you trying to twist the plot? Nothing offensive was ment in this, quoete, i just apreciated his nice comment.

Similar Threads

  1. Glitch Unlimited Battle Arena (UBA)
    By loped in forum Blackshot Hacks & Cheats
    Replies: 16
    Last Post: 04-08-2013, 08:46 AM
  2. Selling Pokemon Vortex Battle Arena Account! CHEAP!! around 100 legendary's!!!!
    By Fr33f0rdeath in forum Selling Accounts/Keys/Items
    Replies: 2
    Last Post: 01-04-2013, 09:28 AM
  3. [Release] Crysis 2 MultiPlayer / Singleplayer Crack 1.4
    By SmX1 in forum Crysis 2 Hacks / Cheats
    Replies: 471
    Last Post: 06-12-2011, 05:32 PM
  4. [Help Request] Minecraft free multiplayer and singleplayer
    By Acosiluiqie in forum Minecraft Help
    Replies: 4
    Last Post: 05-11-2011, 11:32 AM
  5. CRYSIS 2 - Cracks, Multiplayer/SinglePlayer
    By DevilsKing in forum Crysis 2 Hacks / Cheats
    Replies: 14
    Last Post: 04-14-2011, 02:41 PM