Skip to content

Apply visual effect to PC on item activation

Still very new at this, but I'm making a stone of recall following this guide (https://nwnlexicon.com/index.php?title=Grimlar_-_Guide_To_The_Stone_Of_Recall)

I got everything working and was even able to figure out how to add a 10 sec delay (yay me!)

When the item is activated I want to add a aura to the user after 5 sec, that lasts for 5 sec.

The error I'm getting is nw_it_recall.nss(40): ERROR: INCORRECT VARIABLE STATE LEFT ON STACK

#include "x2_inc_switches"
#include "nw_i0_plot"
void StoneOfRecall()
{
int nEvent =GetUserDefinedItemEventNumber();

// * This code runs when the Unique Power property of the item is used
// * Note that this event fires PCs only
if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
//IsRecall is defined in nw_i0_plot
IsRecall();
}
}

void main()
{
DelayCommand(10.0, StoneOfRecall());

//Status messages and Visual effects
int nEvent =GetUserDefinedItemEventNumber();

// * This code runs when the Unique Power property of the item is used
// * Note that this event fires PCs only
if (nEvent == X2_ITEM_EVENT_ACTIVATE)

//Apply Visual effect to PC after 5 sec
effect eEffect = EffectVisualEffect(VFX_DUR_AURA_PULSE_CYAN_WHITE);
location lPC = GetLocation(GetItemActivator());
DelayCommand(5.0, ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eEffect, lPC, 5.0));

//Display countdown messages in Combat log
SendMessageToPC(GetItemActivator(), "The Stone of Recall glows softly as it begins charging (10s left)");
DelayCommand(2.0, SendMessageToPC(GetItemActivator(), "The Stone of Recall continues to glow as it charges(8)"));
DelayCommand(4.0, SendMessageToPC(GetItemActivator(), "The Stone of Recall continues to glow as it charges (6)"));
DelayCommand(6.0, SendMessageToPC(GetItemActivator(), "The Stone of Recall glows Brighter (4)"));
DelayCommand(8.0, SendMessageToPC(GetItemActivator(), "The Stone of Recall glows Brighter (2)"));
DelayCommand(9.5, SendMessageToPC(GetItemActivator(), "The Stone of Recall flashes brilliantly!"));

}

Comments

Sign In or Register to comment.