Jump to content
SSForum.net is back!

Recommended Posts

Posted

Okay.. been looking for a way to get this to work

 

Im making a football bot, i currently have it so u fly into the end zone with no ball and its a touch down.. i need the bot to check that you have the ball, then perform the functions..

 

anyone know how?

Posted

He means AMERICAN football *retch*.

 

God knows why your players can't just press insert... Is there a specific effect you want to bot to do?

 

It sounds like you can convert the hockey bot to do the job.

DoCk>> it's shaped like a phallus and i live on a wart on its side

 

Hyrulian> biscuit

Hyrulian> where in Uk u from

B i s c u i t> spain

Posted

Oh yeah and heres what catid told me without checking the code so..

 

_listnode<PBall> *parse = balllist->head;



while (parse) {

PBall *pb = parse->item;

if (pb->carrier == p) {

// player is carrying a ball

// do stuff here

break;

}

parse = parse->next;

}

 

but heres the errors

 

spawn.cpp(162) : error C2065: 'ident' : undeclared identifier

spawn.cpp(162) : error C2227: left of '->head' must point to class/struct/union



spawn.cpp(166) : error C2446: '==' : no conversion from 'struct Player *' to 'int'

       This conversion requires a reinterpret_cast, a C-style cast or function-style cast



spawn.cpp(166) : error C2040: '==' : 'int' differs in levels of indirection from 'struct Player *'

 

help if u can

Posted

One way of doing it, placing the code in Event_Ballmove, ballmove is called while the ball is on the map

case EVENT_BallMove:

 {

	 PBall *ball = (PBall*)event.p[0];



	 if(ball->carrier != 65535) //This number means the ball is not being carried

	 {

   _listnode <Player> *parse = playerlist->head; //list of all the player

   

   while (parse) //go through list

   { 

  	 if (ball->carrier == parse->item->ident)      

              { //if you find the player with the ball



     //place your code here

     break; 

  	 } 

  	 parse = parse->next; //next player

   }

	 }	

	 

 }

 

Variable ballList is not one that you have access to, its private to the bot.

Posted
ball->carrier is probably a Player class. This means you can do ball->carrier->etc to the the p-> stuff your used to having. If its just a char or a String, then iterate the player list and find the play with a matching name. Quite simple, think about it.

~Explody

Onions

3:MikeTheNose> I use my own insanity to communicate

Posted

i admit i didnt read teh whole thread, i just looked at the code and it seemed quite complicated...

 

It's basicly what 50% Packetloss said... just more clear and easy

 

case EVENT_BallMove:

 {

	 PBall *ball = (PBall*)event.p[0];



	 int ident = ball->carrier;



	 if (ident == 0xFFFF)

	 {	// dropped

   ballc = 0;

	 }

	 else

	 {	// carried

   ballc = getPlayer(ident);

	 }

 }

 break;

 

Player *botInfo::getPlayer(int ident)

{

_listnode <Player> *parse = playerlist->head;



while (parse)

{

 Player *p = parse->item;



 if (p->ident == ident)

 {

	 return p;

 }



 parse = parse->next;

}



return NULL;

}

 

in spwn.h u have to define ballc as Player *ballc;

Posted
only problem with that, is you cant use p-> stuff in BallMove

 

in that case i cant make it check your coordinates also

p->tile.x

p->tile.y

Use these to find player locations, in the case that i have above,

parse->item->tile.x

parse->item->tile.y

to get them out of the linkedlist, you can also get the ball's coords, explained below

 

ball->carrier is probably a Player class.

 

struct PBall

{

Uint16 x, y;

Sint16 xvel, yvel;

Uint16 team;

Uint16 ident;

Uint16 carrier;

Uint32 time; 	 // Local timestamp on event (not constant)

Uint32 hosttime;  // Remote timestamp on event (constant until new event)

Uint32 lastrecv;  // Last update recv time (for timeout)

};

Nope, its a unsigned variable, carrier holding the number that each player is !@#$%^&*igned when they enter, if they pick up the ball the number changes to your ident

Posted
a word of advise, forums.minegoboom.com , this is the best place for your questions..they are a lot more patient and understand better. They also have official helpers, such as kozy, that are there to help you understand and write code.
Posted

Alright well i did:

 

if (parse->item->tile.x >= 346 && parse->item->tile.x <= 361 && parse->item->tile.y >= 453 && parse->item->tile.y <= 574)

 

thats all good it works, now just to do sendPrivate(p, ""); stuff..

 

if theres no player stuff in this how can i do sendprivate?

 

 sendPrivate(p, "*prize 7");

Posted

This here,

_listnode <Player> *parse = playerlist->head;

 

is a list of all the players, and we called the variable "parse".

parse holds items, which is declared between the <> symbols, in this case players in the game. So when you do parse->item , it will return a Player. We made parse equal to the top of the list of player, each time you do, parse=parse->next, it goes to the next player in the list

 

tried to explain it in simple terms, hopefully didnt confuse you. The actual process is a lot more complex than what i have writen

Posted

A word of advice, if you plan to know exactly where the powerball is when it isn't being carried, you cannot, unless you get the physics formulas, but if you're making a game that requires a lot of powerball player movement(PBall Carriers) then you can maybe pull it off.

 

-nintendo64

Posted

Just use my piece of code and you have a globalplayer variable that you are able to use....

sigh, no1 listens to me

 

k0zy

Guest
This topic is now closed to further replies.
×
×
  • Create New...