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

How To: Make a perfect NPC


Post New Thread Reply   
 
Thread Tools Display Modes
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 10-26-2010 , 18:52   Re: How To: Make a perfect NPC
Reply With Quote #211

Quote:
Originally Posted by SaM.ThE.MaN View Post
ha ... haha .... hahaha .... HAHAHAHAHAAAAAAAAAAAAAAAAHAHAHAHAH NICE COW !!!! .... HAHAHHAHHAHAHA ... DUDE GIMME THE .mdl for it
Here you go
Attached Files
File Type: zip cow.zip (23.4 KB, 286 views)
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Destro-
Veteran Member
Join Date: Jun 2010
Location: $me->location();
Old 10-28-2010 , 19:53   Re: How To: Make a perfect NPC
Reply With Quote #212

Quote:
Originally Posted by dstopgunner View Post
appreciated if any1 can help +rep
tried hooking death and takedamage by HAM

PHP Code:
 RegisterHam(Ham_TakeDamage"npc_lychon""hook_TakeDamage")
 
RegisterHam(Ham_Killed"npc_lychon""Fwd_Ham_Killed"); 
did i make any error/mistake?

PHP Code:
public Fwd_Ham_Killed(ent)
{
 new 
classname[32]
 
pev(entpev_classnameclassname31)
 if(!
is_user_alive(ent) && equal(classname"npc_lychon"))
 {
  
client_print(0,print_chat,"[TEST] NPC DIED.")
  
entity_set_int(ent,EV_INT_sequence,random_num(9,10))
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE

the test npc died message didnt appear and the NPC still disappears once its HP reach 0 and i cant make any death animation =/

PHP Code:
public hook_TakeDamage(ent)
{
 
client_print(0,print_chat,"[TEST] Damage recieved by entity.")
 new 
classname[32]
 
pev(entpev_classnameclassname31)
 
 new 
origin[3]
 
get_user_origin(ent,origin)
 new 
hitpointweapon
 get_user_attacker
(ent,weapon,hitpoint)
 if(
equal(classname"npc_lychon"))
 {
  switch(
hitpoint)
  {
   case 
1:
   {
    
get_user_origin(ent,origin,1)
   }
   case 
2:
   {
    
origin[2] += 25
   
}
   case 
3:
   {
    
origin[2] += 10
   
}
   case 
4:
   {
    
origin[2] += 10
    origin
[0] += 5
    origin
[1] += 5
   
}
   case 
5:
   {
    
origin[2] += 10
    origin
[0] -= 5
    origin
[1] -= 5
   
}
   case 
6:
   {
    
origin[2] -= 10
    origin
[0] += 5
    origin
[1] += 5
   
}
   case 
7:
   {
    
origin[2] -= 10
    origin
[0] -= 5
    origin
[1] -= 5
   
}
  }
  
client_print(0,print_chat,"[TEST] Making blood.")
  
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  
write_byte(TE_BLOODSPRITE)
  
write_coord(origin[0])
  
write_coord(origin[1])
  
write_coord(origin[2])
  
write_short(blood)
  
write_short(blood)
  
write_byte(78)
  
write_byte(10)
  
message_end()
  
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  
write_byte(TE_BLOODSPRITE)
  
write_coord(origin[0])
  
write_coord(origin[1])
  
write_coord(origin[2])
  
write_short(blood)
  
write_short(blood)
  
write_byte(78)
  
write_byte(12)
  
message_end()
  
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
  
write_byte(TE_BLOODSPRITE)
  
write_coord(origin[0])
  
write_coord(origin[1])
  
write_coord(origin[2])
  
write_short(blood)
  
write_short(blood)
  
write_byte(78)
  
write_byte(15)
  
message_end()
 }

both test damage recieve and blood making messages didnt appear


and I try to make it think and show knifing animation , havnt coded the damage yet but it has some errors.
im trying to make it knife the nearest person next to it

PHP Code:
public npc_think(ent)
{
 new 
npcorigin[3]
 
get_user_origin(entnpcorigin)
 
 new 
closestTarget 0Float:closestDistanceFloat:distanceFloat:closestOrigin[3], Float:playerOrigin[3]
 for (new 
1<= MAX_PLAYERSi++) 
 {
  if (!
is_user_connected(i) || !is_user_alive(i)) // temporarily dont check team:
   
continue
  
get_user_origin(iplayerOrigin)
  
distance vector_distance(npcoriginplayerOrigin)
  
closestOrigin playerOrigin
  
if (distance closestDistance || closestTarget == 0
  {
   
closestTarget i
   closestDistance 
distance
  
}
 }
 if (
closestTarget) {
  new 
rand random_num(1,3)
  {
   switch(
rand)
   {
    case 
1:{entity_set_int(ent,EV_INT_sequence,5);} // making animation but didnt see any
    
case 2:{entity_set_int(ent,EV_INT_sequence,6);}
    case 
3:{entity_set_int(ent,EV_INT_sequence,7);}
   }
  }
 }

I didnt see the animation
https://forums.alliedmods.net/showthread.php?t=140542
in Spanish.
__________________
Destro- is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 11-21-2010 , 00:36   Re: How To: Make a perfect NPC
Reply With Quote #213

How to make a NPC can find and kill any player in sv ???
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
albert123
Veteran Member
Join Date: Mar 2009
Location: VietNam, Hai Phong
Old 11-22-2010 , 22:23   Re: How To: Make a perfect NPC
Reply With Quote #214

I think only have a way.. Npc must see you one time,he'll know who you are and go around to find you ( seem like bot ).
__________________
albert123 is offline
Old 12-03-2010, 20:34
Screeaam..
This message has been deleted by Exolent[jNr]. Reason: You have your own thread.
bibu
Veteran Member
Join Date: Sep 2010
Old 12-12-2010 , 13:57   Re: How To: Make a perfect NPC
Reply With Quote #215

Would be cool to see an example with saving from a menu and loading the npc on mapchange.
bibu is offline
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 12-19-2010 , 09:43   Re: How To: Make a perfect NPC
Reply With Quote #216

I just wrote an updated tutorial about this.
Link: http://forums.alliedmods.net/showthread.php?t=145716
__________________
It's a mystery.
Mini_Midget is offline
XpaHuTeJIb
Member
Join Date: Jun 2010
Location: Russia. N.Novgorod
Old 01-31-2011 , 03:04   Re: How To: Make a perfect NPC
Reply With Quote #217

I have two question for a
1 as can be done so that a friendly npc attacking enemies
2 as can be done so that the friendly npc could lead the

sorry for my bad english using google translator
__________________
XpaHuTeJIb is offline
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 01-31-2011 , 07:47   Re: How To: Make a perfect NPC
Reply With Quote #218

1: Yes you can. Search up tower defense or sentry guns.
2. Not quite sure what you mean. Are you asking if a friendly NPC could follow a player? If so then yes you can as well.
__________________
It's a mystery.
Mini_Midget is offline
XpaHuTeJIb
Member
Join Date: Jun 2010
Location: Russia. N.Novgorod
Old 01-31-2011 , 08:15   Re: How To: Make a perfect NPC
Reply With Quote #219

rus
я спрашивал как создать дружеский npc
и как при нажатие кнопки е задействовать его чтоб он шёл за тобой

eng
I asked how to create a friendly npc
and as you press e to use it so he walked behind you
__________________
XpaHuTeJIb is offline
Old 01-31-2011, 11:44
NiHiLaNTh
This message has been deleted by NiHiLaNTh. Reason: useless
BigBo92
Member
Join Date: Aug 2010
Old 02-28-2011 , 08:21   Re: How To: Make a perfect NPC
Reply With Quote #220

Anybody in here can make NPC like this?
http://www.youtube.com/watch?v=Gw9Mz..._order&list=UL
BigBo92 is offline
Send a message via Yahoo to BigBo92
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 21:11.


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