Hi everyone,
Today’s challenge is, I am trying to setup an NPC (who is petrified), to have it so that if/when a PC casts stone to flesh, their conversation file can update to reflect this. Lilac’s can’t help me with this one either.
I have found scripts that come with the game and they work nicely, but there doesn’t seem to be a script I can find, that factors the above in (I’ll paste the scripts down below, that I am using on the NPC, that come with the game).
I’ll try to explain the issue better: The NPC has a conversation attached to them. I am having trouble finding a conditional check script, that will know the NPC is not a statue anymore. PC’s can cast stone to flesh (if they have it). So would an “on_spell_cast_at” script work that maybe sets a global_int, that the conversation can reference?
I am open to whatever solution is easiest for this one, as once again, once the conversation starts correctly after stone-to-flesh, then I can do the rest of the script work in the conversation (journal updates etc).
Here are the scripts that come with the game, that I am using: (maybe i don’t need to share these, but I will in case it helps)
gb_statue_sp: (using variable: int “Effect” = 721)
// gb_statue_sp
/*
Causes creature to spawn in as a statue.
Clears all creature scripts, sets as plot, applies petrify, etc.
Local vars used with this script:
(variable set "b_effect")
int EFFECT - the visual duration effect (defualts to 0 - VFX_DUR_BLUR)
Example duration effect values:
int VFX_NONE = -1;
int VFX_DUR_BLUR = 0;
int VFX_DUR_SPELL_FLESH_TO_STONE = 721;
int VFX_SPELL_DUR_BODY_SUN = 924;
*/
// ChazM 3/28/07
#include "NW_I0_GENERIC"
#include "ginc_event_handlers"
void main()
{
object oTarget = OBJECT_SELF;
SetOrientOnDialog(oTarget, FALSE);
effect ePetrify = EffectPetrify();
int iEffect = GetLocalInt(oTarget, "EFFECT");
if (iEffect != VFX_NONE)
{
effect eDur = EffectVisualEffect( iEffect );
ePetrify = EffectLinkEffects(eDur, ePetrify);
}
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePetrify, oTarget);
PrettyDebug(GetName(oTarget) + " - petrified by spawn");
// prevent from being bumpable
SetBumpState(oTarget, BUMPSTATE_UNBUMPABLE);
// No need to have event handlers if we are just standing here
// (Actually, the empty set defualts to something. To get truly
// nothing we must use the nothing scripts).
SetAllEventHandlers(oTarget, SCRIPT_OBJECT_NOTHING);
// except for dialog in case we want to talk. (need special conv. script)
SetEventHandler(oTarget, CREATURE_SCRIPT_ON_DIALOGUE, "gb_statue_conv");
// make plot so creature is indestructable
SetPlotFlag(oTarget, TRUE);
// Don't run the standard script since all we want is for the creature
// to be permanently paralyzed like a statue, so no treasure generation,
// setting AI flags, etc.
// ===================================================================
// now run the standard spawn. This may run other scripts, create treasure, and set various flags
//ExecuteScript(SCRIPT_DEFAULT_SPAWN, OBJECT_SELF);
}
gb_statue_hb:(heartbeat script)
// gb_statue_hb
/*
Statue creature hb script to make sure that they will re-petrify after loaded save.
*/
// MDiekmann 8/30/07
#include "ginc_debug"
void main()
{
object oTarget = OBJECT_SELF;
SetOrientOnDialog(oTarget, FALSE);
effect ePetrify = EffectPetrify();
// remove plot flag so that petrify effect can be used
SetPlotFlag(oTarget, FALSE);
// reapply effect
ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePetrify, oTarget);
PrettyDebug(GetName(oTarget) + " petrified");
// make plot so creature is indestructable
SetPlotFlag(oTarget, TRUE);
}
gb_statue_conv: (on conversation statue)
//gb_statue_conv
/*
OnConversation event handler for statue creatures.
*/
// ChazM 3/30/07
#include "nw_i0_generic"
#include "ginc_behavior"
// The defualt handler won't have creatures talk when they are petrified
// and also the commandable stuff causes problems.
void main()
{
PrettyDebug("NW_C2_DEFAULT4");
ClearActions(CLEAR_NW_C2_DEFAULT4_29);
BeginConversation();
//SetFacing(GetFacing(OBJECT_SELF), TRUE);
return;
}
EDIT: to clarify, the script doesn’t need to start a conversation. Players will do that themselves after they turn it from stone to flesh (I assume!).