Bots using menu
Hello, what would be the easiest way to make bots select random number from a menu? Eg. if there's map vote, the bots would choose 1 or 2 randomly.
|
Code:
|
Thank you Brad, but im new and not sure how to add that in the script.
Something like this maybe? Code:
I tried to compile one script with this included and it said 'error 017: undefined symbol "option"' I would really appreciate it if someone could show me working example (In the game I'd start a vote and bots would vote randomly 1-2 or 1-9). I hope it's not too complicated. |
you would need to show hole script if you don't know how to do it yourself.
|
You'll have to change this within the source code of the script itself. First off, a bot won't ever receive a menu to choose from, and thus won't call the function that handles a menu choice. That means that you'll have to change the part of code that dispatches the menu to all the players. When it loops through all the players, you'll need to emulate a vote choice by directly calling the handling function.
Code:
Kinda like that. Just don't try to copy paste that cause it doesn't do jack. |
Thanks for your replies. My main idea is to make bots select random heros in superheromod. When a player level goes up, it shows a menu at start of the round. I know bots doesn't see the menu because of this:
Code:
Here should be the full menu script: Code:
And I really appreciate the script akysiev, I just need some time to fully understand it :) |
Find the register_menu line in plugin_init that has "Select Super Power:" or something like that and post that plus the function it references to.
|
This one?
Code:
And this? Code:
Thanks for the support :) |
Try this. I just deleted the bot block and added an extra conditional before it displays the menu.
Code:
Actually, I made a slight oversight. There's the case where the menu is shorter than 8 elements so it might not select anything. In that case, it may cause a runtime error. I'd like to fix it but I can't at the moment. Will see if I can do so later so remind me if I forget. |
Thank you, but I tried it and the bot didn't select anything, he had level 1 and start of the round. Should I test it again?
Oh and there's always more than 8 heros in the list you can pick from. |
| All times are GMT -4. The time now is 16:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.