I've been at this thing for the passed week, and it's melted my brain into a bubbly pile of grey crapulence.
Description: I've used the code from the Skaarjpack folder (Skaarjpupae) Everything is fine for the most part, the monsters walk around, idle, die, run, attack.
Problem: When the monster makes contact with the player, it deals damage instantly. I need to somehow delay the actual damage that is dealt to occur 'X' amount of seconds after initial contact so that it syncs with my attack animation. (Looks really silly when you get hurt before the monster is done with its claw animation)
I've tried doing a search, googled, idled in irc, and haven't come to any satisfactory progress. This is eating up so much of my time that I could be using on other things. If anyone has the coding knowhow to help me with this piece of code and tell me how I futzed it up, that would be very appreciated! I'll post the code below:
class ThisMonster extends MasterMonster;
var name DeathAnims[2];
var bool btimeddamage;
function SetMovementPhysics()
{
SetPhysics(PHYS_Falling);
}
simulated function PlayDirectionalDeath(Vector HitLoc)
{
PlayAnim(DeathAnims[Rand(2)], 1.0, 0.0);
}
simulated function PlayDirectionalHit(Vector HitLoc)
{
TweenAnim('TakeHit', 0.05);
}
function PlayVictory()
{
Controller.bPreparingMove = true;
Acceleration = vect(0,0,0);
bShotAnim = true;
PlayAnim('WinAnimation', 1.0, 0);
Controller.Destination = Location;
Controller.GotoState('TacticalMove','WaitForAnim') ;
}
function RangedAttack(Actor A)
{
local float Dist;
if ( bShotAnim )
return;
Dist = VSize(A.Location - Location);
if ( Dist > 100 )
return;
bShotAnim = true;
PlaySound(ChallengeSound[Rand(4)], SLOT_Interact);
if ( Dist < MeleeRange + CollisionRadius + A.CollisionRadius )
if (!btimeddamage)
{
btimeddamage=true;
settimer(2,false);
}
if ( FRand() < 0.5 )
SetAnimAction('Attack1');
else
SetAnimAction('Attack2');
MeleeDamageTarget(25, vect(0,0,0));
Controller.bPreparingMove = true;
Acceleration = vect(0,0,0);
return;
}
function Timer()
{
if (btimeddamage)
{
btimeddamage=false;
}
}
I'm not sure if I put the timer in the right place, or if I'm missing a whole boat load of code but if you are willing to help with this little problem, I would be very grateful! Thanks.
Description: I've used the code from the Skaarjpack folder (Skaarjpupae) Everything is fine for the most part, the monsters walk around, idle, die, run, attack.
Problem: When the monster makes contact with the player, it deals damage instantly. I need to somehow delay the actual damage that is dealt to occur 'X' amount of seconds after initial contact so that it syncs with my attack animation. (Looks really silly when you get hurt before the monster is done with its claw animation)
I've tried doing a search, googled, idled in irc, and haven't come to any satisfactory progress. This is eating up so much of my time that I could be using on other things. If anyone has the coding knowhow to help me with this piece of code and tell me how I futzed it up, that would be very appreciated! I'll post the code below:
class ThisMonster extends MasterMonster;
var name DeathAnims[2];
var bool btimeddamage;
function SetMovementPhysics()
{
SetPhysics(PHYS_Falling);
}
simulated function PlayDirectionalDeath(Vector HitLoc)
{
PlayAnim(DeathAnims[Rand(2)], 1.0, 0.0);
}
simulated function PlayDirectionalHit(Vector HitLoc)
{
TweenAnim('TakeHit', 0.05);
}
function PlayVictory()
{
Controller.bPreparingMove = true;
Acceleration = vect(0,0,0);
bShotAnim = true;
PlayAnim('WinAnimation', 1.0, 0);
Controller.Destination = Location;
Controller.GotoState('TacticalMove','WaitForAnim') ;
}
function RangedAttack(Actor A)
{
local float Dist;
if ( bShotAnim )
return;
Dist = VSize(A.Location - Location);
if ( Dist > 100 )
return;
bShotAnim = true;
PlaySound(ChallengeSound[Rand(4)], SLOT_Interact);
if ( Dist < MeleeRange + CollisionRadius + A.CollisionRadius )
if (!btimeddamage)
{
btimeddamage=true;
settimer(2,false);
}
if ( FRand() < 0.5 )
SetAnimAction('Attack1');
else
SetAnimAction('Attack2');
MeleeDamageTarget(25, vect(0,0,0));
Controller.bPreparingMove = true;
Acceleration = vect(0,0,0);
return;
}
function Timer()
{
if (btimeddamage)
{
btimeddamage=false;
}
}
I'm not sure if I put the timer in the right place, or if I'm missing a whole boat load of code but if you are willing to help with this little problem, I would be very grateful! Thanks.

Comment