Aller au contenu

Photo

EVENT_TYPE_SET_GAME_MODE:


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

#1
jsd313

jsd313
  • Members
  • 184 messages
First question is does this have to run on teh module script or can it run on an area script?

I tried adding it to my area spawn/port script but it doesn't work. Probably because I have done something wrong :) Any help would be greatly appreciated.




#include "events_h"
#include "var_constants_h"
#include "wrappers_h"
void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    string sDebug;
    int nEventHandled = FALSE;
    switch(nEventType)
    {
 case EVENT_TYPE_AREALOAD_PRELOADEXIT:
     {
    object oWaypoint = GetObjectByTag("test");
    location lWaypoint = GetLocation(oWaypoint);
    object o = CreateObject(OBJECT_TYPE_CREATURE, R"paladin_test.utc", lWaypoint);
      }
    break;
       }
         switch(nEventType)
    {
  case EVENT_TYPE_SET_GAME_MODE:
        {      
            int nGameMode = GetEventInteger(ev, 0);
            if ( nGameMode == GM_DEAD )
             {
               DoAreaTransition("arena", "start");
               nEventHandled = TRUE;  
            }
    break;
        }  
       
          switch(nEventType)
    {
   case EVENT_TYPE_TEAM_DESTROYED:
         {
            DoAreaTransition("arena", "duels");
             nEventHandled = TRUE; //set this if no further action is required for this event
            
     break;
         }
          }
    if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
    {
        HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
    }
         }
}

#2
anakin5

anakin5
  • Members
  • 258 messages
EVENT_TYPE_SET_GAME_MODE is fired in module core script. This is not going to work.

Also, I doubt EVENT_TYPE_TEAM_DESTROYED is fired on area as well.

#3
jsd313

jsd313
  • Members
  • 184 messages
It does, but thanks for the game_mode, I had a feeling.

#4
jsd313

jsd313
  • Members
  • 184 messages
Yup added it to my modules script and it works great :)

#5
fluffyamoeba

fluffyamoeba
  • Members
  • 264 messages
An event is sent to an object. A module is an object (eg. GetModule() returns something of type object). The events that are listed in the default module_core script are events that are sent to the module object. That's why other objects (like an area) can't "see" those events.

#6
jsd313

jsd313
  • Members
  • 184 messages
Insightful, thank you :)