iMagicBae

Untitled

Apr 23rd, 2020
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Created by Graal2007722
  2. function onCreated() {
  3.   this.chat = "NPC flags";
  4. }
  5.  
  6. /*
  7.   There are certain built in flags an NPC can posses. To have
  8.   effect they must be declared inside a function. Here are some
  9.   of the most common ones:
  10.  
  11.   - dontblock();
  12.       This attribute makes it so that the npc can be walked over
  13.       by players.
  14.  
  15.   - blockagain();
  16.       Only functions if the npc previously had the dontblock();
  17.       attribute. This attribute makes the NPC a solid that cant
  18.       be walked over by players.
  19.  
  20.   - drawunderplayer();
  21.       This attribute draws the npc under the player. This is useful
  22.       for things like chairs or rugs for example.
  23.  
  24.   - drawoverplayer();
  25.       This attribute draws the NPC over the player. This is useful for
  26.       lights where the object in question NEEDS to appear to be over
  27.       the player.
  28.  
  29.   - hide();
  30.       This attribute hides the NPC so that it cant be touched or shown.
  31.       this can be useful for things like doors which would disappear
  32.       once the player touchs it to be allowed through.
  33.  
  34.   - show();
  35.       This attribute shows the NPC if it is hidden.
  36.  
  37.   - destroy();
  38.       This attribute destroys the npc. It cannot be brought back using
  39.       show(). The level must be updated for the NPC to be brought back.
  40.       No script will run whilst the NPC is destroyed.
  41.  
  42.   - sleep(float/int);
  43.       This attributes pauses the entire script of the NPC for the amount
  44.       of time specified on the first parameter. The amount of time is
  45.       measured in seconds. Once the amount of seconds is over the script
  46.       continues where it left off.
  47. */
  48.  
  49. function onPlayerChats() {
  50.   switch (player.chat) {
  51.     case "dontblock":
  52.     dontblock();
  53.     break;
  54.  
  55.     case "block":
  56.     blockagain();
  57.     break;
  58.  
  59.     case "hide":
  60.     hide();
  61.     break;
  62.  
  63.     case "show":
  64.     show();
  65.     break;
  66.  
  67.     case "drawover":
  68.     drawoverplayer();
  69.     break;
  70.  
  71.     case "drawunder":
  72.     drawunderplayer();
  73.     break;
  74.  
  75.     case "destroy":
  76.     destroy();
  77.     break;
  78.  
  79.     case "sleep":
  80.     this.chat = "Im going to sleep for 3 seconds";
  81.     sleep(3);
  82.     this.chat = "done!";
  83.     sleep(3);
  84.     onCreated();
  85.     break;
  86.   }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment