ZoriaRPG icon

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

ZoriaRPG | PRO | 03/08/19 01:32:49 PM UTC | 0 ⭐ | 651 👁️ | Never ⏰ | []
C++ |

1.33 KB

|

None

|

0 👍

/

0 👎

///////////////////////////
/// NPC Script Room Guy ///
/// v0.3                ///
/// 8th March, 2019     ///
/// By: ZoriaRPG        ///
///////////////////////////
 
//ZQuest Screen Menu Sets Options
//Set Screen->String to the string to display
//Set Screen->Catchall to the delay time, if the roomtype is none.
//Otherwise, you can set a default delay on the enemy using D0. 
 
//v0.2 Initial Fixes
//v0.3 Added Once Only Behavioural Flag
 
npc script screenguy
{
    const int DELAY = 20; //Time to spawn. 
    const int BFLAG_ONCE = 4;
    const int REGISTER = 6;
    const int BIT = 2;
    void run(int delay, int reg, int bit)
    {
        delay = this->InitD[0] > 0 ? delay : DELAY;
        reg = this->InitD[1] > 0 ? reg : REGISTER;
        bit = this->InitD[2] > 0 ? bit : BIT;
        
        if ( !Screen->RoomType )
        {
            if ( Screen->Catchall )
            {
                delay = Screen->Catchall;
            }
        }
        this->CollDetection = false;
        //this->DrawYOffset = -32768;
        //Waitframes(Screen->Catchall); //might be in use depending on room type
        Waitframes(delay);
        
        if ( this->BFlags[BFLAG_ONCE] ) 
        {
            if ( !(GetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit)); )
            {
                Screen->Message(Screen->String);
                SetScreenDBit(Game->GetCurDMap(), Game->GetCurScreen(), reg, bit, true);
            }
        }
        else Screen->Message(Screen->String);
    }
}

Comments