Hello everyone I picked up my old NWN2 game discs a few days ago and figured I would give it a try since I almost never played it since I got it a few years ago (my computer just didn't cope with it). I have always been more of a builder in NWN 1 so I wanted to try and see what I could make with the new toolset, so far I got my module up and running, I got a few basic systems done for death and rest and such but I have run into a problem in one of my scripts where the visual effect I want to apply just never fires and I have half beaten myself to death today trying to figure it out.
Description of what I want the script to do...
When a player dies he/she respawns in a shadow realm where they are guided to a portal, by a wisp spirit,that will bring them back to the world of the living. I have setup a bunch of numbered waypoints in the area that the spirit will walk along towards the portal, I have also setup a number of triggers that fires an on_enter script that moves the wisp on to the next waypoint. But there is supposed to be unstable magic in the area and with some randomness there will be a visual effect, like an explosion or similar that knocks down the player for a few seconds and then the player can continue.
What the script is actually doing...
I got pretty much everything working, the wisp walks along fine, a local int on the player keeps track of where the wisp-spirit is, each trigger stops triggering after they have been fired once, when the explosion effect takes place the player is knocked down so that part is working, it is just the visual effect that won't fire.
And here is my code...
//Wisp Trigger
void main()
{
object oPC = GetEnteringObject();
int nExplosion = d100();
//show this message when the explosion happens
string sMsg = "<b><color=Red>The unstable weave of magic around you explodes.</color></b>";
//if already triggered, there is still chance of an explosion but the wisp won't move
if (GetLocalInt(OBJECT_SELF, "Triggered") != 0) {
if (GetIsPC(oPC) && nExplosion <= 35) {
SendMessageToPC(oPC, sMsg);
//this effect doesn't fire
effect eVisual = EffectNWN2SpecialEffectFile("VFX_SPELL_SHADES_DELAYED_FIREBALL", oPC, GetPosition(oPC));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPC, 5.0);
//these effects fire as planned so there is nothing wrong with the if statement
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_PRONE, 1.0, 8.0));
effect eImmobilize = SupernaturalEffect(EffectCutsceneImmobilize());
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eImmobilize, oPC, 8.0f);
effect eFreeze = SupernaturalEffect(EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION));
DelayCommand(1.0f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFreeze, oPC, 7.0f));
}
return;
}
//if not triggered, move the spirit and then check for explosion
if (GetIsPC(oPC) || GetIsPossessedFamiliar(oPC)){
object oWisp = GetNearestObjectByTag("guiding_spirit");
//setup the waypoint variable, the wisp spawns at waypoint number 1
//if the variable does not already exist as a local int on the player
//then increase it to 2 to get next waypoint.
int nNumber = GetLocalInt(oPC, "WispWaypoint") + 1;
if (nNumber == 1){
nNumber++;
}
string sWaypoint = "Z_WP_WISP_" + IntToString(nNumber);
AssignCommand(oWisp, ActionMoveToObject(GetWaypointByTag(sWaypoint), TRUE));
//set the triggered and current waypoint as local int
SetLocalInt(oPC, "WispWaypoint", nNumber++);
SetLocalInt(OBJECT_SELF, "Triggered", 1);
//now check for a random explosion again
if (GetIsPC(oPC) && nExplosion <= 30) {
SendMessageToPC(oPC, sMsg);
//and ofcourse this effect won't fire either since it is the same as above
effect eVisual = EffectNWN2SpecialEffectFile("VFX_SPELL_SHADES_DELAYED_FIREBALL", oPC, GetPosition(oPC));
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVisual, GetLocation(oPC), 5.0);
//these effects fire as planned so there is nothing wrong with the if statement
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_PRONE, 1.0, 8.0));
effect eImmobilize = SupernaturalEffect(EffectCutsceneImmobilize());
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eImmobilize, oPC, 8.0f);
effect eFreeze = SupernaturalEffect(EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION));
DelayCommand(1.0f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFreeze, oPC, 7.0f));
}
}
}
If anyone has any idea of what is going on I would really appreciate your help, the script compiles fine and I have tried substituting EffectNWN2SpecialEffectFile with EffectVisualEffect and substituting the VFX with other effects and nothing seems to work.
Thanks in advance! =)





Retour en haut






