Problem: IDLE anim plays between scripted sequences. Created 4 months ago2019-11-13 16:30:21 UTC by abbadon abbadon

Created 4 months ago2019-11-13 16:30:21 UTC by abbadon abbadon

Posted 4 months ago2019-11-13 16:30:21 UTC Post #343357
Well, this is weird. I did scripted sequences before but this time I am having troubles because the IDLE animation plays between each scripted sequence making all look wrong.
Here´s my multimager and scripted_sequences setup.
multimanagermultimanager
first scripted_sequencefirst scripted_sequence
Second to fourth are the same except the nameSecond to fourth are the same except the name
Just in case, this is the QC file of the model.
Qc fileQc file
What can you see that´s wrong?. I have used the same scripted sequence and multimanager setup of other sequence but with only the names changed.

Also. How can I do so the turrets will not shoot where Bip01 is and shoot to the center of mass of the model?
Posted 4 months ago2019-11-29 17:48:11 UTC Post #343413
Please. I tried the tuts and something is wrong because the idle anim still plays between each animation.Could someone give me a basic setup for this?.

1.Trigger Auto activates Multimanager
2.Multimanager starts each animation at a given time(aiscript or script), now I am not sure of what should I use, because I used those for generic monsters without problems, the problem came because of me using a monster with its own AI (the handofgod monster).
3.Once done the monster starts its own AI, idleing and attacking.

Help. :pwned: If you need files, or the Mod, or whatever thinng you say, just tell.
Posted 3 months ago2019-12-27 18:36:06 UTC Post #343507
Any solution ?, I'm still looking to remedy this problem.
PS: don't answer all at once, please!

:nya: :crowbar:
Posted 3 months ago2019-12-28 05:08:51 UTC Post #343514
Are there any errors in the console?
Also, it looks like scripted_sequence sets some flags to override the target's AI - are you respecting these flags in your new monster?
Posted 3 months ago2019-12-28 10:40:19 UTC Post #343523
The monster must have not its AI activated because it start to attack even before finishing the scripted sequence :( , also there is the idle problem, it performs the idle between each scripted sequence. I am thinking about Quark be the culprit :/
Posted 3 months ago2019-12-29 04:39:24 UTC Post #343528
I doubt the map editor is the problem. Did you write your AI from scratch or copy it from something else?
Posted 3 months ago2019-12-31 11:12:26 UTC Post #343541
It´s a copy of the zombie, with minor modifications: it´s a flying monster (if not, it fall to the ground) for the trace attack function ( it emits sparks if you shot at it) and the punch angle once it hits the player, which in this case is monstruous (300/500 while in the Ichtyosaur is 5 or 8).

Aniway, I did some tests last night (2:00 p.m... I´m tired) and the animations played ok, except that when finished the script, the idle animation returns to the idle-off animation by itself, I think is because the monster lacks of the attack animation yet (i am working on this animation right now).

I will do further tests and see what happen once the model is 100% finished. I can pass you the Mod for you to test it if you want with the map file so you can see what´s wrong in case it fails again.

Thanks Tschumann!!!
Posted 2 months ago2019-12-31 20:17:22 UTC Post #343542
Well...no avail. Now I cannot give you the aiscript setup, but the moster still do crazy things instead of what it should do...I will try to do a vídeo to show you what this monster is behaving.
Posted 2 months ago2020-01-01 01:37:23 UTC Post #343545
I don't know - probably do some debugging and see what is setting the idle animation in the code.
Posted 2 months ago2020-01-03 00:22:50 UTC Post #343548
AIscripted sequence structureAIscripted sequence structure
First AIscripted sequenceFirst AIscripted sequence
Second AIscripted sequenceSecond AIscripted sequence
Multimanager setupMultimanager setup
Trigger Auto setupTrigger Auto setup
Monster setupMonster setup
Qc file in GuiStudioQc file in GuiStudio
It "works". It plays ok the animations but showing 0.5-1 sec of the idle animation just before the second aiscripted sequence is played. Oh. It seem to ignore the player or the bots, it does not attack them...

And, sorry for posting ALL the code...
/***
*
*	Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
*	This product contains software technology licensed from Id
*	Software, Inc. ("Id Technology").  Id Technology (c) 1996 Id Software, Inc.
*	All Rights Reserved.
*
*   This source code contains proprietary and confidential information of
*   Valve LLC and its suppliers.  Access to this code is restricted to
*   persons who have executed a written SDK license with Valve.  Any access,
*   use or distribution of this code by or to any unlicensed person is illegal.
*
****/
//=========================================================
// HandOfGod Monster (10-7-2015) First Attempt.
// Modificado 19/11/2019
//=========================================================

// UNDONE: Don't flinch every time you get hit

#include	"extdll.h"
#include	"util.h"
#include	"cbase.h"
#include	"monsters.h"
#include	"schedule.h"

// New Includes
#include    "weapons.h"
#include	"effects.h"


//=========================================================
// Monster's Anim Events Go Here
//=========================================================
#define	HOG_AE_ATTACK_RIGHT		0x01

class CHog : public CBaseMonster
{
public:
	void Spawn( void );
	void Precache( void );
	void SetYawSpeed( void );
	int  Classify ( void );
	void HandleAnimEvent( MonsterEvent_t *pEvent );
	int IgnoreConditions ( void );

		int  IRelationship( CBaseEntity *pTarget );

	void IdleSound( void );
	void AttackSound( void );

	static const char *pAttackSounds[];
	static const char *pIdleSounds[];
	static const char *pAttackHitSounds[];
	static const char *pAttackMissSounds[];


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

    	void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType );
   	void PrescheduleThink( void );

};

LINK_ENTITY_TO_CLASS( monster_hog, CHog );

const char *CHog::pAttackHitSounds[] =
{
	"sentinel/slash1.wav",
	"sentinel/slash2.wav",
};

const char *CHog::pAttackMissSounds[] =
{
	"drone/claw_miss1.wav",
	"drone/claw_miss2.wav",
};

const char *CHog::pAttackSounds[] =
{
	"drone/attack1.wav",
	"drone/attack2.wav",
};

const char *CHog::pIdleSounds[] =
{
	"drone/idle1.wav",
	"drone/idle2.wav",
	"drone/idle3.wav",
	"drone/idle4.wav",
};


//=========================================================
// Classify - indicates this monster's place in the
// relationship table.
//=========================================================
int	CHog :: Classify ( void )
{
	return	CLASS_ALIEN_MILITARY;

}

//=========================================================
// Relationship - El bichito tiene ahora muchas cosas
// a las que atacar.
//=========================================================
int CHog::IRelationship( CBaseEntity *pTarget )
{

	if ( FClassnameIs( pTarget->pev, "player" ) )
	{
		return R_HT; // Probar R_NM;
	}

	if ( FClassnameIs( pTarget->pev, "monster_crane" ) )
	{
		return R_NO;
	}


	return CBaseMonster::IRelationship( pTarget );
}

//=========================================================
// SetYawSpeed - allows each sequence to have a different
// turn rate associated with it.
//=========================================================
void CHog :: SetYawSpeed ( void )
{
	int ys;

	ys = 180;

#if 0
	switch ( m_Activity )
	{
	}
#endif

	pev->yaw_speed = ys;
}

int CHog :: TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
	// Take 10% damage from bullets
	if ( bitsDamageType == DMG_BULLET )
	{
		Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
		vecDir = vecDir.Normalize();
		float flForce = DamageForce( flDamage );
		pev->velocity = pev->velocity + vecDir * flForce;
		flDamage *= 0.1;
	}

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


void CHog :: IdleSound( void )
{
	int pitch = 95 + RANDOM_LONG(0,9);

	// Play a random idle sound
	EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pIdleSounds[ RANDOM_LONG(0,ARRAYSIZE(pIdleSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
}

void CHog :: AttackSound( void )
{
	// Play a random attack sound
	EMIT_SOUND_DYN ( ENT(pev), CHAN_VOICE, pAttackSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
}


//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CHog :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
	switch( pEvent->event )
	{
		case HOG_AE_ATTACK_RIGHT:
		{
			CBaseEntity *pHurt = CheckTraceHullAttack( 70, RANDOM_LONG (2,10), DMG_SLASH );


		if ( pHurt )
			{
				if ( pHurt->pev->flags & (FL_FAKECLIENT|FL_CLIENT) )
				{
					pHurt->pev->punchangle.z = -300;
					pHurt->pev->punchangle.x = 300;
					pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 550;
				}
				// Play a random attack hit sound
				EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackHitSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackHitSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );
			}
			else // Play a random attack miss sound
				EMIT_SOUND_DYN ( ENT(pev), CHAN_WEAPON, pAttackMissSounds[ RANDOM_LONG(0,ARRAYSIZE(pAttackMissSounds)-1) ], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-5,5) );

			if (RANDOM_LONG(0,1))
				AttackSound();
				pev->nextthink = gpGlobals->time + 10;//Tiempo de espera entre éste ataque y el siguiente
		}
		break;



		default:
			CBaseMonster::HandleAnimEvent( pEvent );
			break;
	}
}

//=========================================================
// Spawn
//=========================================================
void CHog :: Spawn()
{
	Precache( );

	SET_MODEL(ENT(pev), "models/monster_hog.mdl");
	//UTIL_SetSize( pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX );//Buscar tamaño del tentacle
    UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );

	pev->solid			= SOLID_SLIDEBOX;
	pev->movetype		= MOVETYPE_FLY;
	m_bloodColor		= DONT_BLEED;
	pev->health			= 10000;
	pev->view_ofs		= VEC_VIEW;// position of the eyes relative to monster's origin.
	m_flFieldOfView		= VIEW_FIELD_FULL;
	m_MonsterState		= MONSTERSTATE_COMBAT;
	//m_afCapability		= bits_CAP_DOORS_GROUP;

	MonsterInit();


}

//=========================================================
// Precache - precaches all resources this monster needs
//=========================================================
void CHog :: Precache()
{
	int i;

	PRECACHE_MODEL("models/monster_hog.mdl");

	for ( i = 0; i < ARRAYSIZE( pAttackHitSounds ); i++ )
		PRECACHE_SOUND((char *)pAttackHitSounds[i]);

	for ( i = 0; i < ARRAYSIZE( pAttackMissSounds ); i++ )
		PRECACHE_SOUND((char *)pAttackMissSounds[i]);

	for ( i = 0; i < ARRAYSIZE( pAttackSounds ); i++ )
		PRECACHE_SOUND((char *)pAttackSounds[i]);

	for ( i = 0; i < ARRAYSIZE( pIdleSounds ); i++ )
		PRECACHE_SOUND((char *)pIdleSounds[i]);

}

//=========================================================
// AI Schedules Specific to this monster
//=========================================================



int CHog::IgnoreConditions ( void )
{
	int iIgnore = CBaseMonster::IgnoreConditions();

	if ((m_Activity == ACT_MELEE_ATTACK1))
	{
#if 0
		if (pev->health < 20)
			iIgnore |= (bits_COND_LIGHT_DAMAGE|bits_COND_HEAVY_DAMAGE);
		else
#endif

    }
	return iIgnore;

}


//====================================================
// Hog TraceAttack Definitions
//====================================================
void CHog::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
{


	bitsDamageType &= DMG_GENERIC;

	if ( bitsDamageType == 0)
	{
		if ( pev->dmgtime != gpGlobals->time || (RANDOM_LONG(0,100) < 20) )
		{
			UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT(0.5,1.5) );
			pev->dmgtime = gpGlobals->time;

		}
		flDamage *= 0.1;
	}

	CBaseMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );

}


void CHog :: PrescheduleThink( void )
{

}
Any ideas?.
Posted 2 months ago2020-01-10 23:52:48 UTC Post #343587
Nevermind. I kinda fixed it. Thanks tschumann :crowbar:
You must be logged in to post a response.