Easy way to force player to sheath weapon?

Post » Mon May 27, 2013 11:59 am

I see that the actor script has a way to force an actor to draw their weapon, but is there a way to make them lower it?

User avatar
Quick Draw
 
Posts: 3423
Joined: Sun Sep 30, 2007 4:56 am

Post » Mon May 27, 2013 8:06 am

Use http://www.creationkit.com/DisablePlayerControls_-_Game to disable their combat controls (the 2nd flag) then when you want them to be able to fight again, http://www.creationkit.com/EnablePlayerControls_-_Game.

User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am

Post » Mon May 27, 2013 2:43 am

Thanks. If a do this--disable and then enable right away, will it lower their weapon even when enabled again?

The issue is that some idles flake out is you try to play them when the player has a weapon drawn.

User avatar
Emilie Joseph
 
Posts: 3387
Joined: Thu Mar 15, 2007 6:28 am

Post » Mon May 27, 2013 2:38 am

Yes, disabling then instantly enabling will make them lower it. Just keep in mind there's nothing stopping them from then pulling their weapon/hands back out.

User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Mon May 27, 2013 2:50 pm

Okay, this was really helpful. I have one more question you might have insight into:

In order to get it to work, I had to use utility.wait(). If you try to play an idle on the line right after enableplayercontrols, it doesn't work. So here is my question: I had to use utility.wait(10.0) to get it to work, which seems like it should be a long time, but it was really only about 1 second. How much variation is there to how long this will be on various users' computers?

User avatar
Loane
 
Posts: 3411
Joined: Wed Apr 04, 2007 6:35 am

Post » Mon May 27, 2013 7:23 am

Uh, Utility.Wait()'s input is in seconds, so a value of 10.0 should make it wait 10 seconds, not 1. And the wait time should be almost identical on all computers. How much other stuff is going on and the computer's processing abilities will alter the time slightly, but it shouldn't ever be noticeable.

Are you sure you did 10.0? That should wait for 10 seconds, not 1.

User avatar
CHANONE
 
Posts: 3377
Joined: Fri Mar 30, 2007 10:04 am

Post » Mon May 27, 2013 12:53 pm

Okay, it turns out that if you offload to a second script, you don't have to wait at all. I had been using a single test script, but if found that when I set up to interact with my main quest script, it worked really well.

1) tiny script added to magic effect:

If Game.GetPlayer().IsWeaponDrawn() == 1
Game.DisablePlayerControls()
Game.EnablePlayerControls()
EndIf
Int i = _LP_BardMenuPlayLute.Show()
If i == 0
_LP_BardQuest.Play(MUSBardLute01, 37, 3, 0)

etc, etc.

2) the main quest script, which calls the idle

No need to wait, and the idle now fires properly every time. Used to have lots of trouble if a player tried to fire it while they had their weapon drawn.

Thanks AV!

User avatar
Cool Man Sam
 
Posts: 3392
Joined: Thu May 10, 2007 1:19 pm


Return to V - Skyrim