Script that turns light off when you crouch, on when you sta

Post » Wed Jun 20, 2012 7:32 am

Since I dual wield, and the hotkeys really don't work with it, it is a nuisance to switch to a light spell or torch as I will need to setup my swords each time.

So I was thinking it would be great to create an item that would start a light spell when you are:
- Not in combat
- Not outdoors
- Not crouching

... and turn it off when you crouch.

I've scripted for Oblivion and Fallout 3. However I still have a number of questions.

Assuming there is a script attached to some item, when does it run? Should it a be "OnGameMode" or whatever?

How do you detect the player crouches and stands?

Any advice on a custom light spell or effect?

Thanks.
User avatar
Max Van Morrison
 
Posts: 3503
Joined: Sat Jul 07, 2007 4:48 pm

Post » Tue Jun 19, 2012 8:27 pm

  • Not in combat: !http://www.creationkit.com/IsInCombat_-_Actor
  • Not outdoors: !http://www.creationkit.com/IsInInterior_-_ObjectReference
  • Not crouching: !Game.GetPlayer().http://www.creationkit.com/IsSneaking_-_Actor
  • Assuming there is a script attached to some item, when does it run? Should it a be "OnGameMode" or whatever?: http://www.creationkit.com/OnUpdate_-_Form
User avatar
Queen
 
Posts: 3480
Joined: Fri Dec 29, 2006 1:00 pm

Post » Wed Jun 20, 2012 11:41 am

well if you register for updates...try registering for updates with the OnEquip event, and de-registering at the OnUnequip event, and check your conditions in the OnUpdate (Set it at 1 second, so the light would turn off within 1 second of it's conditions being changed.)
User avatar
sally coker
 
Posts: 3349
Joined: Wed Jul 26, 2006 7:51 pm

Post » Tue Jun 19, 2012 8:08 pm

A hint: Try making this as a perk you attach to the player.
User avatar
Pants
 
Posts: 3440
Joined: Tue Jun 27, 2006 4:34 am

Post » Tue Jun 19, 2012 11:27 pm

A hint: Try making this as a perk you attach to the player.

And that would affect lights carried by NPC followers how?
User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm

Post » Wed Jun 20, 2012 7:09 am

And that would affect lights carried by NPC followers how?
Actually I did not specify that it should work on NPC followers, but it might be nice to give such an item to a follower too. I think I'll try the item first.

Thanks to all replies!
User avatar
Lizs
 
Posts: 3497
Joined: Mon Jul 17, 2006 11:45 pm


Return to V - Skyrim

cron