Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osprey doesn't fire trigger targets #3261

Open
SamVanheer opened this issue Mar 15, 2022 · 0 comments
Open

Osprey doesn't fire trigger targets #3261

SamVanheer opened this issue Mar 15, 2022 · 0 comments

Comments

@SamVanheer
Copy link

The Osprey doesn't fire its trigger targets, which are targets fired when a specific NPC condition is met such as taking damage, dying, etc.

To fix this, apply the following changes:
Uncomment this line:

// int TakeDamage( entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType );

After this line:

void ShowDamage( void );

Add this:

void Update();

After this line:

pev->health = 400;

Add:

pev->max_health = pev->health;

Replace these lines:

ShowDamage( );

ShowDamage( );

ShowDamage( );

With:

Update();

After this line:

pev->takedamage = DAMAGE_NO;

Add this:

pev->deadflag = DEAD_DYING;

After this line:

Add this:

void COsprey::Update()
{
	//Look around so AI triggers work.
	Look(4092);

	//Listen for sounds so AI triggers work.
	Listen();

	ShowDamage();
	FCheckAITrigger();
}

int COsprey::TakeDamage(entvars_t* pevInflictor, entvars_t* pevAttacker, float flDamage, int bitsDamageType)
{
	//Set enemy to last attacker.
	//Ospreys are not capable of fighting so they'll get angry at whatever shoots at them, not whatever looks like an enemy.
	m_hEnemy = Instance(pevAttacker);

	//It's on now!
	m_MonsterState = MONSTERSTATE_COMBAT;

	return CBaseMonster::TakeDamage(pevInflictor, pevAttacker, flDamage, bitsDamageType);
}

These changes have the following effects:

  • Setting max_health enables the 50% damage condition to work properly.
  • Setting deadflag to DEAD_DYING enables the Death condition to work properly.
  • The Update method handles showing damage, and now looks around the level which updates condition bits that track whether the Osprey can see enemies or not, which handles the See player * conditions. The look distance is the same as that of the Apache, and covers virtually the entire level. It also listens for sounds, which handles the Hear * conditions. Finally, it evaluates the condition to see if it needs firing.
  • TakeDamage stores off the last attacker as the Osprey's enemy so the See Player, Mad at player condition works properly. It also sets the Osprey's state to combat so the See Player, not in combat condition works properly.
SamVanheer added a commit to twhl-community/halflife-op4-updated that referenced this issue Mar 15, 2022
…eSoftware/halflife#3259

Fix Black Ops Osprey teleporting to world origin if it isn't moving at all Resolves ValveSoftware/halflife#3260
Fix Black Ops Osprey not firing trigger targets Resolves ValveSoftware/halflife#3261
@SamVanheer SamVanheer reopened this May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants