So I am trying to add some glowing eyes to my character in NWN Enhanced Edition. As far as I understood the only option to add that permanently is to create an NPC in the toolset and after to convert the NPC to a PC.
I am trying to add the red glowing eyes from Aligned Head Effects HAK.
Can someone please lend me a hand with that? I am completely new with scripting and etc. Would be great to see a script or something with at least some explanation where should I insert it.
Thanks in advance!
No, you can add the effect directly to the PC using a script. The key statement will be something like
AssignCommand(GetModule(), ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(nVFX)), oPC));
where nVFX is the Visual Effect number and oPC is the PC in question.
Where that script goes depends on exactly when the eyes are required - from the outset? When the PC takes some action? Knowing that would help.
EDIT - making that truly permanent might require a bit more if you’re making a PW, or have conflicting scripts, but it’s do-able.
Thank you for your time and for your help!
So basically I’d like my character’s eyes to glow “by default”. The point is that my character’s subrace is abyssal and I would like to reflect that by making her eyes glowing red or “burning red”. That being said I wouldn’t like to connect that effect to any particular action. I’m not sure if it’s possible though…
Appreciate a lot and thanks in advance!
So you could apply the effect in the OnClientEnter script (after checking that the PC has the subrace in question, and is entering the module for the first time).
As that’s a module event, you don’t need the AssignCommand wrapper:
if (!GetLocalInt(oPC, "ModuleEntered"))
SetLocalInt(oPC, "ModuleEntered", TRUE);
if (GetSubrace(oPC) == "whatever")
ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(nVFX)), oPC);
There are some timing issues with that event, so if it doesn’t work, try delaying it for one or two seconds.
Am I right to assume that this is Single Player?
Yes I’d like to implement that only for my SP game. I beg your pardon but I’m not sure that I got you right… So I should copy that script that you wrote and insert it in a module’s properties or? I apologize in advanced for making you to explain obvious things to me but as I’ve already mentioned I’m completely clueless regarding the nwn toolset.
If I implement your script to a module I will loose the effect as soon as I start changing modules, correct?
What I wrote is a snippet. In your module properties, you need to edit the OnClientEnter script, adding the snippet before the final } of the main section. As it’s SP, you can start the snippet with
object oPC = GetFirstPC();
Also, replace nVFX with the actual visual effect number, and whatever with the actual subrace name (but keep the double quotes).
There are primers on scripting in the Lexicon, also a lot of good stuff in Tarot’s post here.
This will only work for the current module, but you can put the same code in all modules. You also need to add the custom vfx hak to the Custom Content tab in module properties.
Ok understood! Thank you again for your help! I am going to try it right now
Couple of little things to add to what @Proleric wrote. The thread that is linked to in their last post was actually started by @DrA and it is a good idea to bookmark that thread so you can visit it as many times as you like without having to search for it again.
Putting the compiled version of a script into the override folder makes it possible to call it from any module, using dm_runscript. It’ll skip the “edit each new module one at a time”-step, if you’re setting up convenience functions to use in singleplayer.
Create a new module in the toolset (or load the module in which you wrote your custom script).
Create the script. The player character who is entering the console command will be the caller of the script, so define oPC as OBJECT_SELF, or apply effects directly to OBJECT_SELF.
Save and compile the new script. Give it a descriptive name that’s not horribly bothersome to type.
Open the file browser, and go to your modules folder. Whenever a module is open in the toolset, you should have a subfolder called temp in it. In the temp folder, locate the .ncs version of your custom script. Copy the .ncs file to your override folder.
Restart the game.
## DebugMode 1
## dm_runscript insertyourscriptnamehere
… into the chat window.
Thought on the side: If we collected gamebreaking-bug-reports of various types, maybe we could identify some that can be fixed via ingame-applied “bandaid”-stock scripts, and put together a “first aid kit” of “Oh snap! It’s broken! Now what?” console commands.
Command “resurrectplotnpc”? Command “ohsnapigotstuck”? Command “gimmetheplotitems”, checking through all module areas for items that are plot flagged, and copying them into the inventory of the player? Faction reputation muck-up fixes. “I got stuck in FadeToBlack state, I need a script to clear it so I can see again” happened to someone once, too.
That’s a good technique, especially for utilities used in many / all SP modules.
The script name needs to be unique, perhaps starting with your initials or whatever, ao that conflict is unlikely.
Custom content is an issue in this particular example, though - all of the modules will still need the vfx hak, and will need further work if they already have custom vfx.