Raised This Month: $ Target: $400
 0% 

Creating Bots - basic model troubles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-09-2010 , 11:41   Creating Bots - basic model troubles
Reply With Quote #1

Hello everyone!

I was wandering these days: How to make bots? Honestly I am trying to put Houndeyes(three legged dog like creatures with sonic attack) from Halflife into Counter Strike, because it would be interesting to fight them on for example cs_italy: Get the hostages back to the rescue zone, but it is guarded by houndeyes. Or any other Xen creatures.

So I copied the model, and the sounds and precached them, and loaded the model with some animation.

First problem: I can move through it, though I set it's solid type( I know I missed something out, but WHAT? )
Second problem: I cannot make the sound emit from the creature. If it is next to me or over a mile from me, the volume is the same. Oh and if I create more creatures, the sounds interrupt each other as they use the same channel.( so I guess the emit_sound is not the right function for this purpose )

Thank you in advance for your comments.

Lulu the hero

This is the code I got so far:
Code:
#include <amxmodx>
#include <engine>

//houndeye files
new const he_model[] = "models/houndeye/houndeye.mdl"
new const he_alert[3][] = {"houndeye/he_alert1.wav","houndeye/he_alert2.wav","houndeye/he_alert3.wav"}
new const he_attack[3][] = {"houndeye/he_attack1.wav","houndeye/he_attack2.wav","houndeye/he_attack3.wav"}
new const he_blast[3][] = {"houndeye/he_blast1.wav","houndeye/he_blast2.wav","houndeye/he_blast3.wav"}
new const he_die[3][] = {"houndeye/he_die1.wav","houndeye/he_die2.wav","houndeye/he_die3.wav"}
new const he_hunt[4][] = {"houndeye/he_hunt1.wav","houndeye/he_hunt2.wav","houndeye/he_hunt3.wav","houndeye/he_hunt4.wav"}
new const he_idle[4][] = {"houndeye/he_idle1.wav","houndeye/he_idle2.wav","houndeye/he_idle3.wav","houndeye/he_idle4.wav"}
new const he_pain[5][] = {"houndeye/he_pain1.wav","houndeye/he_pain2.wav","houndeye/he_pain3.wav","houndeye/he_pain4.wav","houndeye/he_pain5.wav"}

//animation phases
new const seq_idle = 1
new const seq_run = 5
new const seq_die1 = 6
new const seq_die2 = 7
new const seq_die3 = 8
new const seq_die4 = 9
new const seq_attack = 10
new const seq_flinch_small = 11
new const seq_flinch_small2 = 12
new const seq_die_crumple = 13
new const seq_walk = 14
new const seq_walk2 = 15
new const seq_leaderlook = 16
new const seq_sleep = 17
new const seq_gotosleep = 18
new const seq_sleeptostand = 19
new const seq_madidle = 20
new const seq_madidle2 = 21
new const seq_madidle3 = 22
new const seq_inspect = 23
new const seq_eat = 24
new const seq_180left = 25
new const seq_180right = 26
new const seq_jumpback = 27
new const seq_wakefast = 28
new const seq_whimper = 29
new const seq_jumpwindow = 30

//houndeye datas
//new houndeyes
new houndeyes_health

new Float:thinktime  = 1.0
new Float:f_origin[3]

//the big thing
public plugin_init(){
  register_plugin("HoundEye","1.0","Lulu the hero")
  //console commands
  register_concmd("create_houndeye","create_houndeye",0,"")
  
  register_think("houndeye","houndeye_think")
}

//precaching files
public plugin_precache(){
  //models
  precache_model(he_model)
  //sounds
  for(new i=0;i<3;i++){
    precache_sound(he_alert[i])
    precache_sound(he_attack[i])
    precache_sound(he_blast[i])
    precache_sound(he_die[i])
  }
  for(new i=0;i<4;i++){
    precache_sound(he_hunt[i])
    precache_sound(he_idle[i])
  }
  for(new i=0;i<5;i++){
    precache_sound(he_pain[i])
  }
}

//creating a houndeye
public create_houndeye(id){
  new origin[3]
  get_user_origin(id,origin,3)
  f_origin[0]=float(origin[0])
  f_origin[1]=float(origin[1])
  f_origin[2]=float(origin[2])
  
  new houndeye = create_entity("info_target")
  if(houndeye){
    new Float:MinBox[3]
    new Float:MaxBox[3]
    
    MinBox[0] = -10.0
    MinBox[1] = -10.0
    MinBox[2] = -10.0
    MaxBox[0] = 10.0
    MaxBox[1] = 10.0
    MaxBox[2] = 10.0

    entity_set_vector(houndeye, EV_VEC_mins, MinBox)
    entity_set_vector(houndeye, EV_VEC_maxs, MaxBox)
    
    entity_set_string(houndeye, EV_SZ_classname, "houndeye")
    entity_set_model(houndeye, he_model)
    
    entity_set_origin(houndeye, f_origin)
    entity_set_int(houndeye, EV_INT_team, get_user_team(id))
    entity_set_int(houndeye, EV_INT_solid, SOLID_BBOX)
    entity_set_int(houndeye, EV_INT_movetype, MOVETYPE_STEP)
    //entity_set_edict(houndeye, EV_ENT_owner, 33)
        
    entity_set_float(houndeye,EV_FL_animtime,2.0)
    entity_set_float(houndeye,EV_FL_framerate,1.0)
    entity_set_int(houndeye,EV_INT_sequence,seq_idle)
    //houndeyes = houndeye
    houndeyes_health = 50;
    
    entity_set_float(houndeye,EV_FL_nextthink,halflife_time() + thinktime)
    
    client_print(0,print_chat,"HoundEye created!")
  }else{
    client_print(0,print_chat,"Could not create HoundEye!")
  }
  
  return PLUGIN_HANDLED
}

//destroying a houndeye
public destroy_houndeye(params[]){
  new houndeye = params[0]
  remove_entity(houndeye)
  client_print(0,print_chat,"HoundEye destroyed!")
}

public houndeye_think(houndeye){
  if(random(10)>6){
    new params[2]
    params[0] = houndeye
    params[1] = 0
    blink(params)
  }
  if(houndeyes_health>30){
    houndeyes_health=houndeyes_health-1
    emit_sound(0,CHAN_AUTO,he_idle[random(4)],1.0,ATTN_NORM,0,PITCH_NORM)
    entity_set_int(houndeye,EV_INT_sequence,seq_idle)
    entity_set_float(houndeye,EV_FL_nextthink,halflife_time() + thinktime)
  }else if(houndeyes_health>0){
    houndeyes_health=houndeyes_health-1
    emit_sound(0,CHAN_AUTO,he_hunt[random(4)],1.0,ATTN_NORM,0,PITCH_NORM)
    if(houndeyes_health%2==0){
      //entity_set_origin(houndeye, f_origin)
      entity_set_int(houndeye,EV_INT_sequence,seq_walk)
    }else{
      entity_set_int(houndeye,EV_INT_sequence,seq_walk2)
    }
    entity_set_float(houndeye,EV_FL_nextthink,halflife_time() + thinktime)  
  }else{
    emit_sound(0,CHAN_VOICE,he_die[random(3)],1.0,ATTN_NORM,0,PITCH_NORM)
    entity_set_int(houndeye,EV_INT_sequence,seq_die_crumple)
    new params[1] 
    params[0] = houndeye
    set_task(3.0,"destroy_houndeye",0,params,1)
  }
}

public blink(params[]){
  new houndeye = params[0]
  new blinkstate = params[1]
  switch (blinkstate){
    case 0,2: {
      entity_set_int(houndeye,EV_INT_skin,1)
      params[1]=blinkstate+1
      set_task(0.1,"blink",0,params,2)
    }
    case 1: {
      entity_set_int(houndeye,EV_INT_skin,2)
      params[1]=blinkstate+1
      set_task(0.1,"blink",0,params,2)
    }
    case 3: {
      entity_set_int(houndeye,EV_INT_skin,0)
    }
  }
}
Lulu the hero is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-09-2010 , 11:59   Re: Creating Bots - basic model troubles
Reply With Quote #2

Any reasons to not use MonsterMod ?
__________________
Arkshine is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-09-2010 , 12:06   Re: Creating Bots - basic model troubles
Reply With Quote #3

Oh, didn't know it exists, thanks. Anyway I still would like to know how to create such a mod( step by step ). Is there any tutorials out there? Google only shows forums about podbots, but not about how to create one.
Lulu the hero is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-09-2010 , 12:47   Re: Creating Bots - basic model troubles
Reply With Quote #4

MonsterMod is actually a metamod module where monsters were taken from the HLSDK SinglePlayer. Not all are into if I remember and the module is buggy for some things, but houdeye and others monsters work fine. Just test it.
__________________
Arkshine is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-09-2010 , 12:54   Re: Creating Bots - basic model troubles
Reply With Quote #5

I don't want to look unthankful, but this is not what I am looking for. I want to know how to create and manipulate an entity. I want to know why I can walk right through the "solid" model I created. There are not much tutorials on the net. List of functions, yes, but no tutorials.
Anyway I will look at this monster mod.
Lulu the hero is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-09-2010 , 13:02   Re: Creating Bots - basic model troubles
Reply With Quote #6

You don't set the size.
__________________
Arkshine is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 02-13-2010 , 23:14   Re: Creating Bots - basic model troubles
Reply With Quote #7

Yes indeed, thank you.
Also if I want the sound to come from the creature, then I should emit the sound FROM it by giving it's id in the ID field and a channel of CHAN_BODY or CHAN_WEAPON. Am I right?
Lulu the hero is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 02-14-2010 , 00:45   Re: Creating Bots - basic model troubles
Reply With Quote #8

Check out Pokemod, Professor Oak emits a sound and I believe it's set up the same way you're looking for. Sounds like a good example for what you're trying to manipulate.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Lulu the hero
Senior Member
Join Date: Oct 2009
Location: Budapest, Hungary
Old 04-13-2010 , 17:33   Re: Creating Bots - basic model troubles
Reply With Quote #9

Indeed, professor oak is a real good example of creating an NPC. Though it's modell is not as complex as a gargantua's. Is it possible to make the solid type of an entity not box shaped, but a bit more complex?
For a quick exaple if the garg's legs are so far away that a player can fit in, then why not be able to run across it's legs?
Lulu the hero 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 07:17.


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