Omny Posted November 8, 2020 Share Posted November 8, 2020 So I'm working on a mod that will turn human NPCs into charred skeletons when killed via energy weapons. I've got the skeleton models all ready to go, but now I need to actually make the scripts. So what I have at the moment are a set of non-playable "outfits" that, when equipped to an NPC, makes them turn into a charred skeleton. I've tested these outfits in-game and they look fine. The only thing I need to do now is work on the script itself. That's where I've hit a snag. I have no idea what the hell I'm doing when it comes to scripting. I know what I WANT to happen- I want this script to do the following three things: Detect if an NPC is killed via an energy weapon If they are (and they're not essential), to apply the classic laser-burning effect upon death add and equip the skeleton outfit to their inventory, so it looks like they've been skeletonized The trouble is, I can't translate that into a script form, and I'm completely at a loss. I've tried looking on the GECK wiki and looking at other similar scripts, but it's all gobbledegook to me. Can anyone more fluent in script language lend me any kind of help in this regard? (Before you ask, yes I have seen the EVE mod. It almost does what I want, but personally I find it adds a bit too much needless stuff that I can't easily get rid of without breaking it entirely) Link to comment Share on other sites More sharing options...
dubiousintent Posted November 9, 2020 Share Posted November 9, 2020 As you are wanting someone to actually write the script for you, suggest you ask a moderator (see "Contact Us" at the bottom of the page) to move this to the "Mod Requests" sub-forum. Different sections get different eyeballs. -Dubious- Link to comment Share on other sites More sharing options...
Omny Posted November 10, 2020 Author Share Posted November 10, 2020 I'm not looking for someone to write the script for me; I'm just looking for insight! I've got the models working fine, and I've been working with tutorials in the meantime to actually get a hang of scripting, I just want some suggestions on how to get the script to do what I want, or even if it's possible. Link to comment Share on other sites More sharing options...
Omny Posted November 10, 2020 Author Share Posted November 10, 2020 (edited) Anyway, here's what I got thus far for my script: ScriptName OMNYLaserSkeletonizerScript;Human NPCs hit with lasers will be turned into red skeletonsref rActorbegin SetJohnnyOnDyingEventHandler if IsHitWith OMNYListOLasers PMS LaserCritGlowFXShader PMS effectLaserDisintegration Set Timer to 1.8 Set DoOnce to 0 additem OMNYLaserSkellySuit 1 equipitem OMNYLaserSkellySuit 1 endifend The "OmnyListOLasers" is a form list containing all the laser-type energy weapons. I also took a few lines from the vanilla Laser Disintegration Effect script so that it would be applied here as well. It doesn't seem to want to save though; so I'm definitely missing something. What am I doing wrong? Edited November 10, 2020 by Omny Link to comment Share on other sites More sharing options...
dubiousintent Posted November 10, 2020 Share Posted November 10, 2020 Please see 'TIP Do not overlook EventHandlers' in the wiki "Getting started creating mods using GECK" article. "SetJohnnyOnDyingEventHandler" is (presumably) the name of your "User Defined Function (UDF)" and UDFs always require parameters. (I haven't done any scripting using JohnnyNVSE, so that might be the name of a provided UDF, but you have to "call" the function correctly with all the required parameters. Re-examine "Johnny's" documentation.) The conditional test "if IsHitWith OMNYListOLasers" is not a valid statement. You are missing a boolean operator (assuming "IsHitWith" is a variable found in the "array/ar list" "OMNYListOLasers"; it is certainly not an operator) such as "==". Also note that both variables being compared in a conditional have to be the same "type" (e.g. "form", "string", "integer", etc.) Which is why 'TIP Best Practice Type prefixes for Variables' is recommended. See further 'TIP Block Types Multiple vs Single Frame processing', as an "EventHandler" and UDF are "Single Frame" blocks. I would say you are on the correct track in your approach. This is the basic manner in which I would have initially approached the problem, but I don't have any actual experience with it and was waiting to see if anyone else had better ideas and am not prepared to go beyond "suggestions" (which did not seem to be what you wanted as I initially read the post). -Dubious- Link to comment Share on other sites More sharing options...
Omny Posted November 10, 2020 Author Share Posted November 10, 2020 (edited) I'll look into those. In hte meantime I've scrapped my old script and tried something simpler: ScriptName OMNYLaserSkeletonizerScript ref rActor Begin OnHitWith == WeapLaserPistol If rActor.GetIsCreature == 0 additem OMNYLaserSkellySuit 1 equipitem OMNYLaserSkellySuit 1 endif endIt saves just fine but in game it doesn't do anything. The skelly suits work just fine if I equip them via console. But when I shoot someone with a laser pistol nothing happens. I am so f***ing confused Edited November 10, 2020 by Omny Link to comment Share on other sites More sharing options...
Omny Posted November 11, 2020 Author Share Posted November 11, 2020 Ooooooh, I'm so close I can almost TASTE it! So in addition to this script here, I also made a quest script, along with a quest to attach it to, "OMNYSkellyQuest". The Quest script is thus: ScriptName OMNYSkellyQuestScript Begin GameMode If GetGameLoaded SetJohnnyOnDyingEventHandler 1 OMNYLaserSkeletonizerScript 0 endif end(courtesy of JohnnyGuitar NVSE) Then, after looking at the Fatigue Damage script for the Boxing Gloves, I took a page from that and worked it into the main script: ScriptName OMNYLaserSkeletonizerScript ;Turns human enemies into red skeletons when hit by lasers. Begin OnHit ref rActor Set rActor to GetOwnerLastTarget If PlayerREF.IsWeaponInList OMNYListOfLasers If (rActor != PlayerRef) && (rActor.GetIsCreature == 0) If rActor.IsKiller Player additem OMNYLaserSkellySuit 1 equipitem OMNYLaserSkellySuit 1 EndIf EndIf EndIf End Both of them saved just fine in the GECK, but in-game is where things got interesting. There was no effect when I killed someone with a laser pistol, but this time, when I opened up the console, there was an error message this time! Error in Script 3800137A (the skeletonizer script)Could not look up argument variable for function script So yeah, this was another flop, but at least this time the game is actually acknowledging it! I think it just needs a bit more retooling and it might actually work! Link to comment Share on other sites More sharing options...
dubiousintent Posted November 11, 2020 Share Posted November 11, 2020 You have to define your "eventhandler" UDF function. I don't see a "Begin Function (parameter1, parameter2, etc.)" definition, which has to include parameters matching those expected by that particular type of event. The "event" is a "trigger" (e.g. "OnHit"; though I would think "OnDeath" would better serve your purpose). The "eventhandler" is an alternative to the default action normally taken by the game engine when that "event" occurs, and takes effect BEFORE that default action would normally be enacted. In your code, it appears you are trying to establish "OMNYLaserSkeletonizerScript" as the "eventhandler" by defining it in the Quest script (which is fine), but are then failing to define the required "event function" properly as a UDF in "OMNYLaserSkeletonizerScript". (The "Fatigue Damage" script is not structured as a UDF.) Please see "this tutorial". Copying from existing code is standard practice, but there is no substitute for understanding the fundamentals of how something works for tailoring the copied code to your specific needs. That tutorial is the primary guide I am aware of. -Dubious- Link to comment Share on other sites More sharing options...
Omny Posted November 11, 2020 Author Share Posted November 11, 2020 (edited) Actually, I've managed to get something close to what I want in-game with a slightly different approach: scn OMNYLaserSkeletonizerScript ref rActor ref rKiller ref rWeap begin Function {rActor} Print "The event fired" set rKiller to rActor.GetKiller set rWeap to rKiller.GetEquippedObject 5 if rKiller.IsWeaponInList OMNYListOfLasers Print "the killer's weapon is eligible" if (rActor.GetIsCreature == 0) && (rActor != PlayerRef) Print "the victim is eligible" rActor.PMS LaserCritGlowFXShader rActor.additem OMNYLaserSkellySuit 1 rActor.equipitem OMNYLaserSkellySuit 1 endif endif end The messages in quotes are just for testing purposes. At the moment when an NPC is killed via a laser weapon (as listed in "OMNYListOfLasers"), they turn into a red skeleton accompanied by a red glow effect. There's only two major hurdles I still got to get over: 1: I ultimately want it to apply the glowing laser disintegration effect, with the sparks and glowing shaders and whatnot, but it seems to result in the glowing shadow to persist afterwards, resulting in glowing translucent skeletons and any accessories they're wearing. Will probably require applying a timer like the vanilla laser crit effect. 2: When the skeleton ends up dismembered in any way, it ends up like this: That big ball of bones on the left is their head after being shot off with a tri-beam laser rifle. The same thing happens if I try to zap off any limbs from the skeleton; a big ball of bones. If I try and hit it with a blunt weapon like a sledgehammer, it explodes into bloody bits as normal. I'm assuming something is broken/missing from the NIF file that's preventing proper dismemberment. Right now I think I'd rather just find a way to disable dismemberment entirely from the skeletons rather then spend god-knows-how-long fiddling around in Nifskope, if only because that program is such a pain in the ass to use. Edited November 11, 2020 by Omny Link to comment Share on other sites More sharing options...
dubiousintent Posted November 12, 2020 Share Posted November 12, 2020 Progress indeed. Caution: I do not make "models" or other "artwork", and so have no practical experience with this matter. The "red glow" is (I believe) the result of the choice of shader "LaserCritGlowFXShader". A different effectshader or IMOD should give the effect you want (assuming such exists). "DismemberLimb" is an "OnDeath" effect. From the Note at the bottom of that page: Limb dismemberment is normally a death effect. While calling this function on a live actor will work, doing so is ill advised and may cause any number of glitchesMy guess is that you are getting a severed "ribcage" instead of a "head" as a result of replacing the general body instead of the specific dismembered limb. This might be a consequence of using the "OnHit" event for testing instead of "OnDeath". Might want to check that and 'TIP Dismembering a corpse' before spending a lot of effort to deal that issue. I would suggest you review the 'TIP Debugging data to file' regarding your debug messages. Using a variable to control the display of such "check" messages is more reliable than trying to track them all down individually after you decide they are no longer needed. -Dubious- Link to comment Share on other sites More sharing options...
Recommended Posts