AutentificareUtilizatorParola
Autentifica-ma automat la fiecare vizita    
Inregistrare
Inregistrare
Mesaje private
Mesaje private
Pagina de start a forumului MuZone Forum » NPC Scripts

Creaza un subiect nou   Raspunde la subiect
Another NPC
Subiectul anterior :: Subiectul urmator  
Autor Mesaj
Astaroth
Admin
<b><font color=red>Admin</font></b>
Astaroth

Data inscrierii: 04/Oct/2006
Mesaje: 2640
Localitate: MuZone World!

MesajTrimis: 05/05/2007 22:20    Titlul subiectului: Another NPC Raspunde cu citat (quote)

Basically, this NPC takes money, and once he gets a certain amount of money, something happens. A GM sets what happens as a message. This could be anything from new NPCs added to an event happening.

A gm sets the thing to happen and how much money he needs. Once he gets that amount of money, he sends a message that the money chest is full.

You can only give him money if he hasn't reached his current goal.

This is easily adaptable to take items in lieu of money. For example, you can specify a db amount needed, or a met amount needed. Hell, you can even specify a money amount but allow certain items to be worth a certain amount of money.

Cod:

// gimp
// NPC ID: some new one
// Location: Desert 2, in the abandoned city, or desert 1, in the oasis

String[] dlg=null;
switch(option)
{
   case -1:
   {
      String[] tm = null; // so we don't get the "tm may not have been set" error
      if (gm() > 0) {
         tm = {
            "AVATAR 1",
            "TEXT The more people donate to me, the quicker things happen.",
            "OPTION0 What things?",
            "OPTION1 I'd like to donate.",
            "OPTION2 How much more money do you need?",
            "OPTION10 Set message.",
            "OPTION12 Set donate amount.",
            "OPTION-1 Get your own money."
         };
      } else {
         tm = {
            "AVATAR 1",
            "TEXT The more people donate to me, the quicker things happen.",
            "OPTION0 What things?",
            "OPTION1 I'd like to donate.",
            "OPTION2 How much more money do you need?",
            "OPTION-1 Get your own money."
         };
      }
      dlg = tm;
      break;
   }
   case 0:
   {
      String[] tm={
         "AVATAR 1",
         "TEXT " + globsval("pubworks"),
         "OPTION-1 Okay, cool."
      };
      dlg=tm;
      break;
   }
   case 1:
   {
      String[] tm = null;
      if (globval("pubworks") == 0) {
         tm = {
            "AVATAR 1",
            "TEXT I've already reached my money goal. Thanks anyways.",
            "OPTION-1 I see."
         };
      } else {
         tm = {
            "AVATAR 1",
            "TEXT Please enter the amount you wish to donate below.",
            "INPUT3 Donate: ",
            "OPTION-1 Nevermind."
         };
      }
      dlg=tm;
      break;
   }
   case 2:
   {
      String[] tm={
         "AVATAR 1",
         "TEXT I need " + globval("pubworks") + " more silvers.",
         "OPTION-1 Okay, thank you."
      };
      dlg=tm;
      break;
   }
   case 3:
   {
      // make sure input is an integer
      int x = 0;
      try {
         val = Integer.parseInt(input);
      } catch (Exception e) {
         String[] tm = {
            "AVATAR 1",
            "TEXT The number you put in is not an integer.",
            "OPTION12 Sorry, let me try again.",
            "OPTION-1 Nevermind then."
         }
         dlg = tm;
         break;
      }

      int old = globval("pubworks");
      if (old - x < 0) {
         x += old - x;
      }
      setglobval("pubworks", old - x);

      String[] tm={
         "AVATAR 1",
         "TEXT Thank you, you have donated " + x + " silvers.",
         "OPTION-1 Sweet."
      };
      dlg=tm;

      if (globval("pubworks") == 0) {
         atcommand("@gm Public money goal attained.");
         atcommand("@gm Public money goal attained.", 60000);
      }
      break;
   }
   case 10:
   {
      if (gm() < 1) {
         String[] tm={
            "AVATAR 1",
            "TEXT Fuck yourself.",
            "OPTION-1 Ok."
         };
         dlg=tm;
         break;
      }
      String[] tm={
         "AVATAR 1",
         "TEXT What would you like to set the message to?",
         "INPUT11 Message: ",
         "OPTION-1 Nevermind."
      };
      dlg=tm;
      break;
   }
   case 11:
   {
      if (gm() < 1) {
         String[] tm={
            "AVATAR 1",
            "TEXT Fuck yourself.",
            "OPTION-1 Ok."
         };
         dlg=tm;
         break;
      }

      setglobsval("pubworks", input);

      String[] tm={
         "AVATAR 1",
         "TEXT Set.",
         "OPTION-1 Thanks."
      };
      dlg=tm;
      break;
   }
   case 12:
   {
      if (gm() < 1) {
         String[] tm={
            "AVATAR 1",
            "TEXT Fuck yourself.",
            "OPTION-1 Ok."
         };
         dlg=tm;
         break;
      }
      String[] tm={
         "AVATAR 1",
         "TEXT How much will the donate value needed be?",
         "INPUT13 Amount: ",
         "OPTION-1 Nevermind."
      };
      dlg=tm;
      break;
   }
   case 13:
   {
      if (gm() < 1) {
         String[] tm={
            "AVATAR 1",
            "TEXT Fuck yourself.",
            "OPTION-1 Ok."
         };
         dlg=tm;
         break;
      }


      // and here's some code to make sure input is an integer
      int val = 0;
      try {
         val = Integer.parseInt(input);
      } catch (Exception e) {
         String[] tm = {
            "AVATAR 1",
            "TEXT The number you put in is not an integer.",
            "OPTION12 Sorry, let me try again.",
            "OPTION-1 Nevermind then."
         }
         dlg = tm;
         break;
      }

      setglobval("pubworks", val);

      String[] tm={
         "AVATAR 1",
         "TEXT Set.",
         "OPTION-1 Thanks."
      };
      dlg=tm;
      break;
   }
}

script by gimp
_________________
Another NPC Another NPC
Sus
Vezi profilul utilizatorului Trimite mesaj privat Trimite un mesaj
Scottdavey
Member
<b>Member</b>
Scottdavey

Data inscrierii: 01/Mai/2007
Mesaje: 68
Localitate: Northen Ireland

MesajTrimis: 06/05/2007 13:50    Titlul subiectului: Raspunde cu citat (quote)

what to do with this?
Sus
Vezi profilul utilizatorului Trimite mesaj privat
Afiseaza mesajele pentru a le previzualiza:   
Creaza un subiect nou   Raspunde la subiect    Pagina de start a forumului MuZone Forum » NPC Scripts Ora este GMT + 2 ore
Pagina 1 din 1

 
Mergi direct la:  
Nu puteti crea un subiect nou in acest forum
Nu puteti raspunde in subiectele acestui forum
Nu puteti modifica mesajele proprii din acest forum
Nu puteti sterge mesajele proprii din acest forum
Nu puteti vota in chestionarele din acest forum

Powered by phpBB © 2001, 2002 phpBB Group
iCGstation v1.0 Template By Ray © 2003, 2004 iOptional

Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro