Force Player to Sheath WeaponSpell?

Post » Thu Jun 21, 2012 3:48 pm

Is there a way to force the player to sheath a weapn/spell? I see the http://www.creationkit.com/IsWeaponDrawn_-_Actor flag, but I can't find a way to force them to do it from script.

Edit: I am forcing the player to unequip the weapons and/or spells with http://www.creationkit.com/UnequipSpell_-_Actor
and http://www.creationkit.com/UnequipItem_-_Actor, but that's not the same thing. It seems the player is still in the "ready" state, at least to the animation.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Thu Jun 21, 2012 8:31 am

Yes, you have to DisablePlayerControls specifically for combat I believe. If the player has a weapon drawn when that function is fired, they sheathe a weapon.
User avatar
Sarah Bishop
 
Posts: 3387
Joined: Wed Oct 04, 2006 9:59 pm

Post » Thu Jun 21, 2012 10:44 pm

Yes, you have to DisablePlayerControls specifically for combat I believe. If the player has a weapon drawn when that function is fired, they sheathe a weapon.

Thanks for the reply!

It makes sense that disable fighting paramter of http://www.creationkit.com/DisablePlayerControls_-_Game would work, but it apparnetly it doesn't, as I already have that in my code.

But I came up with a different way, knowing how Idles actually make the player do the action, I looked for a Sheathe idle and found one. So I got what I needed with this:

myPassenger.PlayIdle(DefaultSheathe)
User avatar
Monique Cameron
 
Posts: 3430
Joined: Fri Jun 23, 2006 6:30 am

Post » Thu Jun 21, 2012 1:25 pm

Thanks for posting your final solution for everyone. I was having the same issue.
User avatar
matt white
 
Posts: 3444
Joined: Fri Jul 27, 2007 2:43 pm

Post » Thu Jun 21, 2012 9:07 pm

Thanks for posting your final solution for everyone. I was having the same issue.

Well, it turns out my solution was only half-working. It works great for sheathing spells, but doesn't work for weapons (or at least the animations are still getting messed up. Anyone know if there is more to this? Are you seeing the same thing chibi_alien?
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm

Post » Thu Jun 21, 2012 4:25 pm

The very first advice given by Supernastypants is the better one. Just try this:
game.DisablePlayerControls(false,true,false,false,false,false,false,false)game.EnablePlayerControls(false,true,false,false,false,false,false,false)
If it didn't work always place this line between the other two:
utility.wait(0.1)
though I doubt it will be needed.
User avatar
SHAWNNA-KAY
 
Posts: 3444
Joined: Mon Dec 18, 2006 1:22 pm

Post » Thu Jun 21, 2012 10:36 pm

The wait probably won't be necessary unless it's happening from a menu.
Game.DisablePlayerControls(abFighting = True)Game.EnablePlayerControls(abFighting = True)
^will behave identically, but with less typing.

Or you could
PlayerREF.EquipItem(UnplayableInvisibleTwoHandedWeapon, True)
for as long as you want them unarmed and remove the item when desired.

Then again DisablePlayerControls for the duration would be simpler...
User avatar
Oceavision
 
Posts: 3414
Joined: Thu May 03, 2007 10:52 am

Post » Thu Jun 21, 2012 10:12 pm

The very first advice given by Supernastypants is the better one. Just try this:
game.DisablePlayerControls(false,true,false,false,false,false,false,false)game.EnablePlayerControls(false,true,false,false,false,false,false,false)
If it didn't work always place this line between the other two:
utility.wait(0.1)
though I doubt it will be needed.

Thanks everyone for the resopnes. You guys might have missed it, but I replied to Supernastypants that I already had the DisablePlayerControls in my code and it wasn't un-sheathing the weapon. Here's what I have:

Game.DisablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = True, abLooking = false, abSneaking = true, abMenu = False, abActivate = false, abJournalTabs = false)

But, just in case, I commented out my line of code and tried Amgepo and JustinOther two lines of code. Still does not work. After calling DisablePlayerControls, I verified the weapon did not get sheathed by a call to IsWeaponDrawn(). It still indicates the weapon is drawn.

If I have a spell ready, playing the idle does sheathe it properly.

Still hoping for a solution, thanks!
User avatar
Darian Ennels
 
Posts: 3406
Joined: Mon Aug 20, 2007 2:00 pm

Post » Thu Jun 21, 2012 2:48 pm

For the record, my original attempt with the idle does work for weapons too, the problem was that I was using a large 2 Handed Weapon and it was slow to sheathe. I just needed to give it more time:

passenger.PlayIdle(DefaultSheathe)Utility.Wait(2.0)
User avatar
Yvonne Gruening
 
Posts: 3503
Joined: Mon Apr 23, 2007 7:31 pm


Return to V - Skyrim