Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

monster_snark ignore its owner ?
http://aghl.ru/forum/viewtopic.php?f=12&t=2944
Страница 1 из 1

Автор:  abdobiskra [ 25 окт 2018, 14:53 ]
Заголовок сообщения:  monster_snark ignore its owner ?

Is there a way to make the monster_snark ignore its owner?
what i try (2ways):
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

new const m_hEnemy  = 244 //EHANDLE // the entity that the monster is fighting.

public plugin_init() {

   RegisterHam ( Ham_Think, "monster_snark", "fw_ThinkSnark" )
   //register_forward(FM_Think,"think_Snark")
}
public fw_ThinkSnark ( Snark )
{
   if ( !pev_valid ( Snark ) )
      return HAM_IGNORED
      
   new Owner  = pev(Snark, pev_owner);
   set_pev(Snark, pev_owner, iOwner);
   new name[33]
   get_user_name(Owner, name, charsmax(name))
   
   client_print(0, print_chat, "** Owner Name is : %s", name)
   
   /*set_pev( Entity, pev_vuser1 , 0 );//pev_EnemyTarget
   set_pdata_int(iOwner, m_hEnemy, 0, 5)
   /set_pev(iOwner, pev_enemy, 0);*/
   
   if(pev(Owner, pev_enemy))
   {
      client_print(0, print_chat, "******************")
      
      return HAM_IGNORED
   }
   //set_pev( Entity, pev_nextthink, get_gametime() + 0.01 );
      
   return HAM_IGNORED
}
public think_Snark( Snark )
{
   
   static Classname[33]
   pev(Snark,pev_classname,Classname,32)
   
   if(!equal(Classname, "monster_snark"))
      return FMRES_IGNORED
   
   new Owner  = pev(Snark, pev_owner);
   set_pev(Snark, pev_owner, Owner);
   
   
   new name[33]
   get_user_name(Owner, name, charsmax(name))
   
   client_print(0, print_chat, "** Owner Name is : %s", name)
   
   set_pev(Snark,pev_nextthink, get_gametime( ) + 1.0 )
   return FMRES_IGNORED
}
Strangely, the owner changes to the server!
I tried to reset the owner back in the code but it did not work?
 
I'm not sure this problem is or not but what I'm trying to reach is to make the monster_snark not target its owner.

Автор:  Lev [ 02 апр 2019, 02:09 ]
Заголовок сообщения:  Re: monster_snark ignore its owner ?

Not sure what you actually want to achive.
Owner on a snark do set this way:
Код:
void CSqueakGrenade :: Spawn( void )
{
   if ( pev->owner )
      m_hOwner = Instance( pev->owner );
So, if you just want to change it, will be easier to catch Spawn event and change pev->owner in it, than to deal with m_hEnemy.

Автор:  abdobiskra [ 02 апр 2019, 16:43 ]
Заголовок сообщения:  Re: monster_snark ignore its owner ?

It's ok ty.
I'm using :
Цитата:
/**
* Description: Checks relation ship between two monsters.
* Forward params: function(this, idother);
* Return type: Integer (R_* constants, see HLDSK).
* Execute params: ExecuteHam(Ham_IRelationship, this, idother);
*/
Ham_IRelationship,

Страница 1 из 1 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/