/// <summary>
        /// Obtain a CGameEffect wrapper for an NWEffect instance.
        /// </summary>
        /// <param name="EffectInstance">Supplies the instance to wrap.</param>
        public GameEffect(NWEffect EffectInstance)
        {
            this.EffectInstance = EffectInstance;
            this.CGameEffectInstance = GetGameEffectInstance(EffectInstance);

            ReadGameEffectFields();
        }
        /// <summary>
        /// Obtain a function that can be used to read the m_EngineStructure
        /// field out of a NWScriptEngineStructure.  A dynamically emitted
        /// method is required as the necessary operations cannot be expressed
        /// in C# but must be implemented instead in raw MSIL.
        /// </summary>
        /// <param name="Effect">Supplies a template NWEffect object to obtain
        /// type information from.</param>
        /// <returns>The method delegate to invoke.</returns>
        private static GetEngineStructurePtrDelegate ObtainGetEngineStructurePtr(NWEffect Effect)
        {
            if (GetEngineStructurePtr != null)
            {
                return(GetEngineStructurePtr);
            }

            //
            // Traverse the NWNScriptJITIntrinsics wrapper and obtain the
            // internal mixed mode NWScriptEngineStructure type.  This type
            // contains a pointer to the native C++ object chain that may be
            // traversed to obtain the underlying CGameEffect.
            //
            // N.B.  Accessing a native pointer type located on a type in a
            //       non-directly-referenceable assembly cannot be performed
            //       via conventional language-accessible methods or via
            //       reflection.  Instead, MSIL code must be generated to
            //       perform the requisite field access and cast to IntPtr.
            //

            Type          NWEngineStructureType   = Effect.m_EngineStructure.GetType();
            FieldInfo     EngineStructurePtrField = NWEngineStructureType.GetField("m_EngineStructure", BindingFlags.Public | BindingFlags.Instance);
            DynamicMethod Method = new DynamicMethod("GetEngineStructurePtr", typeof(IntPtr), new Type[] { typeof(object) }, NWEngineStructureType, true);
            ILGenerator   ILGen  = Method.GetILGenerator();

            ILGen.Emit(OpCodes.Ldarg_0);
            ILGen.Emit(OpCodes.Castclass, NWEngineStructureType);
            ILGen.Emit(OpCodes.Ldfld, EngineStructurePtrField);
            ILGen.Emit(OpCodes.Ret);

            GetEngineStructurePtr = (GetEngineStructurePtrDelegate)Method.CreateDelegate(typeof(GetEngineStructurePtrDelegate));

            return(GetEngineStructurePtr);
        }
        /// <summary>
        /// Obtain the internal CGameEffect object for this NWEffect instance.
        /// </summary>
        /// <param name="Effect">Supplies the effect instance to obtain the
        /// internal instance pointer for.</param>
        /// <returns></returns>
        private static IntPtr GetGameEffectInstance(NWEffect Effect)
        {
            //
            // Obtain the SharedPtr<EngineStructure> pointer from the NWEffect
            // wrapper (and underlying NWScriptEngineStructure).
            //

            IntPtr EngineStructurePtr = (IntPtr)ObtainGetEngineStructurePtr(Effect)(Effect.m_EngineStructure);

            //
            // Read SharedPtr<EngineStructure>.T, obtaining the
            // NWScript Accelerator's EngineStructureBridge pointer.
            //

            IntPtr EngineStructureBridgePtr = (IntPtr)Marshal.ReadIntPtr(EngineStructurePtr, Marshal.SizeOf(typeof(IntPtr)));

            //
            // Read EngineStructureBridge.m_Representation, obtaining the
            // CGameEffect instance.
            //
            // void * __VFN_table;
            // int m_EngineStructureType;
            // CNWVirtualMachineCmdImplementer * m_CmdImplementer;
            // void * m_Representation;
            //

            IntPtr GameEffectInstance = (IntPtr)Marshal.ReadIntPtr(EngineStructureBridgePtr, Marshal.SizeOf(typeof(IntPtr)) + sizeof(int) + Marshal.SizeOf(typeof(IntPtr)));

            return(GameEffectInstance);
        }
        /// <summary>
        /// Obtain a CGameEffect wrapper for an NWEffect instance.
        /// </summary>
        /// <param name="EffectInstance">Supplies the instance to wrap.</param>
        public GameEffect(NWEffect EffectInstance)
        {
            this.EffectInstance      = EffectInstance;
            this.CGameEffectInstance = GetGameEffectInstance(EffectInstance);

            ReadGameEffectFields();
        }
        /// <summary>
        /// Obtain the internal CGameEffect object for this NWEffect instance.
        /// </summary>
        /// <param name="Effect">Supplies the effect instance to obtain the
        /// internal instance pointer for.</param>
        /// <returns></returns>
        private static IntPtr GetGameEffectInstance(NWEffect Effect)
        {
            //
            // Obtain the SharedPtr<EngineStructure> pointer from the NWEffect
            // wrapper (and underlying NWScriptEngineStructure).
            //

            IntPtr EngineStructurePtr = (IntPtr)ObtainGetEngineStructurePtr(Effect)(Effect.m_EngineStructure);

            //
            // Read SharedPtr<EngineStructure>.T, obtaining the
            // NWScript Accelerator's EngineStructureBridge pointer.
            //

            IntPtr EngineStructureBridgePtr = (IntPtr)Marshal.ReadIntPtr(EngineStructurePtr, Marshal.SizeOf(typeof(IntPtr)));

            //
            // Read EngineStructureBridge.m_Representation, obtaining the
            // CGameEffect instance.
            //
            // void * __VFN_table;
            // int m_EngineStructureType;
            // CNWVirtualMachineCmdImplementer * m_CmdImplementer;
            // void * m_Representation;
            //

            IntPtr GameEffectInstance = (IntPtr)Marshal.ReadIntPtr(EngineStructureBridgePtr, Marshal.SizeOf(typeof(IntPtr)) + sizeof(int) + Marshal.SizeOf(typeof(IntPtr)));

            return GameEffectInstance;
        }
예제 #6
0
        private static void HandleTrapDetected(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint detector)
        {
            trap.Detected = true;

            NWEffect vfx = s.SupernaturalEffect(s.EffectNWN2SpecialEffectFile(trap.TrapTriggerVFX, OBJECT_INVALID, s.Vector(0.0f, 0.0f, 0.0f)));

            s.ApplyEffectToObject(DURATION_TYPE_PERMANENT, vfx, s.GetObjectByTag(trap.Tag, 0), 0.0f);

            uint detectWidget = s.CreateObject(OBJECT_TYPE_PLACEABLE, "acr_trap_disarm", s.GetLocation(detector), TRUE, trap.Tag + "_");

            if (!String.IsNullOrEmpty(trap.Description))
            {
                s.SetDescription(detectWidget, trap.Description);
            }
            s.SetFirstName(detectWidget, String.Format("Disarm the {0} trap", trap.SpellTrap ? "Spell" : "Mechanical"));

            // If they clicked to walk, let's stop them from walking into the hazard they just found.
            if (s.GetCurrentAction(detector) == ACTION_MOVETOPOINT)
            {
                s.AssignCommand(detector, delegate { s.ClearAllActions(0); });
            }
            s.PlaySound("alert", FALSE);
            s.ApplyEffectToObject(DURATION_TYPE_TEMPORARY, s.SupernaturalEffect(s.EffectNWN2SpecialEffectFile("fx_bang", detector, s.Vector(0.0f, 0.0f, 0.0f))), detector, 6.0f);
            s.SendMessageToPC(detector, "You spot a trap!");
        }
예제 #7
0
        public Int32 ScriptMain([In] object[] ScriptParameters, [In] Int32 DefaultReturnCode)
        {
            string ServerDescription;
            string Message;

            NWEffect e = EffectNWN2SpecialEffectFile("TESTFILE", OBJECT_SELF, GetPosition(OBJECT_SELF));

            SendMessageToPC(OBJECT_SELF, "Effect type was: " + new ALFA.GameEffect(e).EffectType);

            Database.ACR_SQLQuery(String.Format("SELECT Name FROM servers WHERE ID = {0}", Database.ACR_GetServerID()));

            if (Database.ACR_SQLFetch())
            {
                ServerDescription = Database.ACR_SQLGetData();
            }
            else
            {
                ServerDescription = "<Database error>";
            }

            Message = String.Format("This server (id {0}) is at {1} and is named {2}", Database.ACR_GetServerID(), Database.ACR_GetServerAddressFromDatabase(), ServerDescription);

            foreach (uint PCObject in GetPlayers(true))
            {
                SendMessageToPC(PCObject, Message);
                SendMessageToPC(PCObject, "Install directory: " + SystemInfo.GetGameInstallationDirectory());
                SendMessageToPC(PCObject, "Home directory: " + SystemInfo.GetHomeDirectory());
                SendMessageToPC(PCObject, "NWNX4 directory: " + SystemInfo.GetNWNX4InstallationDirectory());

                if (SystemInfo.GetModuleResourceName() != null)
                {
                    SendMessageToPC(PCObject, "Module resource name: " + SystemInfo.GetModuleResourceName());
                }
            }

            string ModName = SystemInfo.GetModuleResourceName();

            if (ModName == null)
            {
                ModName = "alfa";
            }

/*
 *          ResourceManager ResMan = new ResourceManager(ModName);
 *
 *          foreach (OEIShared.IO.IResourceEntry ResEntry in ResMan.GetResourcesByType(ResourceManager.ResUTI))
 *          {
 *              foreach (uint PCObject in GetPlayers(true))
 *              {
 *                  SendMessageToPC(PCObject, String.Format("Found resource {0} in repository {1}", ResEntry.FullName, ResEntry.Repository.Name));
 *              }
 *          }
 */

            return(DefaultReturnCode);
        }
 public Int32 GetEffectInteger(NWEffect eTest, Int32 nIdx)
 {
     return ScriptHost.ExecuteActionService_892_2_GetEffectInteger(eTest, nIdx);
 }
 public NWEffect VersusRacialTypeEffect(NWEffect eEffect, Int32 nRacialType)
 {
     return ScriptHost.ExecuteActionService_356_2_VersusRacialTypeEffect(eEffect, nRacialType);
 }
 public NWEffect VersusTrapEffect(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_357_1_VersusTrapEffect(eEffect);
 }
 public Int32 GetEffectType(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_170_1_GetEffectType(eEffect);
 }
        /// <summary>
        /// Obtain a function that can be used to read the m_EngineStructure
        /// field out of a NWScriptEngineStructure.  A dynamically emitted
        /// method is required as the necessary operations cannot be expressed
        /// in C# but must be implemented instead in raw MSIL.
        /// </summary>
        /// <param name="Effect">Supplies a template NWEffect object to obtain
        /// type information from.</param>
        /// <returns>The method delegate to invoke.</returns>
        private static GetEngineStructurePtrDelegate ObtainGetEngineStructurePtr(NWEffect Effect)
        {
            if (GetEngineStructurePtr != null)
                return GetEngineStructurePtr;

            //
            // Traverse the NWNScriptJITIntrinsics wrapper and obtain the
            // internal mixed mode NWScriptEngineStructure type.  This type
            // contains a pointer to the native C++ object chain that may be
            // traversed to obtain the underlying CGameEffect.
            //
            // N.B.  Accessing a native pointer type located on a type in a
            //       non-directly-referenceable assembly cannot be performed
            //       via conventional language-accessible methods or via
            //       reflection.  Instead, MSIL code must be generated to
            //       perform the requisite field access and cast to IntPtr.
            //

            Type NWEngineStructureType = Effect.m_EngineStructure.GetType();
            FieldInfo EngineStructurePtrField = NWEngineStructureType.GetField("m_EngineStructure", BindingFlags.Public | BindingFlags.Instance);
            DynamicMethod Method = new DynamicMethod("GetEngineStructurePtr", typeof(IntPtr), new Type[] { typeof(object) }, NWEngineStructureType, true);
            ILGenerator ILGen = Method.GetILGenerator();

            ILGen.Emit(OpCodes.Ldarg_0);
            ILGen.Emit(OpCodes.Castclass, NWEngineStructureType);
            ILGen.Emit(OpCodes.Ldfld, EngineStructurePtrField);
            ILGen.Emit(OpCodes.Ret);

            GetEngineStructurePtr = (GetEngineStructurePtrDelegate)Method.CreateDelegate(typeof(GetEngineStructurePtrDelegate));

            return GetEngineStructurePtr;
        }
 public NWEffect SupernaturalEffect(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_113_1_SupernaturalEffect(eEffect);
 }
 public UInt32 GetEffectCreator(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_91_1_GetEffectCreator(eEffect);
 }
 public Int32 GetIsEffectValid(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_88_1_GetIsEffectValid(eEffect);
 }
 public NWEffect SetEffectSpellId(NWEffect eTest, Int32 nSpellId)
 {
     return ScriptHost.ExecuteActionService_894_2_SetEffectSpellId(eTest, nSpellId);
 }
        private static NWEffect GetTrapEffect(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint target)
        {
            int damage = 0;

            for (int count = 0; count < trap.DiceNumber; count++)
            {
                damage += s.Random(trap.DiceType) + 1;
            }
            if (trap.SaveDC > -1)
            {
                if (s.ReflexSave(target, trap.SaveDC, SAVING_THROW_TYPE_TRAP, s.GetObjectByTag(trap.Tag, 0)) != TRUE)
                {
                    if (s.GetHasFeat(FEAT_IMPROVED_EVASION, target, TRUE) == TRUE)
                    {
                        damage /= 2;
                    }
                }
                else
                {
                    if (s.GetHasFeat(FEAT_EVASION, target, TRUE) == TRUE)
                    {
                        damage = 0;
                    }
                    else
                    {
                        damage /= 2;
                    }
                }
            }
            else
            {
                int    roll      = new Random().Next(20) + 1;
                int    final     = roll + trap.AttackBonus;
                string hitormiss = " *hit* ";
                if (final < s.GetAC(target, FALSE) && roll != 20)
                {
                    hitormiss = " *miss* ";
                    damage    = 0;
                }
                s.SendMessageToPC(target, "<C=DarkViolet>Trap</C><C=DarkOrange> attacks " + s.GetName(target) + ":" + hitormiss + ": " + roll + " + " + trap.AttackBonus + " = " + final);
            }

            NWEffect eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);

            List <int> damageTypes = new List <int>();

            if ((trap.DamageType & DAMAGE_TYPE_ACID) == DAMAGE_TYPE_ACID)
            {
                damageTypes.Add(DAMAGE_TYPE_ACID);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_ACID, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_BLUDGEONING) == DAMAGE_TYPE_BLUDGEONING)
            {
                damageTypes.Add(DAMAGE_TYPE_BLUDGEONING);
                eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_COLD) == DAMAGE_TYPE_COLD)
            {
                damageTypes.Add(DAMAGE_TYPE_COLD);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_FROST, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_DIVINE) == DAMAGE_TYPE_DIVINE)
            {
                damageTypes.Add(DAMAGE_TYPE_DIVINE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_ELECTRICAL) == DAMAGE_TYPE_ELECTRICAL)
            {
                damageTypes.Add(DAMAGE_TYPE_ELECTRICAL);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_ELECTRICAL, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_FIRE) == DAMAGE_TYPE_FIRE)
            {
                damageTypes.Add(DAMAGE_TYPE_FIRE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_FIRE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_MAGICAL) == DAMAGE_TYPE_MAGICAL)
            {
                damageTypes.Add(DAMAGE_TYPE_MAGICAL);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_NEGATIVE) == DAMAGE_TYPE_NEGATIVE)
            {
                damageTypes.Add(DAMAGE_TYPE_NEGATIVE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_NEGATIVE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_PIERCING) == DAMAGE_TYPE_PIERCING)
            {
                damageTypes.Add(DAMAGE_TYPE_PIERCING);
                eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_POSITIVE) == DAMAGE_TYPE_POSITIVE)
            {
                damageTypes.Add(DAMAGE_TYPE_POSITIVE);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_DIVINE, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_SLASHING) == DAMAGE_TYPE_SLASHING)
            {
                damageTypes.Add(DAMAGE_TYPE_SLASHING);
                eVis = s.EffectVisualEffect(VFX_COM_BLOOD_CRT_RED, FALSE);
            }
            if ((trap.DamageType & DAMAGE_TYPE_SONIC) == DAMAGE_TYPE_SONIC)
            {
                damageTypes.Add(DAMAGE_TYPE_SONIC);
                eVis = s.EffectVisualEffect(VFX_COM_HIT_SONIC, FALSE);
            }

            if (damage == 0)
            {
                return(eVis);
            }

            NWEffect eDam = eVis;

            damage /= damageTypes.Count;
            if (damage < 1)
            {
                damage = 1;
            }
            foreach (int dmgType in damageTypes)
            {
                eDam = s.EffectLinkEffects(eDam, s.EffectDamage(damage, dmgType, DAMAGE_POWER_NORMAL, FALSE));
            }

            return(eDam);
        }
 public void RemoveEffect(UInt32 oCreature, NWEffect eEffect)
 {
     ScriptHost.ExecuteActionService_87_2_RemoveEffect(oCreature, eEffect);
 }
 public NWEffect EffectLinkEffects(NWEffect eChildEffect, NWEffect eParentEffect)
 {
     return ScriptHost.ExecuteActionService_199_2_EffectLinkEffects(eChildEffect, eParentEffect);
 }
 public Int32 GetEffectDurationType(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_89_1_GetEffectDurationType(eEffect);
 }
 public void ApplyEffectAtLocation(Int32 nDurationType, NWEffect eEffect, NWLocation lLocation, float fDuration)
 {
     ScriptHost.ExecuteActionService_216_4_ApplyEffectAtLocation(nDurationType, eEffect, lLocation, (Single)fDuration);
 }
 public NWEffect MagicalEffect(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_112_1_MagicalEffect(eEffect);
 }
 public void ApplyEffectToObject(Int32 nDurationType, NWEffect eEffect, UInt32 oTarget, float fDuration)
 {
     ScriptHost.ExecuteActionService_220_4_ApplyEffectToObject(nDurationType, eEffect, oTarget, (Single)fDuration);
 }
 public NWEffect ExtraordinaryEffect(NWEffect eEffect)
 {
     return ScriptHost.ExecuteActionService_114_1_ExtraordinaryEffect(eEffect);
 }
 public Int32 GetEffectSpellId(NWEffect eSpellEffect)
 {
     return ScriptHost.ExecuteActionService_305_1_GetEffectSpellId(eSpellEffect);
 }
 public NWEffect VersusAlignmentEffect(NWEffect eEffect, Int32 nLawChaos, Int32 nGoodEvil)
 {
     return ScriptHost.ExecuteActionService_355_3_VersusAlignmentEffect(eEffect, nLawChaos, nGoodEvil);
 }
        private void PopulateArea(CLRScriptBase script)
        {
            List <Vector3> trapsToSpawn = new List <Vector3>();

            if (!DungeonStore.DungeonSpawns.ContainsKey(SpawnType))
            {
                return;
            }
            foreach (uint wp in script.GetObjectsInArea(AreaId))
            {
                if (script.GetTag(wp) == "MONSTER_LOW")
                {
                    if (DungeonStore.DungeonSpawns[SpawnType].ContainsKey(CR / 3))
                    {
                        script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, DungeonStore.DungeonSpawns[SpawnType][CR / 3][rand.Next(DungeonStore.DungeonSpawns[SpawnType][CR / 3].Count)], script.GetLocation(wp), CLRScriptBase.TRUE, "");
                    }
                }
                else if (script.GetTag(wp) == "MONSTER_MED")
                {
                    if (DungeonStore.DungeonSpawns[SpawnType].ContainsKey(CR / 2))
                    {
                        script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, DungeonStore.DungeonSpawns[SpawnType][CR / 2][rand.Next(DungeonStore.DungeonSpawns[SpawnType][CR / 2].Count)], script.GetLocation(wp), CLRScriptBase.TRUE, "");
                    }
                }
                else if (script.GetTag(wp) == "MONSTER_HIGH")
                {
                    if (DungeonStore.DungeonSpawns[SpawnType].ContainsKey(CR))
                    {
                        script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, DungeonStore.DungeonSpawns[SpawnType][CR][rand.Next(DungeonStore.DungeonSpawns[SpawnType][CR].Count)], script.GetLocation(wp), CLRScriptBase.TRUE, "");
                    }
                    if (!questSpawned)
                    {
                        questSpawned = true;
                        NWEffect AoE = script.EffectAreaOfEffect(86, "acf_trg_onenter", "acf_trg_onheartbeat", "acf_trg_onexit", "AOE" + Quest);
                        script.ApplyEffectAtLocation(CLRScriptBase.DURATION_TYPE_PERMANENT, script.SupernaturalEffect(AoE), script.GetLocation(wp), 0.0f);
                        uint spawnedAoE = script.GetObjectByTag("AOE" + Quest, 0);
                        script.SetLocalString(spawnedAoE, "ACR_QST_NAME", Quest);
                        script.SetLocalInt(spawnedAoE, "ACR_QST_LOWER_STATE", 1);
                        script.SetLocalInt(spawnedAoE, "ACR_QST_UPPER_STATE", 2);
                        script.SetLocalString(spawnedAoE, "ACR_QST_MESSAGE", "This appears to be the end of the dungeon, and your path here is scouted.");
                    }
                }
                else if (script.GetTag(wp) == "TRAP")
                {
                    if (DungeonStore.DungeonTraps[TrapType].ContainsKey(CR))
                    {
                        trapsToSpawn.Add(script.GetPosition(wp));
                    }
                }
            }
            foreach (Vector3 trap in trapsToSpawn)
            {
                script.ClearScriptParams();
                script.AddScriptParameterInt(1);
                script.AddScriptParameterFloat(trap.x);
                script.AddScriptParameterFloat(trap.y);
                script.AddScriptParameterFloat(trap.z);
                script.AddScriptParameterObject(AreaId);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterFloat(-1.0f);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterObject(CLRScriptBase.OBJECT_INVALID);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterInt(-1);
                script.AddScriptParameterString(DungeonStore.DungeonTraps[TrapType][CR][rand.Next(DungeonStore.DungeonTraps[TrapType][CR].Count)]);
                script.ExecuteScriptEnhanced("ACR_Traps", script.GetModule(), CLRScriptBase.FALSE);
            }
        }