Raised This Month: $12 Target: $400
 3% 

How To: Make a perfect NPC


Post New Thread Reply   
 
Thread Tools Display Modes
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-11-2006 , 11:44   Re: How To: Make a perfect NPC
Reply With Quote #41

would you put EngFunc_RunPlayerMove in the npc_think? also would that make it run/shoot/ect.? act like a bot per say
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
happycappy
Junior Member
Join Date: May 2006
Location: NL
Old 07-13-2006 , 16:06   Re: How To: Make a perfect NPC
Reply With Quote #42

Can i make a hooker , like with the models of fpsbanana ? xD What should i change to make it work? The model of course.
__________________
7331
happycappy is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 07-13-2006 , 16:55   Re: How To: Make a perfect NPC
Reply With Quote #43

Well what would you want to change about it other than the why is the word M O D EL blocked?
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
JuXas
Member
Join Date: Jul 2005
Location: Panavezys, Lithuania
Old 07-18-2006 , 09:18   Re: How To: Make a perfect NPC
Reply With Quote #44

Hm... My entity isn't solid and i can't kill it

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "First NPC" #define VERSION "1.0" #define AUTHOR "JuXas" new entId; new hp; new bool:dmg = false; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /gina","create_npc");     register_think("npc_gina","npc_think"); } public plugin_precache() {     precache_model("models/npc/gina.mdl"); } public npc_think(id) {     new Float:hlt;     hlt = entity_get_float(entId,EV_FL_health);     if(dmg == true) entity_set_int(entId,EV_INT_sequence,0);     if(floatround(hlt)<hp) {         entity_set_int(entId,EV_INT_sequence,3);         dmg = true;         hp = floatround(hlt);     }     entity_set_float(id,EV_FL_nextthink,halflife_time()+0.001); } public create_npc(id) {     entId = create_entity("info_target");     if(!entId) {         console_print(id,"[AMXX] Failed to create NPC");         return PLUGIN_CONTINUE;     }         new Float:pPos[3];     entity_get_vector(id,EV_VEC_origin,pPos);     pPos[1] += 100.0;     entity_set_origin(entId,pPos);         new Float:maxs[3] = {16.0,16.0,36.0};     new Float:mins[3] = {-16.0,-16.0,-36.0};     entity_set_size(entId,mins,maxs);     entity_set_int(entId,EV_INT_solid,2);         entity_set_float(entId,EV_FL_max_health,200.0);     entity_set_float(entId,EV_FL_takedamage,1.0);     entity_set_float(entId,EV_FL_health,200.0);     entity_set_float(entId,EV_FL_dmg_take,2.0);     hp = 200;         entity_set_model(entId,"models/npc/gina.mdl");     entity_set_string(entId,EV_SZ_classname,"npc_gina");         entity_set_float(entId,EV_FL_animtime,2.0);     entity_set_float(entId,EV_FL_framerate,1.0);     entity_set_int(entId,EV_INT_sequence,0);     entity_set_float(entId,EV_FL_nextthink,halflife_time()+0.01);     console_print(id, "[AMXX] Npc created successfully");     return PLUGIN_CONTINUE; }
__________________
-- Nothing Here --
JuXas is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 07-20-2006 , 21:16   Re: How To: Make a perfect NPC
Reply With Quote #45

nice tut
i also have some rather complete examples of both creating an npc and a bot
(not actually trying to promote my plugins, i made them to be examples and just to see if i could get them work)

NPC -> http://forums.alliedmods.net/showthread.php?t=41457
BOT -> http://forums.alliedmods.net/showthread.php?t=29819

(currently gravity doesnt affect my npcs, that might be fixed at some point.. also suggestions on how to do it wouldnt hurt )
__________________
plop
p3tsin is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-03-2006 , 16:17   Re: How To: Make a perfect NPC
Reply With Quote #46

Here is the fakemeta way, for those that need it. Only difference is that the NPC uses the holo model, and the client command has been changed to "holo". Tested and works.

Code:
// Fakemeta way... #include <amxmodx> #include <fakemeta> public plugin_init() {         register_clcmd("holo", "holo");     register_forward(FM_Think, "Forward_Think");     } public plugin_precache() {         precache_model("models/holo.mdl");     precache_model("models/p_gauss.mdl");     } public holo(id) {     new Float:origin[3];     pev(id, pev_origin, origin);     new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));     give_weapon(ent);     engfunc(EngFunc_SetOrigin, ent, origin);     origin[2] += 300.0;     engfunc(EngFunc_SetOrigin, id, origin);     set_pev(ent, pev_takedamage, 1.0);     set_pev(ent, pev_health, 100.0);     set_pev(ent, pev_classname, "npc_holo");     engfunc(EngFunc_SetModel, ent, "models/holo.mdl");     set_pev(ent, pev_solid, 2);     set_pev(ent, pev_controller_0, 125);     set_pev(ent, pev_controller_1, 125);     set_pev(ent, pev_controller_2, 125);     set_pev(ent, pev_controller_3, 125);         new Float:maxs[3] = {16.0,16.0,36.0};     new Float:mins[3] = {-16.0,-16.0,-36.0};     engfunc(EngFunc_SetSize, ent, mins, maxs);         set_pev(ent, pev_animtime, 2.0);     set_pev(ent, pev_framerate, 1.0);     set_pev(ent, pev_sequence, 0);     set_pev(ent, pev_nextthink, get_gametime() + 0.01);     engfunc(EngFunc_DropToFloor, ent);     dllfunc(DLLFunc_Think, ent);         return 1;     } public give_weapon(ent) {             new entWeapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));         dllfunc(DLLFunc_Spawn, entWeapon);             set_pev(entWeapon, pev_classname, "npc_weapon")         set_pev(entWeapon, pev_movetype, MOVETYPE_FOLLOW);         set_pev(entWeapon, pev_solid, SOLID_NOT);         set_pev(entWeapon, pev_aiment, ent);         engfunc(EngFunc_SetModel, entWeapon, "models/p_gauss.mdl");     } public Forward_Think(id) {     new classname[32];     pev(id, pev_classname, classname, 31);         // Filter other entities...     if (!equal(classname, "npc_holo"))         return;         // Put your think stuff here.     set_pev(id, pev_nextthink, get_gametime() + 0.01);     dllfunc(DLLFunc_Think, id);     }
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-24-2006 , 12:32   Re: How To: Make a perfect NPC
Reply With Quote #47

Are you out of your mind. There is no way I'm going just whip an expert bot. Plus, if your going to attempt to make a bot, the knowledge to do so should already be in your head.

For your set model problem, you should already know how to that to, thats what this entire thread is about, how make an NPC and the code is right there.

Code:
engfunc(EngFunc_SetModel, ent, "models/holo.mdl");

Also, it's not falemaeta it's fakemeta and the holo model is just a default model used for the one of the training course people in HL.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 08-26-2006 at 11:46.
Zenith77 is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-24-2006 , 22:34   Re: How To: Make a perfect NPC
Reply With Quote #48

There is really no difference (code wise) between NPC's and bots besides: their terminology, you have the option of creating a bot that takes up no slots on a server (example above) or use EngFunc_CreateFakePlayer, and the fact that bots simulate live players.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 08-25-2006 at 12:23.
Zenith77 is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 08-25-2006 , 17:27   Re: How To: Make a perfect NPC
Reply With Quote #49

Actually, there is a BIG difference. NPC's that you make that are NOT bots you have to code a LOT more, while with BOTS you can load into the mods already created plugin infastructure, making them a lot easier to move and use realistically.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-26-2006 , 11:48   Re: How To: Make a perfect NPC
Reply With Quote #50

Can you please go away, you have to the only person in the world that has nothing better to do than to keep coming back to AMXX even though you've been banned. Get a life.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Reply



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 18:26.


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