I am creating duck and cover areas for ranged characters in a mod. It works pretty well so far as the projectiles can’t pass through the solid objects; however, the pc or companion I am controlling, always ‘get’s up’ from a kneeling position, to get hit by an incoming shot, even when in puppet mode and under the no action command! Is there a way to force them to stay in kneeling, sitting or prone position (prone oddly works sometimes??), while in combat? Any help is appreciated?
I’m guessing now, but maybe, to make it work in combat, you’d need to change the scripts of the companion in the OnDamaged and OnPhysicallyAttacked and OnSpellCastAt so that they are unaffected by the combat, or when they are affected, that the animation keeps playing. Seems tricky though. I don’t think I’ve ever used custom animations in combat in my modules.
As this thread is under “General Natter” I’m not 100 % sure if this is for NWN, NWNEE or NWN2. And that makes quite a difference in this case.
You could give them a full concealment affect. The missiles would hit all over except the creature. Spells are another matter I think.
Assuming NWN1, Greater Sanctuary will prevent attacks. This works with sustained animation.
It’s NWN2. Andgalf is on the right track, as there is a way to ensure they stay in the animation, and that is to remove all the reaction scripts (time consuming and limits it to the pc, or npc’s summoned or spawned from the toolset). To accomplish this I usu just remove all the scripting of the character I am controlling. The goal isn’t just not getting shot (I already use stealth, inviso and ethereal mechanics that way), but that they stay in a ducked position. As stated the idea is to recreate a duck and cover mass effect style of ranged fighting. I was hoping there was a force style script or command, like force move (only force stay in this case…lol); but looks like there isn’t.
If anyone can answer this it would be someone like @kevL_s , @travus , @Shallina , @Akhacha or @4760 . This is beyond my knowledge of the game.
Maybe change the “topic” from General Natter to NWN2 then.
Hmmm, wait, I got an idea… I just need to find a script first…
EDIT: When I’ve needed an NPC or the PC to stay in one place before, I’ve sometimes used this function
effect FREEZE = EffectCutsceneImmobilize();
ApplyEffectToObject(DURATION_TYPE_PERMANENT, FREEZE, oPC);
Maybe you could try something like that, I don’t know.
First run the animation and create a loop (wrap the PlayCustomAnimation in another custom function, I remember this is important (for some reason that I don’t remember)) with the animation and then use the EffectCutsceneImmobilize.
void PlayCustomAnimationVoid(object oObject, string sAnimation, int iLoop = 0, float fSpeed = 1.f)
{
PlayCustomAnimation(oObject, sAnimation, iLoop, fSpeed);
}
EffectCutsceneImmobilize();
only freeze the feets if I remember correctly.
Here’s what I’m thinking; since removing the characters scripts works, is there a way to add back say, the companion scripts, without using the console (I can easily add companion or standard scripts to a character in game using the console, but I don’t want to use the console in my real time play)?
Why don’t you take all the companion scripts, copy them into your campaign folder (or your override folder), and add an int or something like that to those scripts where you just do a return;
, a variable if you will, and if that condition isn’t met, you just use the code that’s in the script otherwise? I’ve done stuff like that and it works really well.
EDIT: I just noticed you can’t just copy them. See explanation below.
Here’s an example using gb_comp_block:
// gb_comp_block
/*
companion On Block
*/
// ChazM 12/5/05
//:://////////////////////////////////////////////////
//:: X0_CH_HEN_BLOCK
/*
OnBlocked handler for henchmen/associates.
*/
//:://////////////////////////////////////////////////
//:: Copyright (c) 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 01/06/2003
//:://////////////////////////////////////////////////
void main()
{
if(GetGlobalInt("animation")) return;
ExecuteScript("gb_assoc_block", OBJECT_SELF);
}
I noticed when trying this just now, that the toolset won’t let you edit the original script and save the script as a campaign script. However, if you create a new script by the exact same name, copy the code inside the original script to this, then add your new code with the int, and then save, it works.
Then, when you enter the area where you want the animations to behave in this way, you add the global int in another script, like for instance a client enter script that goes on the area, or a script that fires through a conversation or another trigger.
This way, you don’t have to remove any of the companion scripts or add them again through the console.
Yup! I know that works because I have tons of them (Prone, Sit, etc, where all the scripts are based on performing that function). This works well for instanced content and I will just keep working on an on the fly way (I usu can stumble upon it…lol). Glad you replied as I have a question: In ASW2 how did you get the Igni to stay in hover and move and attack? That looked great and would work perfectly for a Magneto style hovering pc! Was it based on the hags from MOB?
The ignii were creatures I found here: Ignus Pack | The Neverwinter Vault
I did nothing with them. I think they hover as default. I don’t know what they are based upon originally.
Thanks! Can’t wait to unpack these animations!