FANDOM


99 Bottles of Beer on the Wall

What it does Edit

Has an NPC sing 99 bottles of beer on the wall. That's right, the whole song! Something I felt ought to be out there. Have an NPC bard in the corner? Need him to be singing something but don't have time to come up with a song of your own? Then this script is for you!

Notes Edit

When your NPC finishes the song he says, "One more time!" and starts over!

The Script, Part 1 Edit

Make this script the NPC's OnSpawn script

void main()
{
  SetLocalInt(OBJECT_SELF, "SINGER_COUNT", 100);
}

The Script, Part 2 Edit

Make this the NPC's OnHeartbeat script:

int nCount=GetLocalInt(OBJECT_SELF, "SINGER_COUNT");
void main()
{
    nCount = nCount-1;
    if (nCount==-1)
      {
ActionSpeakString("One more time!");
       SetLocalInt(OBJECT_SELF, "SINGER_COUNT", 100);
       }
    else
       {
        if (nCount==0)
          {
ActionSpeakString(IntToString(nCount)+" bottles of beer on the wall!");
           }
        else
           {
            if (nCount==1)
              {
ActionSpeakString(IntToString(nCount)+" bottle of beer on the wall.");
               ActionWait(2.0);
ActionSpeakString(IntToString(nCount)+" bottle of beer.");
               ActionWait(2.0);
ActionSpeakString("Take it down, pass it around...");
               }
            else
               {
                if (nCount==2)
                  {
ActionSpeakString(IntToString(nCount)+" bottles of beer on the wall.");
               ActionWait(1.5);
ActionSpeakString(IntToString(nCount)+" bottles of beer.");
               ActionWait(1.5);
ActionSpeakString("Take one down and pass it around...");
               ActionWait(1.5);
ActionSpeakString(IntToString(nCount-1)+" bottle of beer on the wall!");
                   }
                else
                   {
ActionSpeakString(IntToString(nCount)+" bottles of beer on the wall.");
               ActionWait(1.5);
ActionSpeakString(IntToString(nCount)+" bottles of beer.");
               ActionWait(1.5);
ActionSpeakString("Take one down and pass it around...");
               ActionWait(1.5);
ActionSpeakString(IntToString(nCount-1)+" bottles of beer on the wall!");
                    }
                }
            }
        SetLocalInt(OBJECT_SELF, "SINGER_COUNT", nCount);
        }
}

Special Thanks Edit

A special thanks to the author of Celowin's Scripting Tutorials for making it possible for me to turn out scripts like this.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.