Witchie NL Posted January 2, 2007 Report Posted January 2, 2007 Ok ive had a request for a plugin using territories.A region is specified in an ini file and you can conquer a territory by owning all turf flags in that area.How can i make it determine the places from the flags with mervbot?I know this was used in the turf Desert Strom as diffrent spawns (this plugin used !setspawn to set a spawn and you only spawned there if you captured all flags).
»Maverick Posted January 2, 2007 Report Posted January 2, 2007 aaah yea that was a nice plugin I programmed. Complex though Here is a snippet of the plugin code which iterates over all the flags in the arena and checks if the x and y position of each flag matches the position given in the configuration file (flags[] array): _listnode <Flag> *parse; bool flagCorrect; //Check flags with settings for(int i = 0; i < 32; i++) { for(int j = 0; j < 32; j++) { if(flags[i][j][0] > -1) { parse = flaglist->head; flagCorrect = false; while (parse) { Flag *f = parse->item; if((flags[i][j][0] == (int)f->x) && (flags[i][j][1] == (int)f->y)) { flagCorrect = true; } if(flagCorrect) break; parse = parse->next; } if(!flagCorrect) sendChannel("TURFSPAWN: X or Y position of (area #"+String(i)+") flag #"+String(j+1)+" is incorrect. ("+String(flags[i][j][0])+","+String(flags[i][j][1])+")"); } } } As you can see, the answer to your question is you can do flag->x and flag->y to get it's x and y position (after instantiating it with a Flag object).
Witchie NL Posted January 2, 2007 Author Report Posted January 2, 2007 I just remembered that you made it yes.. thanks and ima see if i can make it work.
Bak Posted January 2, 2007 Report Posted January 2, 2007 I woudln't call it instantiating... more of an implict cast... but who cares.
»Maverick Posted January 3, 2007 Report Posted January 3, 2007 yeah true but I just couldn't find the exact words for it
Recommended Posts