Aller au contenu

Photo

Can I delay command an animation?


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
PJ156

PJ156
  • Members
  • 2 988 messages
Here's the script,

Currently it fails to compile on line 16. I cannot see why this might be, can I not delay a custom animation?

Also I have not set sAnimation2 which needs to be a falls forwards animation. thus far I only know knockdown for this but its wrong for the effect I want which is to collapse forwards. Any suggestions would be welcome.

1  //Levitates then drops PC with get up animation afterwards.
2  void main()
3  {
4  object oTarget = GetFirstPC();
5  string sAnimation1 = "mjr_cast";
6  string sAnimation2 = "????";
7  string sAnimation3 = "getup";
8  effect eFreeze =  EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
9  effect heal = EffectNWN2SpecialEffectFile("sp_sonic_aoe_2",oTarget);
10 effect nova = EffectNWN2SpecialEffectFile("fx_cleansing_nova",oTarget);
13 PlayCustomAnimation(oTarget,sAnimation1,0,0.5f);
14 DelayCommand(1.0f,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eFreeze,oTarget,1.5f));
15 DelayCommand(1.1f,ApplyEffectToObject(DURATION_TYPE_INSTANT,heal,oTarget));
16 DelayCommand(1.1f,PlayCustomAnimation(oTarget,sAnimation2,0));
17 DelayCommand(1.6f,ApplyEffectToObject(DURATION_TYPE_INSTANT,nova,oTarget));
18 DelayCommand(1.6f,PlayCustomAnimation(oTarget,sAnimation3,0));
19 }

Thanks all for any ideas you might have ...

PJ

#2
kamal_

kamal_
  • Members
  • 5 260 messages
PlayCustomAnimation is type int, not type action. DelayCommand wants an action for the second parameter. I believe you can also use a type void.

PlayAnimation will work here, or at least allow it to compile (whether you can play the proper animation would be another thing).

Modifié par kamal_, 04 juin 2012 - 10:58 .


#3
PJ156

PJ156
  • Members
  • 2 988 messages
Thanks for the speedy response Kamal_ I will go check that out now.

PJ

[Edit] That does not seem to be the problem. I changed PCA to PA and it still does not compile.

Modifié par PJ156, 04 juin 2012 - 11:06 .


#4
MasterChanger

MasterChanger
  • Members
  • 686 messages

PJ156 wrote...

Thanks for the speedy response Kamal_ I will go check that out now.

PJ

[Edit] That does not seem to be the problem. I changed PCA to PA and it still does not compile.


Try commenting out the line entirely for now. Very often the error is not on that line itself, but upstream and just shows on that line.

I think Skywing's compiler plugin will help you get more readable error messages.

#5
kamal_

kamal_
  • Members
  • 5 260 messages
change the PlayCustomAnimation lines (you have two of them) to DelayCommand(1.1f,ActionPlayAnimation(1,1.5,0.0)); it will compile. I cut and pasted your code, made that change, and it compiled.

Modifié par kamal_, 04 juin 2012 - 11:19 .


#6
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
or use a wrapper ( lot of various examples of emotes and animations too )

Modifié par painofdungeoneternal, 04 juin 2012 - 11:30 .


#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

painofdungeoneternal wrote...

or use a wrapper ( lot of various examples of emotes and animations too )


Indeed. It's like Beyonce says - if you wanted it, you should have put a wrapper 'round it.

Wrappers are required in order to delay non-void functions. PlayCustomAnimation() is usually the only animation function I use (it has more options), and it falls into that category.

#8
PJ156

PJ156
  • Members
  • 2 988 messages
Thanks for the tips,

After some more hair loss I got this to work:

One last niggle though. I call the fall animation to loop becuase if I don't the get up animation does not work.

The clear all actions does not work though and the fall animation carried on after the character stands up. How do I stop it?

Thanks for the help,

PJ 

//Levitates then drops PC with get up animation afterwards.
void MyPlayCustomAnimation(object oTarget, string sAnimation, int nLoop, float fSpeed)
{
 PlayCustomAnimation(oTarget, sAnimation, nLoop, fSpeed);
}

void main()
{
object oTarget = GetFirstPC();
string rise = "mjr_cast";
string fall = "death02";
string stand = "getup";
effect eFreeze =  EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
effect heal = EffectNWN2SpecialEffectFile("sp_sonic_aoe_2",oTarget);
effect nova = EffectNWN2SpecialEffectFile("fx_cleansing_nova",oTarget);
PlayCustomAnimation(oTarget,rise,0,1.0f);
DelayCommand(1.0f,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eFreeze,oTarget,0.5f));
DelayCommand(1.1f,ApplyEffectToObject(DURATION_TYPE_INSTANT,heal,oTarget));
DelayCommand(2.0f,MyPlayCustomAnimation(oTarget,fall,1,1.0f));
DelayCommand(2.5f,ApplyEffectToObject(DURATION_TYPE_INSTANT,nova,oTarget));
DelayCommand(3.0f,MyPlayCustomAnimation(oTarget,stand,0,1.0f));
DelayCommand(4.5f,AssignCommand(oTarget, ClearAllActions()));
}

#9
kevL

kevL
  • Members
  • 4 075 messages
in 'ga_play_custom_animation'

Animation special symbols:
When "%" is passed to PlayCustomAnimation, it resets the creature to its idle animation, it kind of clears the current animation for the creature.

Asterisk "*" can be used to fill in the prefix of an animation. For example: PlayCustomAnimation("*dodge01") will fill out the skeleton and gender data and choose correctly between MD009_dodge01, FH007_dodge01, etc.

Pound "#" is for facial animations. For example #bigsmile to get a character to smile. These didn't prove to look as expected and are to be avoided if possible.


i never used it but have often seen % passed in place of the fx ( or something like that ), as in

DelayCommand(2.0f, PlayCustomAnimationWrapper(oCaster, "%", 0, 1.0f));


#10
PJ156

PJ156
  • Members
  • 2 988 messages
Thanks KevL I will give that a try now,

PJ

[Edit] That Sir, did the trick Image IPB

//Levitates then drops PC with get up animation afterwards.
void MyPlayCustomAnimation(object oTarget, string sAnimation, int nLoop, float fSpeed)
{
 PlayCustomAnimation(oTarget, sAnimation, nLoop, fSpeed);
}

void main()
{
object oTarget = GetFirstPC();
string rise = "mjr_cast";
string fall = "death02";
string stand = "getup";
string reset = "%";
effect eFreeze =  EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
effect heal = EffectNWN2SpecialEffectFile("sp_sonic_aoe_2",oTarget);
effect nova = EffectNWN2SpecialEffectFile("fx_cleansing_nova",oTarget);
PlayCustomAnimation(oTarget,rise,0,1.0f);
DelayCommand(1.0f,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eFreeze,oTarget,0.5f));
DelayCommand(1.1f,ApplyEffectToObject(DURATION_TYPE_INSTANT,heal,oTarget));
DelayCommand(2.0f,MyPlayCustomAnimation(oTarget,fall,1,1.0f));
DelayCommand(2.5f,ApplyEffectToObject(DURATION_TYPE_INSTANT,nova,oTarget));
DelayCommand(3.0f,MyPlayCustomAnimation(oTarget,stand,0,1.0f));
DelayCommand(5.0f,MyPlayCustomAnimation(oTarget,reset,0,1.0f));
//DelayCommand(4.5f,AssignCommand(oTarget, ClearAllActions()));
}

Still not really sure why the top bit works but I am going now to find out.

Thanks all,

PJ

Modifié par PJ156, 05 juin 2012 - 11:11 .