Skip to content

NPC sitting in chair and random banter script problem.

Having an issue where if the NPC is sitting the banter doesnt fire off. Only works when the npc is standing. Not sure what the problem might be. Looking for advice or maybe changes in the script. Help will be greatly appreciated.

My OnSpawn script is:

void main()
{
ActionSit( GetNearestObjectByTag( "Chair"));
}


And my OnHeartbeat script is:

string sSayThis;
int iTalkVolume = TALKVOLUME_TALK;
int iRollTen = d10(1);
int iTalkFlag = 0;
void main()
{
if(d100(1) > 71) //Gives this script a 30% chance of completing
{ //Its execution. Call it my anti-spam code. (c:
if(iRollTen != 0) //Just in case a 0 slips in though I don't think
{ //It's possible.
switch(iRollTen) //Jump to the rolled statement number.
{
case 1:
sSayThis = "I need another ale.";
break;
case 2:
sSayThis = "Our downward climb has been rough. Another round should do.";
break;
case 3:
sSayThis = "*hiccup*";
break;
case 4:
sSayThis = "*sigh*.";
break;
case 5:
sSayThis = "*cough*";
break;
case 6:
sSayThis = "*belch*";
break;
case 7:
sSayThis = "*burp*";
break;
case 8:
sSayThis = "wip";
break;
case 9:
sSayThis = "wip.";
break;
case 10:
sSayThis = "wip.";
break;
} //End Switch Statement
ActionSpeakString(sSayThis, iTalkVolume); //Make the NPC talk
} //End If Statement
} //End If Statement
} //End Main

Comments

  • DazDaz Member Posts: 127
    ActionSpeakString(sSayThis, iTalkVolume); //Make the NPC talk
    

    This is an action, so it'll be queued to run after ActionSit()

    If you change ActionSpeakString to just SpeakString it should work since it run immediately.
  • ProlericProleric Member Posts: 1,316
    If that doesn't work, try
    ClearAllActions();
    ActionSpeakString(sSayThis, iTalkVolume); 
    ActionSit( GetNearestObjectByTag( "Chair"));
    

    This method can be used in the OnConversation script, too.

    The commands are executed rapidly, creating the illusion that the NPC remains seated throughout.
  • GallowGallow Member Posts: 4
    Daz wrote: »
    ActionSpeakString(sSayThis, iTalkVolume); //Make the NPC talk
    

    This is an action, so it'll be queued to run after ActionSit()

    If you change ActionSpeakString to just SpeakString it should work since it run immediately.
    Proleric wrote: »
    If that doesn't work, try
    ClearAllActions();
    ActionSpeakString(sSayThis, iTalkVolume); 
    ActionSit( GetNearestObjectByTag( "Chair"));
    

    This method can be used in the OnConversation script, too.

    The commands are executed rapidly, creating the illusion that the NPC remains seated throughout.

    Thank you! These are excellent!
Sign In or Register to comment.