Sword Fight!

Sword Fight!

Postby Leeizazombie » 11 Jun 2013, 15:27

Would be possible to make a command where you hold a brown mushroom and you are close to a person and by clicking the left mouse button will kill the player, so that the mushroom is the sword, i thought it could then be good for making a Hunger Games server on classic while using muti spawns. /swordfight /sf
Owner of:
LeeIzaZombie Freebuild and Lava Survival V2 (Shut Down and updated)
LeeIzaZombie Survival (Comming back soon)

Contact:
Skype: leeizazombie
IRC: irc.geekshed.net, #leeizazombie, #mcclassichosting
User avatar
Leeizazombie
 
Posts: 536
Joined: 10 Jun 2013, 17:45
Location: Ireland.

Re: Sword Fight!

Postby lucasds12 » 15 Jun 2013, 02:47

Actually this is absolutely hard because as you know, there is no hit box in Classic for the individual and you can't hit a individual unlike premium where you actually can, it is kind of invalid for this to be possibly structured in the software or even impossibly implemented to this software. I'm concerned about this command just because it's kind of impossible to structure and there's only a valid hit box for placing blocks and deleting blocks. Notch could update classic to actually have hit boxes on a individually player and so you are able to hit players and if there is a method that allows this process to be valid but that won't be happening any time sooner, maybe if possible, Dzienny could make a system that allows this variable to become structured but I don't know if it is at all possible. I like your idea man but I think this is just beyond impossible to possibly structure this command or implement.
-Lucas
There is only one thing I do in life, that's contributing here.
lucasds12
 
Posts: 334
Joined: 17 Apr 2013, 16:17
Location: In the deep caves.

Re: Sword Fight!

Postby Breakdown901 » 16 Jun 2013, 09:18

Well, it could be possible in a way. Using the zombie survival touch to kill method is the only way and the only person who could make this is Dzienny but no, you couldn't click left to hit them. You'd just have to walk up to them and touch them. I seriously doubt Dzienny would have the time to make this anyway as it isn't a main priority right now.
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: Sword Fight!

Postby ismellike » 17 Jun 2013, 04:46

Here is my lame attempt to make hit boxes for classic XD

Code: Select all
using System;
using System.Timers;
using System.Collections.Generic;
namespace MCDzienny
{
    public class CmdPVP : Command
    {
        List<Pos> position = new List<Pos>();
        Timer timer = new Timer(100);
        public int interval = 0;
        public override string name { get { return "pvp"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "other"; } }
        public override bool museumUsable { get { return false; } }
        public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
        public override bool ConsoleAccess { get { return false; } }
        void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Player.players.ForEachSync(p =>
            {
                if (p.ExtraData.ContainsKey("playing"))
                {
                    if ((bool)p.ExtraData["playing"] == true)
                    {
                        if (p.onTrain == false)
                        {
                            p.onTrain = true;
                            p.ClearBlockchange();
                            p.Blockchange += new Player.BlockchangeEventHandler(p_Blockchange);
                        }
                        ushort pos1 = (ushort)(p.pos[0] / 32), pos2 = (ushort)(p.pos[1] / 32), pos3 = (ushort)(p.pos[2] / 32), pos4 = (ushort)(pos2 - 1);
                        p.level.Blockchange(pos1, pos2, pos3, Block.glass, true, "");
                        p.level.Blockchange(pos1, pos4, pos3, Block.glass, true, "");
                        Pos pos;
                        pos.x = pos1; pos.y = pos2; pos.z = pos3;
                        if (!position.Contains(pos))
                        {
                            position.Add(pos);
                        }
                        pos.y -= 1;
                        if (!position.Contains(pos))
                        {
                            position.Add(pos);
                        }
                        interval += 1;
                        if (interval >= 5)
                        {
                            position.ForEach(delegate(Pos here)
                            {
                                p.level.Blockchange(here.x, here.y, here.z, Block.air, true, "");
                            });
                            interval = 0;
                        }
                    }
                }
            });
        }
        void p_Blockchange(Player p, ushort x, ushort y, ushort z, byte type)
        {
            if (p.level.GetTile(x, y, z) == Block.glass)
            {
                CheckWho(p, x, y, z);
            }
        }
        void CheckWho(Player p, ushort x, ushort y, ushort z)
        {
            Player.players.ForEach(who =>
            {
                if (who.ExtraData.ContainsKey("playing"))
                {
                    if ((bool)who.ExtraData["playing"] == true)
                    {
                        ushort pos1 = (ushort)(who.pos[0] / 32), pos2 = (ushort)(who.pos[1] / 32), pos3 = (ushort)(who.pos[2] / 32);
                        double distance = Math.Sqrt(Math.Pow(Math.Abs(pos1 - x), 2) + Math.Pow(Math.Abs(pos2 - y), 2) + Math.Pow(Math.Abs(pos3 - z), 2));
                        if (distance <= 2)
                        {
                            GetHit(p, who);
                        }
                    }
                }
            });
        }
        void GetHit(Player p, Player who)
        {
            if (who != p)
            {
                who.health -= 10;
                ushort pos1 = (ushort)(p.pos[0] / 32), pos2 = (ushort)(p.pos[1] / 32), pos3 = (ushort)(p.pos[2] / 32), whopos1 = (ushort)(who.pos[0] / 32), whopos2 = (ushort)(who.pos[1] / 32), whopos3 = (ushort)(who.pos[2] / 32);
                if (pos1 > whopos1)
                    whopos1 -= 1;
                else if (pos1 < whopos1)
                    whopos1 += 1;
                if (pos3 > whopos3)
                    whopos3 -= 1;
                else if (pos3 < whopos3)
                    whopos3 += 1;
                Command.all.Find("move").Use(who, whopos1 + " " + whopos2 + " " + whopos3);
                Player.SendMessage(who, who.health.ToString() + " life left.");
                if (who.health <= 0)
                {
                    Player.GlobalMessage(who.PublicName + " was dominated by " + p.PublicName);
                    Command.all.Find("spawn").Use(who, "");
                    who.health = 100;
                }
            }
        }
        public override void Use(Player p, string message)
        {
            string[] split = message.Trim().Split(' ');
            switch (split[0])
            {
                case "join":
                    if (!p.ExtraData.ContainsKey("playing"))
                    {
                        p.ExtraData.Add("playing", true);
                    }
                    p.ExtraData["playing"] = true;
                    Player.GlobalMessage(p.PublicName + " has joined the pvp game.");
                    return;
                case "leave":
                    if (!p.ExtraData.ContainsKey("playing"))
                    {
                        p.ExtraData.Add("playing", false);
                    }
                    p.ExtraData["playing"] = false;
                    Player.GlobalMessage(p.PublicName + " has left the pvp game.");
                    p.ClearBlockchange();
                    return;
                case "begin":
                case "start":
                    if (p.group.Permission >= LevelPermission.Operator)
                    {
                        timer.Start();
                        timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
                        Player.GlobalMessage("PVP has begun");
                    }
                    return;
                case "end":
                case "stop":
                    if (p.group.Permission >= LevelPermission.Operator)
                    {
                        timer.Stop();
                        timer.Elapsed -= new ElapsedEventHandler(timer_Elapsed);
                        Player.GlobalMessage("PVP has ended");
                    }
                    return;
            }
            Help(p);
        }
        public override void Help(Player p)
        {
            Player.SendMessage(p, "/pvp join/leave -- joins/leaves the pvp game");
            if (p.group.Permission >= LevelPermission.Operator)
                Player.SendMessage(p, "/pvp start/end -- starts/end the pvp game");
        }
        public struct Pos
        {
            public ushort x, y, z;
        }
    }
}
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas


Return to Requests for Addon

Who is online

Users browsing this forum: No registered users and 7 guests

cron