I’m trying to paralyze my companions in my module. I made a script like this. However, in game they just walk around like nothing’s happened. I trigger this script through a conversation:
void main()
{
effect eEffect = EffectCutsceneParalyze();
object oTarget = GetObjectByTag("Elinthriel");
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget);
object oTarget2 = GetObjectByTag("LilyMoonglow");
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget2);
object oTarget3 = GetObjectByTag("NiyaMoonglow");
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget3);
object oTarget4 = GetObjectByTag("Zecane");
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget4);
}
I first tried with EffectParalyze, but when that didn’t work I tried with EffectCutsceneParalyze as you see here. Why wont this work?
I tried with this script too. But still it does nothing:
void main()
{
object oTarget = GetObjectByTag("Elinthriel");
object oTarget2 = GetObjectByTag("LilyMoonglow");
object oTarget3 = GetObjectByTag("NiyaMoonglow");
object oTarget4 = GetObjectByTag("Zecane");
ActionCastSpellAtObject(SPELL_HOLD_PERSON,oTarget,METAMAGIC_ANY,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE);
ActionCastSpellAtObject(SPELL_HOLD_PERSON,oTarget2,METAMAGIC_ANY,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE);
ActionCastSpellAtObject(SPELL_HOLD_PERSON,oTarget3,METAMAGIC_ANY,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE);
ActionCastSpellAtObject(SPELL_HOLD_PERSON,oTarget4,METAMAGIC_ANY,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE);
}
The second script won’t work because that action is theoretically not assigned to anyone, and the target might be immune to the spell anyway.
The first one should work, if it doesn’t it’s because either:
- the script is not really triggered (this depends on how you set up the conversation)
- there is actually no object in the module tagged with those tags
can’t think of anything else at the moment.
Do a test, use this script and tell me what messages you see. Make sure that scripts are compiled before testing.
void main()
{
object oPC = GetPCSpeaker();
object oTARGET;
effect eFX = EffectCutsceneParalyze();
string sTAG;
int nTARGET;
while (nTARGET < 4)
{
switch (nTARGET)
{
case 0: sTAG = "Elinthriel"; break;
case 1: sTAG = "LilyMoonglow"; break;
case 2: sTAG = "NiyaMoonglow"; break;
case 3: sTAG = "Zecane"; break;
default: return;
}
oTARGET = GetObjectByTag(sTAG);
if (oTARGET == OBJECT_INVALID) SendMessageToPC(oPC, "Object not found: " + sTAG);
else
{
SendMessageToPC(oPC, "Object found: " + sTAG + ". Applying Paralysis.");
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFX, oTARGET);
}
nTARGET = nTARGET + 1;
}
}
I’ve had various problems when trying to assign actions to henchmen. At this point, I’m basically of the opinion that the henchmen script set somehow interferes with making them do stuff, or something. Because, honestly, I don’t know.
For instance, I’m trying to make both the PC and the henchman jump to a specific spot while having a conversation (they’re supposed to lean against a tree and kiss). And everything about the script works - aside from the henchman action. And no, there’s no tag error or anything like that, the henchman just ignores the script.
IDK what’s going on, but henchmen are a major pain in the neck.
Thanks for the replies Clangeddin and QuenGalad!
I tried your sort of debug script Clangeddin and I got the messages:
Object Found: Elinthriel. Applying Paralysis
Object Found: LilyMoonglow. Applying Paralysis
Object Found: NiyaMoonglow. Applying Paralysis
Object Found: Zecane. Applying Paralysis
But just as before, when the conversation is over the companions happily continue following the PC without being paralyzed. So it seems that the script should work.
Maybe it is like you say QuenGalad, that it has to do with them being companions or henchmen. I’m wondering if I used ClearAllActions, if that would make a difference. The script is fired in the middle of the conversation when the NPC you’re talking to says something. Maybe it has to do with that? Maybe I can only do this kind of script at the end of a conversation?
Are you trying to literally paralyze your party members or are you just trying to keep them from moving around during a cutscene? If the later, you could try using the “ga_party_freeze” script in the convo. Then use “ga_party_unfreeze” at the end of the convo.
Well, I would actually like to literally paralyze my party members. It’s part of the story. And it would be cool, not sure if that is how it manifests itself, if it was visible that they are indeed paralyzed (like some lighting effect or something, maybe one can make them look like a statue, like they are temporarily turned to stone or something). That’s why at first I believed one has to cast a spell on them through a script, but apparently there was something wrong with my spell script (and in that script I’ll be honest and say I don’t know what I’m doing, I just looked at the function and tried something).
This will petrify your entire party (except the main PC) and apply a stone effect to them:
#include "x0_i0_petrify"
void main()
{
object oPC = GetFirstPC();
effect eStone = EffectVisualEffect(VFX_DUR_SPELL_STONESKIN);
object oFM = GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(oFM))
{
if (oFM != oPC)
{
Petrify(oFM);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eStone, oFM);
}
oFM = GetNextFactionMember(oPC, FALSE);
}
}
I tried your script travus and the the visual effect works, but after the dialog they move as if nothing has happened, just like with the other scripts. Maybe it doesn’t work within a conversation? Or maybe it has something to do with the scripts that are attached to the companions (they are stock companion scripts). Maybe one should try to change something like the On Blocked script of the companions…or something…once again I feel NWN2 just doesn’t want to work with me, sigh)
I tested this script with a party and it turned everyone (except the main PC) into statues as desired. And they stayed statues after the convo ended. Are there any other scripts in your convo that remove effects?
That’s really weird. I only have one other script at the end of the conversation. I’ll remove that and test if the result is the same…
No. Still the same result. What is it with my module that always produce these weird results on my end. Arrgh.
I use the b_CompanionScripts.xml set on my companions. Can that be something that interfers?
And I use ipspeaker to start the conversation. Could it be something that has anything to do with that? This is the trigger for the conversation:
#include "ginc_ipspeaker"
void main()
{
object oPC1=GetEnteringObject();
if(!GetIsPC(oPC1))return;
int nInt2;
nInt2=GetLocalInt(oPC1,"NW_JOURNAL_ENTRYfinal_battle_quest");
if (nInt2 == 2)
{
object oPC = GetFirstPC(FALSE);
CreateIPSpeaker("thedorgonmaster", "end_fight_conv", GetLocation(GetFirstPC()), 1.0f);
}
}
That seemed to be it! I did a script like this instead to start the conversation, and all of a sudden the companions got petrified like they should have been:
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int nInt;
nInt=GetLocalInt(oPC, "NW_JOURNAL_ENTRYfinal_battle_quest");
if (nInt == 2)
{
object oTarget;
oTarget = GetObjectByTag("thedorgonmaster");
AssignCommand(oTarget, ActionStartConversation(oPC, "end_fight_conv"));
}
}
One thing I don’t like with this, if compared to the ipspeaker script, is that the NPC that you start the conversation with runs towards you and stops when just in front of you. I would like the conversation to start without the NPC moving. Is that possible to do? When using SpeakTrigger (which I don’t like 'cause it’s not always reliable) you can choose TalkNow or something like that…
Yes, you can have the convo start immediately by changing the convo line to this:
AssignCommand(oTarget, ActionStartConversation(oPC, "end_fight_conv", FALSE, FALSE, TRUE));
That simple, huh? Yes, I see it now when looking at the function. Thanks alot for all the help!
(I did the script by using the Script Generator and then modifying it, that’s why I didn’t notice it in the function. I feel it’s easier to start that way writing scripts.)