Aller au contenu

Photo

Area Load Script help needed


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Sonmeister

Sonmeister
  • Members
  • 167 messages
I need help (again).  This script won't compile.  I'm trying to have some things happen on an area load if a plot flag has been set.  I get this error message.

E: 06:25:05 - utility_h.nss - utility_h.nss(?): Script must contain either a main or StartingConditional


//==============================================================================
/*

 Elven Ruins
     -> Level 2 Area Script

*/
//------------------------------------------------------------------------------
// Created By: Sonny
// Created On: June 10, 2010
//==============================================================================


#include "utility_h"
#include "plt_sword"

const string ALRIC_VIA = "alric_of_via";

void main()
{

    //--------------------------------------------------------------------------
    // Initialization
    //--------------------------------------------------------------------------

    // Load Event Variables
    event   evEvent         = GetCurrentEvent();            // Event
    int     nEventType      = GetEventType(evEvent);        // Event Type
    object  oEventCreator   = GetEventCreator(evEvent);     // Event Creator

    // Standard Variables
    object  oPc             = GetHero();
    //object  oParty          = GetParty( oPC );
    int     bEventHandled   = FALSE;

    //--------------------------------------------------------------------------
    // Area Events
    //--------------------------------------------------------------------------

    switch ( nEventType )
    {


        case EVENT_TYPE_AREALOAD_SPECIAL:
        {

            //------------------------------------------------------------------
            // EVENT_TYPE_AREALOAD_SPECIAL:
            // Sent by: The engine
            // When: it is for playing things like cutscenes and movies when
            // you enter an area, things that do not involve AI or actual
            // game play.
            //------------------------------------------------------------------
            }
              object oPc = GetHero();

            //If Alric has talked to PC and this plot is set de-activate Alric
            if (WR_SetPlotFlag (PLT_SWORD, SILVER_ACCEPT) == TRUE)
            {
                object oAlric = UT_GetNearestCreatureByTag(oPc,ALRIC_VIA);
                //DeActivate Alric
                WR_SetObjectActive(oAlric,FALSE);

            break;

        }


        case EVENT_TYPE_AREALOAD_PRELOADEXIT:
        {

            //------------------------------------------------------------------
            // EVENT_TYPE_AREALOAD_PRELOADEXIT:
            // Sent by: The engine
            // When: for things you want to happen while the load screen is
            // still up, things like moving creatures around.
            //------------------------------------------------------------------


            break;

        }


        case EVENT_TYPE_AREALOAD_POSTLOADEXIT:
        {

            //------------------------------------------------------------------
            // EVENT_TYPE_AREALOAD_POSTLOADEXIT:
            // Sent by: The engine
            // When: fires at the same time that the load screen is going away,
            // and can be used for things that you want to make sure the player
            // sees.
            //------------------------------------------------------------------

            DoAutoSave();

            break;

        }


        case EVENT_TYPE_ENTER:
        {

            //------------------------------------------------------------------
            // EVENT_TYPE_ENTER:
            // Sent by: The engine
            // When: A creature enters the area.
            //------------------------------------------------------------------

            break;

        }


        case EVENT_TYPE_EXIT:
        {

            //------------------------------------------------------------------
            // EVENT_TYPE_EXIT:
            // Sent by: The engine
            // When: A creature exits the area.
            //------------------------------------------------------------------

            break;

        }

    }

    //--------------------------------------------------------------------------
    // Pass any unhandled events to area_core
    //--------------------------------------------------------------------------

    if ( !bEventHandled )
        HandleEvent( evEvent, RESOURCE_SCRIPT_AREA_CORE );

}

#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
The error is related to your plot include file. I commented out and tried to compile (after changing a few things -see below) and it worked. I included one of my plots in its place and that also compiled.



- Change WR_SetPlotFlag to WR_GetPlotFlag (you will get an error after fixing your plot include file on this line)

- Remove the bracket before the object oPC (before the if condition) and move it to after the if statement

#3
Sonmeister

Sonmeister
  • Members
  • 167 messages
I figured out the plot include reference was wrong but the bracket and Set to Get, I didn't. So why do you go from Set to Get. I thought Get was only for defined flags and Set for Main flags?

#4
TimelordDC

TimelordDC
  • Members
  • 923 messages
Get is to get the state of a flag, main or defined. Set is to set the state of a flag.

So, any if condition should always have Get since that returns TRUE or FALSE which you will be checking.