DeadlySoldier!! Posted October 14, 2003 Report Posted October 14, 2003 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?
madhaha Posted October 14, 2003 Report Posted October 14, 2003 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.
DeadlySoldier!! Posted October 14, 2003 Author Report Posted October 14, 2003 it would be much easier to just have a bot control the game then have a mod try to get everyone to listen yeah american football not english
DeadlySoldier!! Posted October 14, 2003 Author Report Posted October 14, 2003 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
divine.216 Posted October 14, 2003 Report Posted October 14, 2003 Here's a start:http://www.research.att.com/~bs/C++.html
divine.216 Posted October 14, 2003 Report Posted October 14, 2003 Or you can start here then move to here and then get through this... then go to http://www.research.att.com/~bs/C++.html The internet is a wonderful place.
DeadlySoldier!! Posted October 14, 2003 Author Report Posted October 14, 2003 ok yeah ill do that NOT i wonder how many sites there are out there bout mervbot.. hmm.. 2? i wanna know how to do it i cant find the pball stuff in player.h or anything
50% Packetloss Posted October 15, 2003 Report Posted October 15, 2003 One way of doing it, placing the code in Event_Ballmove, ballmove is called while the ball is on the mapcase 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.
DeadlySoldier!! Posted October 15, 2003 Author Report Posted October 15, 2003 only problem with that, is you cant use p-> stuff in BallMove in that case i cant make it check your coordinates also
ExplodyThingy Posted October 15, 2003 Report Posted October 15, 2003 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.
Guest k0zy Posted October 15, 2003 Report Posted October 15, 2003 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;
50% Packetloss Posted October 15, 2003 Report Posted October 15, 2003 only problem with that, is you cant use p-> stuff in BallMove in that case i cant make it check your coordinates alsop->tile.x p->tile.yUse these to find player locations, in the case that i have above,parse->item->tile.x parse->item->tile.yto 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
50% Packetloss Posted October 15, 2003 Report Posted October 15, 2003 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.
DeadlySoldier!! Posted October 15, 2003 Author Report Posted October 15, 2003 Ok i guess ill start postin around there
DeadlySoldier!! Posted October 15, 2003 Author Report Posted October 15, 2003 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");
ExplodyThingy Posted October 15, 2003 Report Posted October 15, 2003 As i said, parse->item IS whatever class you are itirating through. Therefore, you do sendPrivate(parse>item,"");
50% Packetloss Posted October 15, 2003 Report Posted October 15, 2003 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
»nintendo64 Posted October 16, 2003 Report Posted October 16, 2003 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
Guest k0zy Posted October 16, 2003 Report Posted October 16, 2003 Just use my piece of code and you have a globalplayer variable that you are able to use....sigh, no1 listens to me k0zy
Trained Posted October 16, 2003 Report Posted October 16, 2003 Or you could make the Endzones goals.. and the ballspeed zero. Just make the ball time pretty short as well.
50% Packetloss Posted October 16, 2003 Report Posted October 16, 2003 Just use my piece of code and you have a globalplayer variable that you are able to use....sigh, no1 listens to me k0zy Yah, use his code, look at that cute avatar, u cant resist
Live-Wire Posted October 16, 2003 Report Posted October 16, 2003 Or, the simplest way, would be to type ?go football in Sports Z..... Hockey Zone.
»Dustpuppy Posted October 16, 2003 Report Posted October 16, 2003 LolPersonally, I'd agree with div.216
DeadlySoldier!! Posted October 17, 2003 Author Report Posted October 17, 2003 well what if you forget to shoot the ball if you make the end zone goals ill just make it bot controled
Recommended Posts