Aller au contenu

Photo

animation problem...


  • Veuillez vous connecter pour répondre
Aucune réponse à ce sujet

#1
Ubai

Ubai
  • Members
  • 88 messages

Hello,

 

I'm trying to set this up so the player fires the weapon, then unequips the weapon. After that the animation is played. Right now I have the duration set to 2 seconds for testing but no matter what I do the animations play sequentially with no delay, and the weapon is always unequipped last. Can anyone tell me what I'm doing wrong? Here's the code:

void ReallyPlayCustomAnimation(object oObject, string sAnimationName, int nLooping, float fSpeed = 1.0f)
 {
    PlayCustomAnimation(oObject, sAnimationName, nLooping, fSpeed);
 }


void main()
{
object oPC = GetLastAttacker();
if (!GetIsPC(oPC))
	return;

string sName = GetName(oPC);
SpeakString("I have been attacked by " + sName);
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
string sWeapon = GetName(oWeapon);
string sTag = GetTag(oWeapon);
SpeakString("Attacker's weapon: " + sWeapon);
int nOldLoad = GetLocalInt(oWeapon, "nLoaded");
SendMessageToPC(oPC, "nLoaded is " + IntToString(nOldLoad));
SetLocalInt(oWeapon, "nLoaded", 0);
int nNewLoad = GetLocalInt(oWeapon, "nLoaded");
SendMessageToPC(oPC, "nLoaded is now " + IntToString(nNewLoad));
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oPC, ActionUnequipItem(oWeapon));
DelayCommand(2.0, ReallyPlayCustomAnimation(oPC, "*equipW", 0, 0.5));
} 

Thanks!

Matt