NWNWiki
Advertisement
NWNWiki
3,718
pages

The osrs_osca script is used by the Open Source Rule Set to handle the OnSpellCastAt event. The content of the script is the following.

/////////////////////////////////////////////////////////////////////////////
//
// file:
//      osrs_osca
//
// purpose:
//      OnSpellCastAt
//
/////////////////////////////////////////////////////////////////////////////

// the OSRS include file
#include "osrs_inc"

/////////////////////////////////////////////////////////////////////////////
void main()
{
    // determine what type of object is calling this script
    int iCallingClass = osrs_GetCallerEventClass(OBJECT_SELF);
    switch(iCallingClass)
    {
        case I_OSRS_EVENT_CLASS_PLACEABLE:
            // Placeable::OnSpellCastAt Pre-event
            if (!osrs_p_osca_pre())
            {
                return;
            }

            // Placeable::OnSpellCastAt event
            if (!osrs_p_osca())
            {
                return;
            }

            // Placeable::OnSpellCastAt post-event
            osrs_p_osca_post();

            return;

        case I_OSRS_EVENT_CLASS_CREATURE:
            // Creature::OnSpellCastAt Pre-event
            if (!osrs_c_osca_pre())
            {
                return;
            }

            // Creature::OnSpellCastAt event
            if (!osrs_c_osca())
            {
                return;
            }

            // Creature::OnSpellCastAt post-event
            osrs_c_osca_post();

            return;

        case I_OSRS_EVENT_CLASS_DOOR:
            // Door::OnSpellCastAt Pre-event
            if (!osrs_d_osca_pre())
            {
                return;
            }

            // Door::OnSpellCastAt event
            if (!osrs_d_osca())
            {
                return;
            }

            // Door::OnSpellCastAt post-event
            osrs_d_osca_post();

            return;

        default:
            return;
    }

}
Advertisement