Script question - Reading letter animation [SOLVED]

Back in december, Rashi was kind enough to make a reading-paper animation, and I made a script based upon rjshae’s eating script…Ok, this takes too long to explain. Read here to see what it’s about:

Anyway, I’ve used this script before and it has always worked, but when I tried this script in yet another conversation ingame with another character, nothing happened. So, I made a SendMessageToPC in the script to see if the script ran at all, which it did. This puzzled me even more…Then when I switched the conversation to NWN1 Style-conversation, I found out what was happening. The animation with the reading of the paper ran, BUT it was the owner of the conversation that read the paper and NOT the creature with the tag that I had put in. Previoulsy in the game when I’ve used this script it has worked probably because it was the owners of the other conversations that had the animation running.

So, my question is this: How come it’s the owner of the conversation that is getting the animation and not the creature with the tag that I put in? Maybe there’s a simple explanation for this?

Here’s the script:

void Loop(object oTarget) 
{
	if (!GetLocalInt(oTarget, "stop_animation"))
	{
    // read F/X
    PlayCustomAnimation(OBJECT_SELF, "read", 0);
    DelayCommand(6.0f, Loop(oTarget));
	}
}

void main(string sTarget) 
{
    
    object oTarget = GetObjectByTag(sTarget);
    // F/X to display
    string sVFX = "fx_handr_letter.sef";
    // Assign VFX to spell id 100 (light spell)
    effect eDrink = SetEffectSpellId(EffectNWN2SpecialEffectFile(sVFX), 100);
    SetWeaponVisibility(OBJECT_SELF, 0, 0);//Make weapons and shields invisible
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDrink, OBJECT_SELF);
    SetLocalInt(oTarget, "stop_animation", FALSE);
	
    DelayCommand(6.0f, Loop(oTarget));
}
2 Likes

Just a thought: Might it have to do with me starting this conversation with CreateIpSpeaker? In this scene I really don’t need to use that. I might as well use the ActionStartConversation in this case.

EDIT: Tried with a normal SpeakTrigger instead of a NewGenericTrigger with my CreateIpSpeaker script, but that had no effect at all. It’s the same as before. So my question remains: Why does the animation happen to the owner of the conversation and not the creature with the tag I’m using?

2 Likes

because you’re applying the sef to OBJECT_SELF (dialog owner / ip-placeable) rather than to oTarget

?

edit: likewise w/ PlayCustomAnimation() in Loop()

5 Likes

Doh! :man_facepalming: Of course. Thanks kevL_s. I knew there was a simple explanation for this.

3 Likes