wolfodude Posted January 31, 2009 Share Posted January 31, 2009 So, I'm working on a pistol for a personal mod. I may release it later once it's gained enough bulk and I've refined it. The pistol in question is a silenced dart gun. It does minimal actual damage, but disables robots with an EMP (which I may remove, cause darts really wouldn't work on robots too well) and will, if i can get the script worked out, render NPC's unconscious. The problem I'm having is how to properly work the script. A simple SetUnconscious function is all fine and dandy, but it seems a little odd that an NPC wouldn't fall to the ground to sleep. I'm trying to get the target to ragdoll like an essential NPC. My thought, after simply trying the SetUnconscious function, was to make the target essential, run a kill function, then relinquish it's essentiality once the duration runs through. This brings up a new problem, the SetEssential function won't run on any NPC when the projectile hits the target, it requires a specific FormID. My thought was to use a ref variable, and set it to look up the target's FormID, then use SetEssential [ref variable, in this case named Target] 1. Of course, In the history of all my Bethesda game modding, I've never delved into scripting, especially this deeply. I have no idea how to get the ref variable to return the actor's FormID. So I've hit quite a thick wall. :wallbash: So how in any god's name would I write a script to cause an NPC to simply (I use that term lightly) fall unconscious and ragdoll for a set amount of time? I figure to set the duration I can just give the effect itself one and the script will run the end function when the time runs out. Any help, comments, tips, tricks, etc. on the subject would be greatly appreciated. Link to comment Share on other sites More sharing options...
Guest Posted January 31, 2009 Share Posted January 31, 2009 I am currently working on something similar. I found the easiest way to make the npc/creature/whatever go properly unconscious is using the command "SetAV Fatigue -25". This will make the Actor inactive and ragdoll. There is however a couple of bugs to this. You will probably need an ScriptEffectUpdate block to keep the value low. Furthermore the wall I have hit now is that I have a weapon that will render an actor unconscious for a set amount of time, but it will only work once :wacko: So basically everything works the first time, but after that the actor seems resistant. Happy to help you over one wall, welcome to the next. Link to comment Share on other sites More sharing options...
wolfodude Posted January 31, 2009 Author Share Posted January 31, 2009 Wow, I'm surprised I forgot that method. Used it a lot in some Oblivion spells. Thanks for refreshing me. Now, I don't really understand the effects of fatigue in Fallout. Before it was actually implemented into the gameplay, effecting the PC of course, but also used in hand to hand combat. Now it seems it's just leftover code from the older engine. Either way, I'll do some research on some things before I run some actual tests. Thanks, again. -edit- I think the problem is that SetAV modifies the NPCs base fatigue, so it permanently sets it to -25. I'll try using "ModAV Fatigue -250", which should be enough to drop any normal enemy. In theory, it'll eventually replenish, so there may be no need for any ScriptEffectUpdate or ScriptEffectFinish blocks. Link to comment Share on other sites More sharing options...
Guest Posted February 1, 2009 Share Posted February 1, 2009 I made it work and even made a few improvements:Now after the actor is hit it takes a number of seconds before it falls unconscious.While unconscious it will not be regarded as an enemy.The actor will stay tranquilized for a predefined amount of gametime, not realtime.The actor will stay tranquilized even if the PC decides to sleep or wait. This is just one script to be placed in the weapon so im guessing it can be used for a lot of different weapons. Script for weapon as follows: scn TranquilizeScript Short isTranquilized ;Has the actor been tranquilized Short isTranquilizable ;Can the actor be tranquilized Float TimeTranquilized ;The gametime at which the actor was tranquilized Float timer ;The amount of time before the actor is tranquilized ;First check whether the character hit is in one of the categories that can be tranquilized ;(if you want it to be everyone just remove everything but the initialization of the timer and isTranquilized) begin ScriptEffectStart if GetInFaction MoleRatFaction == 1 || GetInFaction BloatFlyFaction == 1 || GetInFaction DogFaction == 1 set isTranquilizable to 1 set isTranquilized to 0 set timer to 4 ;I have choosen 4 seconds before tranquilizing endif end begin ScriptEffectUpdate ;If it is not possible to tranquilize this actor stop script. if isTranquilizable != 1 return endif ;if not tranquilized countdown to tranquilization if isTranquilized == 0 set timer to timer - ScriptEffectElapsedSeconds if timer <0 damageav Fatigue -75 ;damage the Fatigue, where the actor falls unconscious ;The following two calls are for avoiding the actor being regarded as an enemy while tranquilized. ;This way the player can wait and followers will not attack the actor when tranquilized. AddToFaction PlayerFaction 1 stopcombat set TimeTranquilized to GameHour ;Remembers the time of the tranquilization set isTranquilized to 1 endif endif ;The following block makes sure the actor stays tranquilized for the duration of the script ;if this is not done the script will still be running but the actor will awake after the PC waits or sleeps. if isTranquilized == 1 if getav Fatigue >0 damageav Fatigue -75 endif ;This if-statement is for making sure the duration of the tranquilization does not last longer than 3 hours game time ;If you prefer realtime duration just delete it. if (GameHour - TimeTranquilized) > 3 forceav Fatigue 75 RemoveFromFaction PlayerFaction return endif endif end begin ScriptEffectFinish forceav Fatigue 75 RemoveFromFaction PlayerFaction end There is still one beauty flaw with this code. After the PC waits og sleeps the actor will get up and then fall unconscious again. The only way I found to stop this was by using "Skipanim" but I couldn't seem to get them started again so they were just permanently paralyzed. If anyone knows how to start up the animation again after using "Skipanim" I would appreciate it a great deal :biggrin: Link to comment Share on other sites More sharing options...
wolfodude Posted February 2, 2009 Author Share Posted February 2, 2009 Wicked. I've been swamped lately, haven't been able to play any Fallout, but I'll give it a try later today. I'll give you credit if I release this mess, but it's mostly weird stuff and god items. Either way, thanks again. Maybe another interested party will see this bump and happen to know how to work out the animations. Eh? Eh? Link to comment Share on other sites More sharing options...
SpeedyB64 Posted February 2, 2009 Share Posted February 2, 2009 Check the TES CS wiki for the animation A similar thing happens if you use PlayGroup on a NPC. They mention how to set them back to normal. "NPC's may behave oddly after PlayGroup is called - for instance, running backwards, walking through solid objects, being unable to attack, etc. Calling playGroup Idle 1 generally fixes the problem." -From the TES CS Wiki That might work it sets the animations back to normal so it might work in a similar manner here. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.