Raised This Month: $ Target: $400
 0% 

bot AI


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 12-07-2006 , 11:00   bot AI
Reply With Quote #1

I read the Perfect NPC tutorial and I created the bot, but how can I create the "AI". Make it run recognize enimies ect. as if it were a player?
My script to create the bots:
Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> public plugin_init() {     register_plugin("[Nca] Bots", "0.1", "Rolnaaba");     register_concmd("nca_addbot", "spawn_bots", ADMIN_KICK, "usage: nca_addbot");     register_think("nca_bot","bot_think"); } public spawn_bots(id, level, cid) {     if(!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED;     new ent = engfunc(EngFunc_CreateFakeClient,"Onna");     //check creation     if(!ent) {         console_print(id,"[AMXX] Failed to create NPC");         return PLUGIN_CONTINUE;     }     //give ent an origin     new Float:origin[3];     entity_get_vector(id,EV_VEC_origin,origin); //get your origin     entity_set_origin(ent,origin); //set origin     //jump to test     origin[2] += 300.0; //raise origin     entity_set_origin(id,origin); //set higher origin     //make solid     new Float:maxs[3] = {16.0,16.0,36.0};     new Float:mins[3] = {-16.0,-16.0,-36.0};     entity_set_size(ent,mins,maxs); //set size     entity_set_int(ent,EV_INT_solid, 2); //set solid     //gives health/makes killable     entity_set_float(ent,EV_FL_takedamage,1.0); //damage it takes per hit     entity_set_float(ent,EV_FL_health,110.0); //health to start with     //set model/classname (for think and stuff)     entity_set_string(ent,EV_SZ_classname,"nca_bot"); //set class name     entity_set_model(ent,"models/onna.mdl"); //set model     //set animations     entity_set_float(ent,EV_FL_animtime,2.0); //tim for anim.     entity_set_float(ent,EV_FL_framerate,1.0); //frame rate     entity_set_int(ent,EV_INT_sequence,0);     give_weapon(ent);     //tell to think     entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01);         return PLUGIN_CONTINUE; } public give_weapon(ent) {     //gives weapon     new entWeapon = create_entity("info_target"); //create weapon entity     entity_set_string(entWeapon, EV_SZ_classname, "nca_bot_weapon"); //set weapon class name         entity_set_int(entWeapon, EV_INT_movetype, MOVETYPE_FOLLOW); //movetype of the weapon         entity_set_int(entWeapon, EV_INT_solid, SOLID_NOT); //solidity (you can run through their gun like in real game)         entity_set_edict(entWeapon, EV_ENT_aiment, ent);         entity_set_model(entWeapon, "models/p_gauss.mdl"); //set model } public bot_think(ent) {     /* Here is where I would put run/recognition     but dunno exatly what to do */     //set re-think     entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01); }
I toyed with
Code:
engfunc(EngFunc_RunPlayerMove)
but I dunno the correct usage of that and I believe that it will only make them move for a certain amount of time...looked at other bot mods but havent found one that creates the bots and runs a think for me to look at
__________________
DO NOT PM me about avp mod.

Last edited by Rolnaaba; 12-07-2006 at 11:06.
Rolnaaba is offline
 


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 06:51.


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