ZoriaRPG

Custom Screen Guy (v0.3) NPC Script for 2.55

Mar 8th, 2019
130
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///////////////////////////
  2. /// NPC Script Room Guy ///
  3. /// v0.3                ///
  4. /// 8th March, 2019     ///
  5. /// By: ZoriaRPG        ///
  6. ///////////////////////////
  7.  
  8. //ZQuest Screen Menu Sets Options
  9. //Set Screen->String to the string to display
  10. //Set Screen->Catchall to the delay time, if the roomtype is none.
  11. //Otherwise, you can set a default delay on the enemy using D0.
  12.  
  13. //v0.2 Initial Fixes
  14. //v0.3 Added Once Only Behavioural Flag
  15.  
  16. npc script screenguy
  17. {
  18.     const int DELAY = 20; //Time to spawn.
  19.     const int BFLAG_ONCE = 4;
  20.     const int REGISTER = 6;
  21.     const int BIT = 2;
  22.     void run(int delay, int reg, int bit)
  23.     {
  24.         delay = this->InitD[0] > 0 ? delay : DELAY;
  25.         reg = this->InitD[1] > 0 ? reg : REGISTER;
  26.         bit = this->InitD[2] > 0 ? bit : BIT;
  27.        
  28.         if ( !Screen->RoomType )
  29.         {
  30.             if ( Screen->Catchall )
  31.             {
  32.                 delay = Screen->Catchall;
  33.             }
  34.         }
  35.         this->CollDetection = false;
  36.         //this->DrawYOffset = -32768;
  37.         //Waitframes(Screen->Catchall); //might be in use depending on room type
  38.         Waitframes(delay);
  39.        
  40.         if ( this->BFlags[BFLAG_ONCE] )
  41.         {
  42.             if ( !(GetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit)); )
  43.             {
  44.                 Screen->Message(Screen->String);
  45.                 SetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit, true);
  46.             }
  47.         }
  48.         else Screen->Message(Screen->String);
  49.     }
  50. }
RAW Paste Data