Aller au contenu

Photo

trying to figure out how to use this script


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
mhbradshaw

mhbradshaw
  • Members
  • 29 messages
//==============================================================================
/*

    This is a basic barrier script

*/
//------------------------------------------------------------------------------
// Created By: Gary Stewart
// Created On: Sept 3, 2008
//==============================================================================

#include "plt_cir300pt_shapeshifting"

#include "cir_constants_h"
#include "cir_functions_h"

#include "utility_h"

const int MAGIC_BARRIER_VFX = 5021;

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;

    //--------------------------------------------------------------------------
    // Events
    //--------------------------------------------------------------------------

    switch ( nEventType )
    {
        case EVENT_TYPE_SPAWN:
        {
            ApplyEffectVisualEffect(OBJECT_SELF, OBJECT_SELF, MAGIC_BARRIER_VFX, EFFECT_DURATION_TYPE_PERMANENT,0.0);
            break;
        }

        case EVENT_TYPE_PLACEABLE_COLLISION:
        case EVENT_TYPE_ENTER:
        case EVENT_TYPE_USE:
        {

            //------------------------------------------------------------------
            // EVENT_TYPE_USE:
            // Sent by: The engine
            // When: A creature has clicked on this placeable.
            //------------------------------------------------------------------
            //Don't allow the object to be used or entered
            bEventHandled = TRUE;
            break;
        }

        //Disable the barrier
        case EVENT_TYPE_CUSTOM_EVENT_01:
        {
            RemoveVisualEffect(OBJECT_SELF, MAGIC_BARRIER_VFX);
            DelayEvent(0.4, OBJECT_SELF, Event(EVENT_TYPE_CUSTOM_EVENT_02));
            break;
        }

        case EVENT_TYPE_CUSTOM_EVENT_02:
        {
            WR_SetObjectActive(OBJECT_SELF, FALSE, 1);
            break;
        }


    }

    //--------------------------------------------------------------------------
    // Pass any unhandled events to placeable_core
    //--------------------------------------------------------------------------

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

}


I want to use this script to create a magical barrier for my module.  But I have been trying to do that.  I created a script and had a invisible wall use it as it's script.  However in game the wall is invisible and not magical at all.  Is there a way to program this script so I can just attach it to a invisible wall and the wall will have the vfx on it?

Been trying to figure this out for days with no luck.  :crying:

#2
mhbradshaw

mhbradshaw
  • Members
  • 29 messages
Ha! I figured it out I had to edit the script to remove some things not needed.





//==============================================================================

/*



This is a basic barrier script



*/

//------------------------------------------------------------------------------

// Created By: Gary Stewart Edited by mhbradshaw 4/16/2010

// Created On: Sept 3, 2008

//==============================================================================



#include "utility_h"



const int MAGIC_BARRIER_VFX = 5021;



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;



//--------------------------------------------------------------------------

// Events

//--------------------------------------------------------------------------



switch ( nEventType )

{

case EVENT_TYPE_SPAWN:

{

ApplyEffectVisualEffect(OBJECT_SELF, OBJECT_SELF, MAGIC_BARRIER_VFX, EFFECT_DURATION_TYPE_PERMANENT,0.0);

break;

}



case EVENT_TYPE_PLACEABLE_COLLISION:

case EVENT_TYPE_ENTER:

case EVENT_TYPE_USE:

{



//------------------------------------------------------------------

// EVENT_TYPE_USE:

// Sent by: The engine

// When: A creature has clicked on this placeable.

//------------------------------------------------------------------

//Don't allow the object to be used or entered

bEventHandled = TRUE;

break;

}



}



}