The spell "Grease" does not appear to fire the "On Spell Cast At Script" event. Is there a way around this? I want an event to happen when grease is cast at an object. The script seems valid because it fires when other spells are cast on it.
Here is the script being used:
__________________________
/* Opens the door if grease is cast on it
*/
void main()
{
object oDoor = OBJECT_SELF;
object oPC = GetFirstPC();
int nGrease = SPELL_GREASE;
int nSpellCast = GetLastSpell();
FloatingTextStringOnCreature("worked",oPC);
if (nSpellCast = SPELL_GREASE)
{
SetLocked( oDoor, FALSE );
DelayCommand ( 0.1, AssignCommand( oDoor, ActionOpenDoor( oDoor ) ) );
ExecuteScript("2021_livestock_stampede",oDoor);
}
}
Help with firing "On Spell Cast At Script" scripts
Débuté par
M. Rieder
, déc. 02 2010 02:02
#1
Posté 02 décembre 2010 - 02:02
#2
Guest_Chaos Wielder_*
Posté 02 décembre 2010 - 02:11
Guest_Chaos Wielder_*
You could edit the grease spell itself to fire your script when it's cast on the specific object.
It's possible the script isn't firing due to the fact that grease is an AOE spell effect so it might interact differently. Just an idea, anyways. Have you tested this script with, say, fireball? I'm generally unfamiliar with that script call.
It's possible the script isn't firing due to the fact that grease is an AOE spell effect so it might interact differently. Just an idea, anyways. Have you tested this script with, say, fireball? I'm generally unfamiliar with that script call.
#3
Posté 02 décembre 2010 - 03:27
Nothing to signal the event towards a placeable, it's in the on enter script only...
This might help on the on enter, you might also add it to the on cast at ( it generally does not need that since you cast it on the ground. I am assuming all placeables will enter the AOE. I would not change how you set up your event, i would fix the signal event which triggers that. ( file name to edit is in the script.
( pastebin copy which is easy to copy/paste http://pastebin.myrror.net/2801 )
This might help on the on enter, you might also add it to the on cast at ( it generally does not need that since you cast it on the ground. I am assuming all placeables will enter the AOE. I would not change how you set up your event, i would fix the signal event which triggers that. ( file name to edit is in the script.
//::///////////////////////////////////////////////
//:: Grease: On Enter
//:: NW_S0_GreaseA.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Creatures entering the zone of grease must make
a reflex save or fall down. Those that make
their save have their movement reduced by 1/2.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Aug 1, 2001
//:://////////////////////////////////////////////
#include "X0_I0_SPELLS"
#include "x2_inc_spellhook"
void main()
{
//Declare major variables
int nMetaMagic = GetMetaMagicFeat();
effect eVis = EffectVisualEffect(VFX_IMP_SLOW);
effect eSlow = EffectMovementSpeedDecrease(50);
effect eLink = EffectLinkEffects(eVis, eSlow);
effect eHit = EffectVisualEffect(VFX_HIT_SPELL_ENCHANTMENT);
object oTarget = GetEnteringObject();
float fDelay = GetRandomDelay(1.0, 2.2);
if(spellsIsTarget(oTarget, SPELL_TARGET_STANDARDHOSTILE, GetAreaOfEffectCreator()))
{
// if(!GetHasFeat(FEAT_WOODLAND_STRIDE, oTarget) &&(GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) != TRUE) )
if( (GetCreatureFlag(OBJECT_SELF, CREATURE_VAR_IS_INCORPOREAL) != TRUE) ) // AFW-OEI 05/01/2006: Woodland Stride no longer protects from spells.
{
//Fire cast spell at event for the target
SignalEvent(oTarget, EventSpellCastAt(GetAreaOfEffectCreator(), SPELL_GREASE));
//Spell resistance check
//if(!MyResistSpell(GetAreaOfEffectCreator(), oTarget))
//{
//if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_NONE, OBJECT_SELF))
{
//Apply reduced movement effect and VFX_Impact
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHit, oTarget);
}
//}
}
}
else if ( GetObjectType( oTarget ) != OBJECT_TYPE_CREATURE )
{
SignalEvent(oTarget, EventSpellCastAt(GetAreaOfEffectCreator(), SPELL_GREASE, TRUE) );
}
}
( pastebin copy which is easy to copy/paste http://pastebin.myrror.net/2801 )
Modifié par painofdungeoneternal, 03 décembre 2010 - 01:09 .
#4
Posté 02 décembre 2010 - 03:35
Maybe I could put a trigger around the door on the floor then put the script on the "on enter" event. I wonder How I would check which spell was cast to make sure it does not happen on every spell cast?
I may have to do this through dialogue SOZ-style.
Thanks for the help, it was very enlightening.
I may have to do this through dialogue SOZ-style.
Thanks for the help, it was very enlightening.
#5
Guest_Chaos Wielder_*
Posté 02 décembre 2010 - 04:47
Guest_Chaos Wielder_*
He means the on enter script for the grease spell. AOE spells have three associated scripts: the enter of the effect, the exit of the effect and then the heartbeat(while you stand in it). So, I imagine, you'd edit the on enter portion of the grease spell to check if your placeable is in it.
To be honest, just checking via a conversation would probably be easier. And, really, since not much would be gained by doing this outside the conversation, going that route is what I'd recommend.
To be honest, just checking via a conversation would probably be easier. And, really, since not much would be gained by doing this outside the conversation, going that route is what I'd recommend.
#6
Posté 02 décembre 2010 - 05:23
I think you are right, CW.
I have one other idea. I could make a hostile creature, then make them invisible or really tiny, then put them in an area that they cannot get out of, so they cannot attack the PC, then put my script in their "on spell cast at" event. I could put this creature right next to the door, then when grease splatters the door, it hits the creature too.
Problem: If a player presses the tab or backslash, will the invisible creature show up as nearest hostile?
I have one other idea. I could make a hostile creature, then make them invisible or really tiny, then put them in an area that they cannot get out of, so they cannot attack the PC, then put my script in their "on spell cast at" event. I could put this creature right next to the door, then when grease splatters the door, it hits the creature too.
Problem: If a player presses the tab or backslash, will the invisible creature show up as nearest hostile?
#7
Guest_Chaos Wielder_*
Posté 02 décembre 2010 - 05:24
Guest_Chaos Wielder_*
Yes, you'd be able to see the creature through the tab button(or whatever button it is).
#8
Posté 02 décembre 2010 - 05:42
That's a drag. I wonder if putting the ScriptInvisible affect on them would change that.
#9
Posté 03 décembre 2010 - 12:55
ScriptHidden
#10
Posté 03 décembre 2010 - 01:06
Compile my script and use that, it should do the original problem as stated ( open door when grease is cast on it ), and in addition it's flexible as all spells really should do this event for other things on cast at events. The only issue it has as presented is OBJECT_TYPE_PLACEABLE instead of OBJECT_TYPE_DOOR is being used. Probably use != OBJECT_TYPE_CREATURE to handle whatever it's hitting since the previous code handles hostile creatures. ( will edit it to have that change. )
The other option is to make the door itself, when you try to open it, make it check to see if it's inside a grease spell AOE. Which means modding the default door on open script, or adding a custom script, and doing a more advanced script. I would just do the first method as it is solving not just this problem, but future problems as well, and if grease opens doors i'd want it doing it right away so i know it's caused by my spell.
The other option is to make the door itself, when you try to open it, make it check to see if it's inside a grease spell AOE. Which means modding the default door on open script, or adding a custom script, and doing a more advanced script. I would just do the first method as it is solving not just this problem, but future problems as well, and if grease opens doors i'd want it doing it right away so i know it's caused by my spell.
#11
Posté 04 décembre 2010 - 01:01
I've been thinking about this and chaging the grease script really seems like the best way. Thanks for the great suggestion. To implement it, I just have to modify the grease spell script and save it as the same name as the original grease spell script and make sure it is in my campaign file, right?
Modifié par M. Rieder, 04 décembre 2010 - 01:09 .
#12
Posté 04 décembre 2010 - 01:01
Kaldor Silverwand wrote...
ScriptHidden
oops! ScriptHidden. I tried it and it does not work, by the way.
#13
Guest_Chaos Wielder_*
Posté 04 décembre 2010 - 01:46
Guest_Chaos Wielder_*
M. Rieder wrote...
I've been thinking about this and chaging the grease script really seems like the best way. Thanks for the great suggestion. To implement it, I just have to modify the grease spell script and save it as the same name as the original grease spell script and make sure it is in my campaign file, right?
You could save it in the individual mod you're working on or the campaign folder. I do this all the time, actually. Editing spells for certain specific effects is very useful and, I think, relatively painless.
#14
Posté 04 décembre 2010 - 02:23
That is really good to know. I guess since it's a campaign I won't even have to put it in the hak file, right? I really appreciate the help. I plan to put alot of nonstandard use of spells in my mod and I was really starting to worry if I would be able to do it.
#15
Posté 04 décembre 2010 - 02:42
I put the modified script in my campaign it did not work initially. I decided to see if the script recognizes placeables with the GetEnteringObject() function by adding a command for oTarget, which is defined by GetEnteringObject() to SpeakString("spell worked"). Now when I cast grease in my campaign, all the creatures in the area of effect say "spell worked", but the placeables and door that I want to affect do not say anything.
#16
Posté 04 décembre 2010 - 02:57
Since the "on enter" script didn't work, I modified ns_s0_grease and added a new target defined as GetSpellTargetObject(). Using this script, I was able to get the placeables to execute the SpeakString command. Now I am putting in the command to fire the spellcastat event.
#17
Posté 04 décembre 2010 - 03:08
It worked! Thanks for the help!





Retour en haut






