Aller au contenu

Photo

Creature spawn problems on trigger (solved)


1 réponse à ce sujet

#1
Sonmeister

Sonmeister
  • Members
  • 167 messages
I'm trying to use a trigger to spawn some spiders.  I found the template below.  Compiles fine.  My spiders team is 7.  I'm wanting the spiders to appear (from the ceiling).  Instead the spiders are already there just milling around.
So, what am I missing?

I have the spiders set to inactive and neutral.

I have the TRIGGER_DO_ONCE_A variable set at a numerical value of 1 on the trigger. 

Should any other variables be set?

Do I need to set a variable on my creature (spiders)?

Should the script be attached to the area or the trigger? 











//::///////////////////////////////////////////////
//:: Trigger Events Template
//:: Copyright © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Trigger events : Activate the spider fight
*/
//:://////////////////////////////////////////////
//:: Created By:  Keith Warner
//:: Created On:  11/06/08
//:://////////////////////////////////////////////

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"

#include "ntb_constants_h"

const int TEAM_MY_CREATURE = 7;

void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);
    string sDebug;
    object oPC = GetHero();
    object oParty = GetParty(oPC);
    int nEventHandled = FALSE;

    switch(nEventType)
    {
        ////////////////////////////////////////////////////////////////////////
        // Sent by: The engine
        // When: The object spawns into the game. This can happen only once,
        //       regardless of save games.
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_SPAWN:
        {
            break;
        }
        ////////////////////////////////////////////////////////////////////////
        // Sent by: The engine
        // When: A creature enters the trigger
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_ENTER:
        {
            object oCreature = GetEventCreator(ev);
            int nOnce = GetLocalInt(OBJECT_SELF,TRIGGER_DO_ONCE_A);

            if (nOnce == FALSE)
            {
                SetLocalInt(OBJECT_SELF, TRIGGER_DO_ONCE_A, TRUE);

                //Activate the spiders
                UT_TeamAppears(TEAM_MY_CREATURE);

            }


            break;
        }
        ////////////////////////////////////////////////////////////////////////
        // Sent by: The engine
        // When: A creature exits the trigger
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_EXIT:
        {
            object oCreature = GetEventCreator(ev);

            break;
        }

    }
    if (!nEventHandled)
    {
        HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
    }
}

Modifié par Sonmeister, 15 mai 2010 - 05:31 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
"I have the TRIGGER_DO_ONCE_A variable set at a numerical value of 1 on the trigger."

So you're pre-setting that variable to 1? 1 is the same as TRUE. If you're using the script you posted, the trigger shouldn't do anything, because nOnce is not equal to FALSE, it's been pre-set to TRUE. For that type of do once, TRIGGER_DO_ONCE should be 0 by default, and only set to 1 by the script.

Modifié par DavidSims, 16 mai 2010 - 01:24 .