bot help

bot help

Postby HETAL » 19 Jun 2013, 01:17

How would I add the speed of a bot and how high it can jump, I tried editing playerbot.cs and got it but it wouldn't compile, I am trying to make leeizazombie's request for zombot but I am also trying to make the bot superpowered
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: bot help

Postby HETAL » 14 Jul 2013, 01:37

I have heard of bool jump and bool movement but how woukd I add it?
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: bot help

Postby Breakdown901 » 14 Jul 2013, 11:56

I believe that these options are actually built into the command /botai. You could try a few things with /botai and see what works. I know for a fact you can change the speed of a bot with /botai, not sure about jump though.
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: bot help

Postby Conor » 14 Jul 2013, 19:30

I'm not experienced with the PlayerBot class but I did notice this:
Code: Select all
public int movementSpeed = 24;


I'm imagining you can change that and it will be taken into account inside the bot movement method(s).
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: bot help

Postby HETAL » 16 Jul 2013, 12:44

Yes but for that the bool jump and bool movement have to be true and I have no idea how to add it
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: bot help

Postby ismellike » 16 Jul 2013, 15:46

To edit the jump and movementSpeed you would have to do something like this.

Code: Select all
PlayerBot pb = new PlayerBot(/*whatever it needs in here*/);
pb.jump=10;
pb.movementSpeed=100;


If I were to make a zombot, I would make a partial class like I did with the mapgen plugin.

I would just directly copy and paste the PlayerBot.cs file into my code around a partial class and add in options to search only for not infected.

Code: Select all
namespace MCDzienny
{
   public partial class PBot
         {
          //file
         }
}
namespace MCDzienny
{
   public class Cmdzombot : Command
    {
      //rest of stuff
      PBot pb = new PBot(/*the stuff*/);
   }
}
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: bot help

Postby Conor » 18 Jul 2013, 03:11

ismellike wrote:To edit the jump and movementSpeed you would have to do something like this.

Code: Select all
PlayerBot pb = new PlayerBot(/*whatever it needs in here*/);
pb.jump=10;
pb.movementSpeed=100;


If I were to make a zombot, I would make a partial class like I did with the mapgen plugin.

I would just directly copy and paste the PlayerBot.cs file into my code around a partial class and add in options to search only for not infected.

Code: Select all
namespace MCDzienny
{
   public partial class PBot
         {
          //file
         }
}
namespace MCDzienny
{
   public class Cmdzombot : Command
    {
      //rest of stuff
      PBot pb = new PBot(/*the stuff*/);
   }
}


Why would you make it a partial class? o.O
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: bot help

Postby ismellike » 18 Jul 2013, 03:44

That way you could edit it however you want it, or how would you add it o_o?
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: bot help

Postby Conor » 18 Jul 2013, 04:55

ismellike wrote:That way you could edit it however you want it, or how would you add it o_o?


I would just add another class? Like this for example..

Code: Select all
using System;

namespace MCDzienny
{
   public class CmdMyCommand : Command
   {
       // Stuff

       public override void Use(Player p, string message)
       {
            PBot pb = new PBot(p);
            pb.MyMethod();
       }
   }

   public class PBot
   {
       Player player;     

       public PBot(Player p)
       {
            player = p;
       }

       public void MyMethod()
       {
            player.flipHead = true;
       }
   }
}


A partial class just means you can add another partial class of the same name, and together they are considered as one whole class. So methods/variables you put in each will be accessible via both partial classes, and by anywhere in the program by using the class name. So basically it can just help you with organisation :) For a pointless example..

Code: Select all
public partial class MyClass
{
    public string myClassName;   

    public MyClass(string myClassName)
    {
        this.myClassName = myClassName;
    }
}

public partial class MyClass
{
    public string myString;
    public int myInt;

    public void MyMethod(string str, int i)
    {
        Console.WriteLine(str + " " + i.ToString());
    }
}

public class StartOfProgram
{
    public static void Main(string[] args)
    {
        MyClass mc = new MyClass("name");
       
        mc.myString = "hello";
        mc.myInt = 10;
        mc.MyMethod(mc.myString, mc.myInt);
    }
}
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 3 guests

cron