Monthly Target: $400 Donations: $140
 35% 

Potti - a controllable fakeplayer


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Admin Commands        Approver:   v3x (159)
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-13-2006 , 11:12   Potti - a controllable fakeplayer
Reply With Quote #1

Description:
Allows admins to create a bot which can be fully controlled, e.g. move it and handle its menus, etc.

Why?
I didn't see many examples of making a bot in these forums, so i decided to make one.
This plugin can also be used for testing purposes, I myself hate asking other people to join my server to test some little stuff, then when I find an error, they have to wait on the server for ages before I get it fixed
Mostly its just for fun though

Commands:
amx_botadd <name> - create a new bot
amx_botexec <cmd> - execute a command on your bot
amx_botmove <0-2> - make your bot move:
* 0: off
* 1: copy your movements
* 2: same as #1 + aim the same spot when shooting
* 3: look the opposite way and do the opposite moves
amx_botcmds <1/0> - when enabled, all owner commands are sent to his/her bot
amx_botdel - kick your bot from the server

Server cvars:
potti_hudcolor <r g b> - changes the color of the hud message
potti_hudpos <x y> - changes the position of the hud message

Note:
When executing commands, only engine cmds will work, so for example cvars cannot be changed.
Also, I recommend you bind a button to "messagemode amx_botexec", it will be more comfortable to use than opening console every time.


To Do:
- nothing really (don't feel like messing with buyzone)

Known bugs:
- (cs) when owner is dead, pressing duck will open the specmenu which is really annoying
- (cs) can't open buymenu via fullcontrol mode if not in buyzone (or dead)


Changelog:
1.00 - Initial release
1.10 - Added full control mode (changing weapons through slot-keys is also possible now)
- Shows money left on a bot when a buymenu is opened
1.20 - Modified so everyone (with access) can have their own bot
- Cstrike-module is no more needed to display money
- After dying, the owner will automatically move to spectating to his/her bot if botmove is on
- Messages printed to a bot (to center and chat) are shown to its owner too
- Fixed bot latency to show as "BOT"
- More efficient msec calculations
- Other little improvements
1.30 - Added support for The Specialists (press 6 to switch to kungfu when in fullcontrol mode)
- Added botmove 3 to make the bot do the opposite of the owner
- Added a hudtext to show player health, weapon, etc.
- Access level changed from "m" to "p" ^_^
- Removed mod specific definitions
1.40 - Changed owner input hooking style, making it possible for bots to walk and use impulses (flashlight, spray, ..)
- A little tweaking here and there

Credits:
Botman - the source of PODBots helped alot while doing this
Lord of Destruction - aim_at_origin() -function base took from set_client_aiming()
THE_STORM - more efficient msec calculations (from ePODbot)
strelomet - display bot latency as "BOT" (from YaPB)
Orangutanz - thanks for pointing out the few improvements
Karko - thanks for helping with adding support for TS


You need Fakemeta module to run this
Attached Files
File Type: sma Get Plugin or Get Source (potti.sma - 20629 views - 25.6 KB)
__________________
plop

Last edited by p3tsin; 12-08-2006 at 14:14.
p3tsin is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-13-2006 , 11:13  
Reply With Quote #2

any help on solving the bugs will be greatly appreciated
btw, the plugin is only tested on cs, would be great if someone tested it over on some other mods
__________________
plop
p3tsin is offline
3xr
Junior Member
Join Date: Mar 2005
Old 06-13-2006 , 11:38  
Reply With Quote #3

I have a little better whole fix... somehow(not coding terms) make an iframe which just takes all commands and puts them to the bot...

I don't know AMXX Natives completly yet, it has to be possible.
3xr is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-13-2006 , 13:49  
Reply With Quote #4

Instead of redefining the button constants you can include engine_const ;)

Nice job.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-13-2006 , 15:32  
Reply With Quote #5

updated to v1.10

- added full control mode, you can now change weapons via slot-keys too (this is done through a fakemenu which catches menuselect and so on.. i dont like it but didnt see any other option )
- shows money left on a bot when a buymenu is opened
- and changed the defines to engine_const.inc as suggested

there's a new definition too: MOD_CSTRIKE
im still hoping that somebody could test it on other mods, like dod..
u just need to undefine the above and change the weapon constants above plugin_init()
__________________
plop
p3tsin is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 06-13-2006 , 16:41  
Reply With Quote #6

Pretty good plugin ^^
Btw, if you can tell me where to get all the CSW Weapon constants for DOD, i could try it ^^
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-13-2006 , 17:48  
Reply With Quote #7

csw defines are just the weapon constants for cs,
for dod theyre DODW_* which can be found in dodconst.inc
__________________
plop
p3tsin is offline
bmxer4lyfe
Junior Member
Join Date: Aug 2005
Location: Canada eh
Old 06-13-2006 , 20:25  
Reply With Quote #8

fun plugin, i cant wait till your final release
bmxer4lyfe is offline
Send a message via AIM to bmxer4lyfe
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-13-2006 , 21:29  
Reply With Quote #9

no crash bugs or anything?
Does the bot appear to be a player? Like ent 1-maxplayers and shows up on scoreboard (TAB)?
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 06-13-2006 , 21:41  
Reply With Quote #10

New msec calculation
Code:
new Float:msec global_get(glb_frametime, msec) msec *= 1000.0
Place the last 2 lines in your StartFrame_Post function, nothing else is required
Credit: THE_STORM (ePODbot)

Display BOT in scoreboard
Code:
set_user_info(id, "*bot", "1")
Credit: strelomet (YaPB)

Also since I have a Bot API in development, that:
engfunc(EngFunc_RunPlayerMove,bot,botangles,botmove[0],botmove[1],0.0,botbuttons,0,msec)

I find the part highlighted in bold, does nothing

Instead of this:
Code:
new Float:CoreAngles[3] CoreAngles[0] = Radian2Degree(floatatan(DeltaOrigin[2] / Distance2D(DeltaOrigin[0], DeltaOrigin[1]),0)) CoreAngles[1] = Radian2Degree(floatatan(DeltaOrigin[1] / DeltaOrigin[0],0)) if(DeltaOrigin[0] >= 0.0) CoreAngles[1] += 180.0
You can do this:
Code:
engfunc(EngFunc_VecToAngles, DeltaOrigin, botangles)
More efficient IMHO
Orangutanz is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:32.


Powered by vBulletin®
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Theme made by Freecode