How to make Player stop playing an Animation?

Post » Thu Dec 08, 2011 3:05 am

I've made it so the Player will play a specific idle animation by adding a custom Animation ID in the Idle Animations tab with the condition that it plays if the Player's Item Count of a dummy misc object is in his inventory.

Basically

Begin ScriptEffectStart   Player.AddItemNS AnimationToken 1   Player.PickIdle 1   Player.RemoveNS AnimationToken 10End


That part works. But I can't get the Player to return to normal. In the Finish block after 5 seconds ...

Begin ScriptEffectFinish   Player.PickIdle   Player.PlayGroup Idle 0   Player.PlayGroup CastSelf 1End


I've tried all of the above one-at-a-time and neither of them return the Player to normal operation. In this case, I attempted the vanilla pray animation and the vanilla kneel-with-sword animation. But the Player is just stuck in these animations. If I move the Player around, he slides on his knees, still stuck in prayer/kneel position. Any ideas?
User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am

Post » Wed Dec 07, 2011 6:43 pm

First off, you should always use

player.playgroup idle 1

because idle 0 will never interrupt a running animation.

Then I think it's always a problem if you add and remove the same item (dummy) during one cycle of a script. I suggest you dely the removeitem to the point before the 2nd pickidle.
User avatar
Far'ed K.G.h.m
 
Posts: 3464
Joined: Sat Jul 14, 2007 11:03 pm

Post » Wed Dec 07, 2011 9:58 pm

First off, you should always use

player.playgroup idle 1

because idle 0 will never interrupt a running animation.

Then I think it's always a problem if you add and remove the same item (dummy) during one cycle of a script. I suggest you dely the removeitem to the point before the 2nd pickidle.


Crap. Problem still persists. I've found that Player.PlayGroup Idle 1 works in the console to return the Player to normal, but it doesn't in the spell Finish block. I moved the RemoveToken command as you said, and then further tried to move it to an Update block to try that too. Still, the Player is locked in the prayer position.

ScriptName aaPaladinPrayScriptShort DoneFloat TimerBegin ScriptEffectStart	Player.AddItemNS aaPaladinPrayToken 1	Player.PickIdle 1	Set Timer to 0	Set Done to 0EndBegin ScriptEffectUpdate	Set Timer to Timer + ScriptEffectElapsedSeconds	If ( Timer > 2 ) && ( Done == 0 )		Player.RemoveItemNS aaPaladinPrayToken 10		Set Done to 1	EndifEndBegin ScriptEffectFinish	;Player.RemoveItemNS aaPaladinPrayToken 10	Player.Playgroup Idle 1	;Player.PickIdle 1	;Player.PlayGroup CastSelf 1End


I also tried
RunScriptLine "Player.Playgroup Idle 1"
but it didn't work either. Any more ideas? :(
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Thu Dec 08, 2011 5:22 am

You shouldn't try to mix pickidles and playgroup. They are different worlds. I also found playgroup to be very unreliable from within a script, although there are mods (Companion on your side) which are totally based on playgroup.

But pickidle always works. And I can't believe that it shouldn't work from within a spell finish. I rather believe that your idle conditions are wrong

I would suggest you comment all playgroup commands, and the effect update part. Only removeitem and pickidle in the effectfinish. Then see what happens.

If your player is still in the idle, then you can do a pickidle from the console. Pickidle does some debug output, so you can see which idles have been passed over by pickidle.
User avatar
Robert
 
Posts: 3394
Joined: Sun Sep 02, 2007 5:58 am

Post » Thu Dec 08, 2011 1:51 am

You shouldn't try to mix pickidles and playgroup. They are different worlds. I also found playgroup to be very unreliable from within a script, although there are mods (Companion on your side) which are totally based on playgroup.

But pickidle always works. And I can't believe that it shouldn't work from within a spell finish. I rather believe that your idle conditions are wrong

I would suggest you comment all playgroup commands, and the effect update part. Only removeitem and pickidle in the effectfinish. Then see what happens.

If your player is still in the idle, then you can do a pickidle from the console. Pickidle does some debug output, so you can see which idles have been passed over by pickidle.


It works! Thanks!

ScriptName aaPaladinPrayScriptBegin ScriptEffectStart	Player.AddItemNS aaPaladinPrayToken 1	PickIdleEndBegin ScriptEffectFinish	Player.RemoveItemNS aaPaladinPrayToken 10	PickIdleEnd


That's all it needs. Maybe the scripts don't like PickIdle with a "1" after it? Because I definitely tried "Player.PickIdle 1."

Now the problem is the 1st person view gets all jacked up if done while in 1st person view, but from what I understand, that's an issue that's unable to be solved. So I might need a check to make sure the active view is 3rd person before executing this script.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Thu Dec 08, 2011 1:52 am

Dang! It doesn't always work. Maybe about 80% of the time. Rest of the time the Player gets stuck like before. Ahh the joys of modding - 10% creativity, 90% jacking with the CS to get it to do what you want it to.

I did look at what the console printed when manually entering PickIdle or PlayGroup Idle 1, but not sure I understand it. It looked like a bunch of condition checks like IsWeaponOut, etc., all with " >> 0.00" after it.

... and I just noticed that even when it works, some Player controls like cast and draw-weapon are disabled for a few seconds. Tested this several times - most definitely not in my imagination or a fluke occurrence.
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Wed Dec 07, 2011 6:42 pm

I just use the PlayIdle function. Seems a lot easier imo.
User avatar
Ebou Suso
 
Posts: 3604
Joined: Thu May 03, 2007 5:28 am

Post » Thu Dec 08, 2011 1:11 am

I just use the PlayIdle function. Seems a lot easier imo.


Hehe. That's the whole point of this thread - I can't get PlayGroup Idle or PickIdle to work reliably.
User avatar
Genocidal Cry
 
Posts: 3357
Joined: Fri Jun 22, 2007 10:02 pm

Post » Thu Dec 08, 2011 5:36 am

Dang! It doesn't always work. Maybe about 80% of the time. Rest of the time the Player gets stuck like before. Ahh the joys of modding - 10% creativity, 90% jacking with the CS to get it to do what you want it to.

I did look at what the console printed when manually entering PickIdle or PlayGroup Idle 1, but not sure I understand it. It looked like a bunch of condition checks like IsWeaponOut, etc., all with " >> 0.00" after it.

... and I just noticed that even when it works, some Player controls like cast and draw-weapon are disabled for a few seconds. Tested this several times - most definitely not in my imagination or a fluke occurrence.


That sure is strange.

The reason why I recommended to check this console output was, that you actually can see what is happening. But you have to compare with the idle animation definition in the CS. The engine compares all conditions sequentially from the top of the idle animation definition, and what you see there is simply the results of all the conditions. And this comes especially handy when there are more complicated, nested idle conditions. Because then it's realy easy to overlook some conditions. If you have problems comparing in-game console data with CS definitions, try using the OBSE plugin ConScribe, which saves console output into a file.

Maybe your condition is nested within another idle condition, and this one doesn't fire? A very frequent cause.

But if you then see that the check goes past your itemcount condition with 0, then you might be right, and domething is unreliable in spell script. And then you might want to re-use your effectupdate script. But I wouldn't try and error, until I have anolyzed the console output.

EDIT: if you see the player animation being stalled for a while maybe it's because pickidle actually finds another idle to be picked based on the current conditions. Remember, idle animations forced on the player are not so common, most of them are defined with NPCs in mind.
User avatar
Franko AlVarado
 
Posts: 3473
Joined: Sun Nov 18, 2007 7:49 pm

Post » Thu Dec 08, 2011 12:30 am

Hello,

You could use or create a quest script to make a variable to use as a condition rather than getItemCount. You also won't need a token. Something like:

Animation condition:
GetQuestVariable MyQuestName MyAnimPlaying == 1


ScriptEffect Script:
Begin ScriptEffectStart   set MyQuestName.MyAnimPlaying to 1   Player.PickIdleEndBegin ScriptEffectFinish   set MyQuestName.MyAnimPlaying to 0End


Best regards,
RX31
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Wed Dec 07, 2011 6:49 pm

I once noticed that some animation mods use a "Reset" animation together with PlayGroup. Not sure why, but, it did help me at the time (long time ago, so I don't remember the details).
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am

Post » Thu Dec 08, 2011 7:11 am

I might be missing something, but doesn't this work:

ToggleFirstPerson 0set myidle to standaround01player.PlayIdle myidle 1

User avatar
{Richies Mommy}
 
Posts: 3398
Joined: Wed Jun 21, 2006 2:40 pm

Post » Thu Dec 08, 2011 8:08 am

Thanks for the help everyone. I've tried some things ...

That sure is strange.

The reason why I recommended to check this console output was, that you actually can see what is happening. But you have to compare with the idle animation definition in the CS. The engine compares all conditions sequentially from the top of the idle animation definition, and what you see there is simply the results of all the conditions. And this comes especially handy when there are more complicated, nested idle conditions. Because then it's realy easy to overlook some conditions. If you have problems comparing in-game console data with CS definitions, try using the OBSE plugin ConScribe, which saves console output into a file.

Maybe your condition is nested within another idle condition, and this one doesn't fire? A very frequent cause.

But if you then see that the check goes past your itemcount condition with 0, then you might be right, and domething is unreliable in spell script. And then you might want to re-use your effectupdate script. But I wouldn't try and error, until I have anolyzed the console output.

EDIT: if you see the player animation being stalled for a while maybe it's because pickidle actually finds another idle to be picked based on the current conditions. Remember, idle animations forced on the player are not so common, most of them are defined with NPCs in mind.


I got Con Scribe and used it. After the spell failed, I typed in the console "pickidle" on the Player. It also failed, and below is what was printed to a log. It starts with a GetItemCount condition that could be my animation token. But those top two are the only Item Count checks and both are zero. And I verified in game that the item was in fact removed. Another weird thing is that while consoling "pickidle" won't bring the Player back to nornal, "PlayGroup Idle 1" ALWAYS works, but only in the console, not in the script :brokencomputer:

I can also tell you that my custom Idle Animation is the first "child" under Characters\_Male\IdleAnims in the Idle Animation tree, not nested under anything else.

Spoiler

pickidle
GetItemCount >> 0.00
GetItemCount >> 0.00
MenuMode 1036 >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
MenuMode 1009 >> 0.00
GetIsCurrentPackage >> 0.00
GetIsUsedItem >> 0.00
MenuMode 1036 >> 0.00
GetIsID >> 1.00
GetGlobalValue >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
Is Waiting >> 0.00
Is Facing Up >> 0.00
Is Facing Up >> 0.00
Get Knocked State >> 0.00
GetSleeping >> 0.00
GetSitting >> 0.00
GetRandomPercent >> 54.00
GetStage >> 0.00
GetStage >> 0.00
is not in combat
GetIsID >> 0.00
GetIsID >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
MenuMode 0 >> 1.00
GetStage >> 0.00
GetStage >> 0.00
MenuMode 0 >> 1.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
MenuMode 0 >> 1.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetSitting >> 0.00
Current Process >> 0.00
is not in combat
GetIsCurrentPackage >> 0.00
GetSitting >> 0.00
GetInCell >> 0.00
is not in combat
GetIsID >> 0.00
GetStage >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsUsedItem >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
Is Weapon Out >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
GetQuestRunning >> 0.00
GetIsID >> 0.00
GetInFaction >> 0.00
GetIsID >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetIsID >> 0.00
GetIsAlerted: 0.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
GetRandomPercent >> 29.00
GetIsID >> 1.00
GetRandomPercent >> 99.00
GetIsID >> 1.00
GetIsCurrentPackage >> 0.00
GetIsID >> 0.00
GetIsAlerted: 0.00
GetIsUsedItemActivate >> 0.00
GetStage >> 0.00
GetIsID >> 0.00
GetIsID >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
GetStage >> 0.00
MenuMode 0 >> 1.00
GetIsUsedItem >> 0.00
Procedure >> 0.00
Procedure >> 0.00
GetIsCurrentPackage >> 0.00
Procedure >> 0.00
Procedure >> 0.00
GetIsCurrentPackage >> 0.00
Procedure >> 0.00
Procedure >> 0.00
GetIsCurrentPackage >> 0.00
MenuMode 0 >> 1.00
MenuMode 0 >> 1.00
Procedure >> 0.00
GetIsUsedItem >> 0.00
GetRandomPercent >> 95.00
GetIsUsedItemType >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
Procedure >> 0.00
GetInFaction >> 0.00
GetIsUsedItemType >> 0.00
GetIsUsedItem >> 0.00
GetSleeping >> 0.00
GetSitting >> 0.00
Is Shield Out >> 1.00
Is Shield Out >> 1.00
Is Shield Out >> 1.00
GetIsUsedItemActivate >> 0.00
Is Shield Out >> 1.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItem >> 0.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItem >> 0.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItemLevel >> -1.00
GetIsUsedItemType >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItemType >> 0.00
Is Shield Out >> 1.00
Is Shield Out >> 1.00
Is Shield Out >> 1.00
GetSitting >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetIsUsedItem >> 0.00
GetSitting >> 0.00
GetSleeping >> 0.00
Is Weapon Out >> 0.00
Current Process >> 0.00
Is Weapon Out >> 0.00
Current Process >> 0.00
Procedure >> 0.00
Talking >> 0.00
Procedure >> 0.00
MenuMode 0 >> 1.00
GetIsID >> 1.00
Is Weapon Out >> 0.00
scribe pray


... after all that, the Player remains locked in the idle animation.

Hello,

You could use or create a quest script to make a variable to use as a condition rather than getItemCount. You also won't need a token.


Thanks, but I'd be happy at this point just to have a working animation script before I worry about using a quest variable condition or a get item count condition.

I once noticed that some animation mods use a "Reset" animation together with PlayGroup. Not sure why, but, it did help me at the time (long time ago, so I don't remember the details).


It almost sounds as if someone had the same problem I did and found a work-around. I looked at Actors in Charge and tried to understand its long scripts. I don't think I saw anything like that. It has a section to "reset" anims, but it just calls "pickidle" to do it.

I might be missing something, but doesn't this work:


Thanks, MatH, but playing the animation is not the problem. It's stopping it that I can't figure out. I tried PlayIdle anyway though. Not sure how to use it. I typed in the name of my idle animation after "PlayIdle" but it fails to compile, calling it an invalid "inventory object." ???
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm

Post » Thu Dec 08, 2011 5:10 am

The PlayIdle example I gave does stop the animation though. Playing the standaround01 idle stops the currently running one. It's an OBSE 20 function btw.
User avatar
Steve Smith
 
Posts: 3540
Joined: Sat Jun 30, 2007 10:47 am

Post » Thu Dec 08, 2011 6:15 am

It almost sounds as if someone had the same problem I did and found a work-around. I looked at Actors in Charge and tried to understand its long scripts. I don't think I saw anything like that. It has a section to "reset" anims, but it just calls "pickidle" to do it.


Check the http://www.tesnexus.com/downloads/file.php?id=11892#


It has a xsSmokePipe anim to make the actor smoke the pipe and a xsKillAnim used to make it stop smoking (together with a lot of player.pickidle's, playgroup idle's and delays in the script XSSmokePipeScript).

As I said, I have no idea why the author does it.
As you said, maybe he ran into the same problem as you.

I am sure the same approach was used by some other mod I checked at the time. The anim I ended up using was called Reset.kf (which hinted on its purpose) but I don't remember from which mod I took it (and before anyone asks, it was not for an actual mod, just a personal experiment).
User avatar
Lauren Graves
 
Posts: 3343
Joined: Fri Aug 04, 2006 6:03 pm

Post » Thu Dec 08, 2011 8:46 am

Check the Smokeable Pipe Mod by Ssenkrad

It has a xsSmokePipe anim to make the actor smoke the pipe and a xsKillAnim used to make it stop smoking (together with a lot of player.pickidle's, playgroup idle's and delays in the script XSSmokePipeScript).

As I said, I have no idea why the author does it.
As you said, maybe he ran into the same problem as you.

I am sure the same approach was used by some other mod I checked at the time. The anim I ended up using was called Reset.kf (which hinted on its purpose) but I don't remember from which mod I took it (and before anyone asks, it was not for an actual mod, just a personal experiment).


Aha! So I'm not the only one. I think Ssenkrad is spamming pickidle and playgroup idle because sometimes it works, sometimes it doesn't. I tried the same thing, tested it several times, and the problem might sort-of be solved, even if in a clunky way. I'm thinking maybe the xsKillAnim is the animation of putting away the pipe? Anyway, this is my revised script ...

Begin ScriptEffectStart	Set Timer to 0	Set DoThis1 to 0	Set DoThis2 to 0	Set DoThis3 to 0	Player.AddItem aaPaladinPrayAnimToken 1	PickIdle 1EndBegin ScriptEffectUpdate	Set Timer to Timer + ScriptEffectElapsedSeconds	If ( Timer > 4 ) && ( DoThis1 == 0 )		Player.RemoveItem aaPaladinPrayAnimToken 10		Set DoThis1 to 1	Endif	If ( Timer > 5 ) && ( DoThis2 == 0 )		PickIdle		PlayGroup Idle, 1		Set DoThis2 to 1	Endif	If ( Timer > 6 ) && ( DoThis3 == 0 )		PickIdle		PlayGroup Idle, 1		Set DoThis3 to 1	EndifEndBegin ScriptEffectFinish	PickIdle	PlayGroup Idle, 1End


This worked several times in a row. I'm sure some rare times it won't. Thanks for suggesting that mod!

The PlayIdle example I gave does stop the animation though. Playing the standaround01 idle stops the currently running one. It's an OBSE 20 function btw.


Thanks. Hmmm weird. That won't compile for me. I've got v20, but no matter how I enter the command, it gives me that nonsensical error message that "Invalid inventory object StandAround01 for parameter idle form." This is when I use ...

PlayIdle standaround01 1


Also the same without the "1" and if I type "Player.PlayIdle ..."

It seems like it could be a good solution. Because I think that's the idle that it chooses anyway. And again, some controls are disabled for a few seconds after successfully ending the pray animation. I watched that stand around anim and noticed that as soon as it finished its loop, I could use the cast and draw-weapon controls again. So if I could use PlayIdle with a really fast anim, I could solve that particular issue.
User avatar
kennedy
 
Posts: 3299
Joined: Mon Oct 16, 2006 1:53 am

Post » Thu Dec 08, 2011 2:18 am

Aha, yes, you'll have to use the reference I mentioned rather than StandAround01 directly. Like:

ToggleFirstPerson 0set myidle to standaround01player.PlayIdle myidle 1

User avatar
tegan fiamengo
 
Posts: 3455
Joined: Mon Jan 29, 2007 9:53 am

Post » Wed Dec 07, 2011 9:21 pm

Aha, yes, you'll have to use the reference I mentioned rather than StandAround01 directly. Like:

ToggleFirstPerson 0set myidle to standaround01player.PlayIdle myidle 1



Ohhhh! I tried it and it works ... EVERY time! ... so far at least, hehe. I tried it about twenty times in a row. You, sir, are a rockstar. :rock: Thanks!
User avatar
Juanita Hernandez
 
Posts: 3269
Joined: Sat Jan 06, 2007 10:36 am


Return to IV - Oblivion