Tehpastaboy Posted December 17, 2008 Share Posted December 17, 2008 Here's exactly what I want to do: I need a script to attach to a suit of unique power armor that, when the player enters sneak mode, will check to see if the player has at least (1) of a certain item in their inventory (in this case, a fission battery). If they do have one, it will deploy a stealthboy-style stealth field on the player with a numerical value of 15, and also start a countdown timer, let's say starting at 5 minutes. Every time the player leaves stealth mode or draws a weapon, the stealth field will deactivate and the timer will pause. The next time they are in sneak mode with no weapon drawn, the timer will pick up where it left off. Every time the timer runs out, it will delete (1) of the fusion batteries from the player's inventory and start the process over again (check for more, and if they are present, re-deploy the stealth field and restart the 5 minute timer). My current mod deploys a stealth field on the player when they are wearing the right suit of power armor and go into stealth mode, and deactivates when they draw a weapon. It can be found here: Stealth Power Armor If anyone can help me write this script, or write it for me, or point me in the right direction so I can figure out how to do it, I would much appreciate it. Link to comment Share on other sites More sharing options...
teddybearman Posted December 17, 2008 Share Posted December 17, 2008 I'm still learning some of the ins and outs of scripting myself, I actually just jumped in to ask a question myself; but I believe what you're looking for is something along the lines of the following: scn StealthArmour Begin GameMode short FusionBats short IsStealthAlreadyActiveshort Areyousneaking Set FusionBats to GetItemCount 00033BC6 ; defines the variable FusionBats as being equal to the number of Fission Batteries in your inventory Set IsStealthAlreadyActive to player.IsSpellTarget StealthField ;I think this is the correct enchantment name, checks to see if you're already affected by a stealth field effect Set Areyousneaking to player.IsSneaking ;checks to see if you're in stealth mode if Areyousneaking == 1 ;if your sneaking do the following if FusionBats >= 1 ;if the player has 1 or more Fission Batteries continue if IsStealthAlreadyActive == 1 ;determines if the stealth field is already active so you don't burn up your fission batteries every time you enter stealth RemoveItem 00033BC6 1 ;removes 1 fission battery as an effect of using it player.CastImmediateOnSelf 0007E474 ;should put the player under the effect of the Stealthboy Invisibility Spell Endif Endif EndifEnd That might not be 100% correct, I'd have to play around with it a bit with the GECK and game a bit (and I am a bit of a novice when it comes to scripting), but if anything, I hope it points you in the right direction. Link to comment Share on other sites More sharing options...
thewaronandrew Posted December 17, 2008 Share Posted December 17, 2008 This helped me also, thanks. Link to comment Share on other sites More sharing options...
Khet Posted December 17, 2008 Share Posted December 17, 2008 Here's how I'd approach your little problem. scn ArmorStealthField Short Batteries Short Stealth Short Sneak Short Time1 Short Time2 Short Incomplete Short Seconds Begin GameMode Set Batteries to GetItemCount FissionBattery Set Stealth to player.IsSpellTarget StealthBoyInvisibilitySpell Set Sneak to Player.IsSneaking If Sneak == 1 && Stealth == 0 If Batteries >= 1 Player.RemoveItem FissionBattery 1 Cast StealthBoyInvisibilitySpell Player EndIf EndIf If Sneak == 1 && Stealth == 1 If Incomplete == 1 Set Time1 to Time2 Else Set Time1 to 0 If Seconds == 0 Set Seconds to GetSecondsPassed Set Time1 to Time1 + Seconds If Time1 == 300 Player.RemoveItem FissionBattery 1 Set Time1 to 0 Set Incomplete to 0 Cast StealthBoyInvisibilitySpell Player If Player.IsSneaking == 0 && Time1 < 300 Set Time2 to Time1 Set Time1 to 0 Set Incomplete to 1 EndIf EndIf EndIf EndIf EndIf End Keep in mind, it's really rough and could probably use some tweaking, especially with the blocks relating to the Time. Nor have I even bothered to test it. If you run into problems let me know and I'll see what I can do. Link to comment Share on other sites More sharing options...
Tehpastaboy Posted December 18, 2008 Author Share Posted December 18, 2008 Thanks for the replies, guys. Khet- I tried the script, copied and pasted it exactly as it's laid out here. I remade the armor with no enchantment, and attached the script to it. Went to it in-game, had 101 fission batteries in my inventory... the stealth field doesn't deploy at all. Link to comment Share on other sites More sharing options...
Khet Posted December 18, 2008 Share Posted December 18, 2008 Alright, like I said that script could probably use some tweaking. I'm busy working on a script for a mod I'm about to release right now, but when I get the chance I'll get yours working then PM it to ya. To be honest, I didn't think it would have worked. I wrote that up without testing of any kind, and I most likely got the invisibility field wrong (the Cast StealthBoyInvisibilitySpell Player) which is probably what the problem is. If you could though, was the fission battery removed properly, and did you test the timer with starting/stopping? If you did it'd just help me out a bit so I know I wouldn't have to test that. If not, it's no big deal since I can test it myself once I get there. Like I said though, it'll be a bit. Hopefully I can get around to it by tomorrow night, the day after at the latest. If you don't hear from me then send me a PM with a reminder (in-case I forgot) and I'll get on it right away. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.