Aller au contenu

Photo

Kemo animations and PlayAnimation script


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

#1
psiiijay

psiiijay
  • Members
  • 258 messages
I'm trying to get some animations to play while casting a spell (what I wanna do is change the casting anmation of a spell to the "point" anmation and the KEMO "pray"animation and some more cool anmations for some spells, like making the PC kneel when summoning and such.. 

So my first problames are- what numbers if any or words are the KEMO animations when I wanna play them with PlayAnimation script.

the seconed is, let say I wanna use the pray anmation and add it to the sleep spell,

what do i need to add for the spell so that the player is the one doing the anmation? (btw, what is the differens between PlayAnimation and Action play animation? 

is just adding this enough? 

 void PlayAnimation(int nAnimation, float fSpeed=1.0, float fSeconds=0.0);

if yes- then how does the script know who I want to play the animation? (that I want the caster to play it and not lets say, the target)

Modifié par psiiijay, 26 février 2013 - 12:04 .


#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
You'll want to check this out- PlayCustomAnimation is generally more stable in NWN2 than the old PlayAnimation.

#3
Morbane

Morbane
  • Members
  • 1 883 messages

then how does the script know who I want to play the animation?


use AssignCommand(...);

#4
psiiijay

psiiijay
  • Members
  • 258 messages
Thanks a lot guys, but how can I know what animation to use? like what is the point animation number or the prey (tow hands together) and such...?

#5
kamal_

kamal_
  • Members
  • 5 240 messages
PlayCustomAnimation uses strings, so in addition to working better, it's better from a usability standpoint
http://nwn2.wikia.co...t_of_animations

But if you really want to know, go to the globals tab in the script assist and type "animation".

#6
psiiijay

psiiijay
  • Members
  • 258 messages
well, here's what I got: I added this to the "sleep" spell, just for the test :

{
object oObject = GetLastSpellCaster();
int PlayCustomAnimation( oObject, point, 0, 1.0 );
}
it's located right above:
object oTarget;
object oLowest;
effect eSleep = EffectSleep();

but it gives me the error "parsing variable list" and I dont get why.

#7
Morbane

Morbane
  • Members
  • 1 883 messages
sorry psiiijay

that makes no sense

pls post the whole enchilada...

#8
psiiijay

psiiijay
  • Members
  • 258 messages
ok, how do I post a script?

Modifié par psiiijay, 27 février 2013 - 11:06 .


#9
psiiijay

psiiijay
  • Members
  • 258 messages
And untile I know, is this enough? everything but the 2 lines I added are the same as the original spell.

void main()
{

/*
Spellcast Hook Code
Added 2003-06-20 by Georg
If you want to make changes to all spells,
check x2_inc_spellhook.nss to find out more

*/

if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}

// End of Spell Cast Hook


//Declare major variables
{

object oObject = GetLastSpellCaster();
int PlayCustomAnimation( oObject, ANIMATION_point , 0, 1.0 );

object oTarget;
object oLowest;
effect eSleep = EffectSleep();
//effect eMind = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_NEGATIVE);
//effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
//effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
effect eDur = EffectVisualEffect( VFX_DUR_SLEEP );

Modifié par psiiijay, 27 février 2013 - 11:16 .


#10
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages

psiiijay wrote...

int PlayCustomAnimation( oObject, ANIMATION_point , 0, 1.0 );


should be
PlayCustomAnimation(oObject, "point", 0, 1.0 );

#11
psiiijay

psiiijay
  • Members
  • 258 messages
Man, I could have sworn I tried it. well no more error but it didn't work... what I'm trying to do is set the casting and conj time to 0 then **** (none) animations for em'. then put the point animation in the spell script and have the spell delayed for 2.5 sec' like the normal spells casting time.

I did it all and it wont work... how can I post the full script here?

#12
psiiijay

psiiijay
  • Members
  • 258 messages
ok, I got the prob now. I have to delay the animation a little so it doesnt clash with the 0 sec normal casting (it still fires it, just super quick) but the prob is- animation is not and action so I can't delay a custom animation with it... what do I do?

#13
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
You use a wrapper function, the NWN2 wiki page I linked to above shows exactly how to do it.

#14
psiiijay

psiiijay
  • Members
  • 258 messages
Didn't really get it i think... I just copy the Void line above the PlayCustomAnimation one? it said unknown state in compiler- and it sounds pretty true as I have no idea what I just did :)
what is this:

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

how do I use it in this case?

Modifié par psiiijay, 28 février 2013 - 12:49 .


#15
kamal_

kamal_
  • Members
  • 5 240 messages
void ReallyPlayCustomAnimation(object oNpc, string sAnimationName, int nLooping, float fSpeed = 1.0f)
{
    PlayCustomAnimation(oNpc, sAnimationName, nLooping, fSpeed);   
}


void main()
{

other stuff goes here...

ReallyPlayCustomAnimation(oNpc, "craft01",1,1.0);
}

Modifié par kamal_, 28 février 2013 - 01:48 .


#16
Tchos

Tchos
  • Members
  • 5 042 messages
You can also put the wrapper function into an include file, if you find yourself using it often (as I do), so you don't have to keep adding it to your scripts.

#17
psiiijay

psiiijay
  • Members
  • 258 messages
I'll try it now, Thanks alot guys!
btw- Do you know a way to actually change the casting/conjuring animations to emots? Is this possible?

#18
psiiijay

psiiijay
  • Members
  • 258 messages
It worked so thanks alot but what I wanted was not achieved as the original animations are played anyways and are not discarded even if I put **** on them or if I put 0 casting/conjuring time... so the only thing I can do is change the original casting animations (that I really really don't like) is there a way to do it?
and please help here cause it's driving me crazy!

#19
Dann-J

Dann-J
  • Members
  • 3 161 messages
Casting animations often consist of three separate animation files - the starting animation (*_conjure), a looping animation (*_conjureloop), and a finishing animation (*_cast). A ConjAnim value of 'defense' for instance will play def_conjure, def_conjureloop, then def_cast. The length of time the middle looping animation plays depends on the casting time of the spell (also set in spells.2da).

Attack, defense, general, party, major, and bard song are all three-part animations. Head, hand and read seem to use single animations though. You could rename the animation you wanted to use to replace one of them. All spells that use those ConjAnim settings would use your replacement animation though.

Modifié par DannJ, 28 février 2013 - 10:00 .


#20
psiiijay

psiiijay
  • Members
  • 258 messages
so they are not hard coded? what about what you wrote in the other thread about putting **** in them? 
and again, thanks A lot for the help.

Modifié par psiiijay, 01 mars 2013 - 12:47 .


#21
Dann-J

Dann-J
  • Members
  • 3 161 messages
The animations themselves aren't hardcoded, but the way that spells.2da determines the conjuring animations seems to be. You'll find the animations in the Lod-merged data files. You can generally rename one to replace another - provided they still use the same model skeleton (ie. they're both P_HHM_* for human males, or both P_HHF_* for human females, etc).

You'd need to rename the animation for each player skeleton type (HHM/F, OOM/F, DDM/F, etc). Some of the animation codes (from memory) are; HH (human, halfling, tiefling, aasimar, genasi), DD (dwarf), GG (gnome), OO (half-orc, grey orc), EE (elf).

See also this thread:
http://social.biowar...-7854404-1.html 

Modifié par DannJ, 01 mars 2013 - 02:15 .


#22
psiiijay

psiiijay
  • Members
  • 258 messages
Amazing DannJ! looks great! I'll post my results on the vault as I know a lot have been asking for some alternative for the normal spell animations (I know I did) THANKS EVERYONE for your help, I'ts really good to know that there's such great help here on the forum!

one last Q- does anyone know the normal standing animation name? (not the combat one)

#23
Tchos

Tchos
  • Members
  • 5 042 messages
Normal standing is called "idle", at least the string for PlayCustomAnimation is.

#24
psiiijay

psiiijay
  • Members
  • 258 messages
Yeah, dont get it, it makes the fighting move when I use it for a reason...

#25
Tchos

Tchos
  • Members
  • 5 042 messages
That's not normal. I've used it in my scripts to stop a looping animation and return to the normal standing.