Bioware Archive

Bioware Archive V2 => Builders - Scripting => Topic started by: Baaleos on August 19, 2011, 10:18:53 am

Title: Can ActionCastFakeSpell be countered?
Post by: Baaleos on August 19, 2011, 10:18:53 am


               I am working on a 'Magic District' to a city in my PW.

I want to have student mages, practicing magic.

I would like to have some mages scripted to cast fake spells at eachother, and have them counter them etc.


Is this possible?


I dont want to use real spells, on the off chance that a real spell will get through, cause damage, or cause a faction war.

Mordenkaines Disjunction is more a less the universal Counter Spell, if i make sure each mage has this spell, they should be able to counter eachother, as long as they make the dc roll/lore check.
I just dont know if Fake Spells are counterable.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Lightfoot8 on August 19, 2011, 10:30:30 am


               I have not worked wit counter spells, So i am nor sure how they work that well. 
If the fake spell is not firing the event. you can always singnal the event as if the spell was really cast.

Function - SignalEvent

Function - EventSpellCastAt
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Shadooow on August 19, 2011, 08:32:34 pm


               I think they cant but never tried actually. But got better solution: just wont let actuall spell to trigger via spellhook then ;)
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Lightfoot8 on August 19, 2011, 09:10:42 pm


               

ShaDoOoW wrote...

I think they cant but never tried actually. But got better solution: just wont let actuall spell to trigger via spellhook then ;)

 If you stop the spell from firing with a spell hook.  It still will not signal the event that the spell was cast at the target.  Therefore he still will not respond.  After all it is the impact script that singnials the event that the spell was cast at the NPC. 

  Still after a little thought instead of making sure my actors always had enough spells to cast, I think it may be better to do this with user defined events.   Just give each spell cast at them Npc a unique user defined event fo tor his reactions to the spell cast at him.  Basicly either cast a Fake spell or Real Cheat spell in responce to the incomming user defined  event.  
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Hardcore UFO on August 19, 2011, 09:59:29 pm


               I may be beside the mark but after the question what came to mind was to simly have the NPCs using VFX/actions to simulate spells, with the counterspeller delayed by 3 seconds (both NPC or sets of NPCs started by the same trigger to synchronize). Saves the trouble of putting in new entries to the spells.2da for a seldom used spell.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Pstemarie on August 19, 2011, 10:38:48 pm


               In addition to the universal counters (see the wiki), counterspelling is controlled by spells.2da. The spell line ID# listed in the Counter1 or Counter2 columns is the spell that can be used to counter that particular spell. Counterspell is a casting mode, meaning that, if I understand correctly, when a spellcaster is targeted with a spell and they have the appropriate counter available they will attempt to counter the spell cast at them.

I am not sure if ActionCastFakeSpell... fires the OnSpellCastAt Event. I would assume NOT, because the spellscript is never fired and therefore the event is never signaled. However, it does provoke attacks of opportunity.

Since counterspelling is (seems to be) powered by the OnSpellCastAt Event, if ActionCastFakeSpell...does not signal that event to fire then the counter will never be made.

Furthermore, the Counter1 and Counter2 columns in spells.2da are horrbily WRONG. The majority of appropriate counters are not listed and several spells that should not have a counter are listed as having one.
               
               

               


                     Modifié par Pstemarie, 20 août 2011 - 09:12 .
                     
                  


            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Lightfoot8 on August 19, 2011, 11:34:17 pm


               @Pstemarie; All good points. But I also have in the back of my mind that this is baaleos that is asking and there is no way of telling what he has allready added or fixed in the 2da.  Or if he has gotten counter spelling to work in other places something that I have never seen work.  But then I mormally don't play mages either. I have not in fact plaed a mage since the 2.0 rule set and that one was hybread between DnD and the ICE rule sets.     


Hardcore UFO wrote...

I may be beside the mark but after the question what came to mind was to simly have the NPCs using VFX/actions to simulate spells, with the counterspeller delayed by 3 seconds (both NPC or sets of NPCs started by the same trigger to synchronize). Saves the trouble of putting in new entries to the spells.2da for a seldom used spell.


  No one here has sugested adding new lines to the 2da file.   Also having the NPC react to the spell allows more freedon and randomness then the caster's script deciding how the NPC being cast at will respond.   Having the NPC make his own reactions would allow you to make each NPC have there own quricks as to how they handle each situation.   Here is a verry simplistic example of what Im talking about. 

When you have a NPC cast the FakeSpell at amother the code would be something like this.  code snipit to cast the spell.

...
     event eFakeSpellCastAt =EventUserDefined( SPELL_HOLD_PERSON);
   ActionCastFakeSpellAtObject(SPELL_HOLD_PERSON,oTarget);
  
SignalEvent(oTarget,eFakeSpellCastAt);
SetLocalObject(oTarget,"LAST_CASTER",OBJECT_SELF);
... 



Now when that code runs it will cause the OnUserDefined event script to run on the target npc.   So you would place a script somelike the following in that NPC OnUserDefined Event. 

void main()
{

    int    nSpelID = GetUserDefinedEventNumber();
    object oCaster= GetLocalObject(OBJECT_SELF,"LAST_CASTER");

    int oCounterSpell= StringToInt(Get2DAString("spells","Counter1", nSpelID));
    if ( oCounterSpell== 0)   oCounterSpell = SPELL_GREATER_DISPELLING;

    ActionCastFakeSpellAtObject(oCounterSpell,oCaster);
}

 

Now that is over simplistic.  but it shows the basic Idea.

Edited to remove mistake.
               
               

               


                     Modifié par Lightfoot8, 19 août 2011 - 11:26 .
                     
                  


            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Hardcore UFO on August 20, 2011, 12:02:09 am


               Stop laughing at me! I'm not a noob, I'm just... rusty. Yeah.

But if it's doable without 2da edits, all the better. I just assumed having NPCs using non-firing spells needed to be added in.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Lightfoot8 on August 20, 2011, 12:27:27 am


               Sorry for the mistake UFO.   That did not come out right at all.   Sorry Again I did not mean to offend.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Hardcore UFO on August 20, 2011, 12:38:01 am


               I'm not offended. I guess my mock-hurt didn't come out right. :P

Because really, I am a total noob.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_WhiZard on August 20, 2011, 01:11:09 am


               

Pstemarie wrote...

Firstly, Mordenkainen's Disjunction is NOT a counterspell. It is a spell with the following effects:


The dispel line of spells (including mords) are universal counters.  Each of them covers a range of spells by spell level.  Mords does all spells level 9 or less.  Greater dispelling level 6 or less.  Dispel magic 3 or less. Lesser dispel 2 or less.  These spells are taken in addition to the 2da counters.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_WhiZard on August 20, 2011, 01:50:33 am


               

Lightfoot8 wrote...

ShaDoOoW wrote...

I think they cant but never tried actually. But got better solution: just wont let actuall spell to trigger via spellhook then ;)

 If you stop the spell from firing with a spell hook.  It still will not signal the event that the spell was cast at the target.  Therefore he still will not respond.  After all it is the impact script that singnials the event that the spell was cast at the NPC. 


Given that counterspell interferes with the casting animation,  the signal event will not fire anyways, as the script is blocked.  Counterspelling has nothing to do with impact it has to do with when the targeted creature is trying to cast any spell (even defensive on himself).
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Pstemarie on August 20, 2011, 01:51:03 am


               

WhiZard wrote...

Pstemarie wrote...

Firstly, Mordenkainen's Disjunction is NOT a counterspell. It is a spell with the following effects:


The dispel line of spells (including mords) are universal counters.  Each of them covers a range of spells by spell level.  Mords does all spells level 9 or less.  Greater dispelling level 6 or less.  Dispel magic 3 or less. Lesser dispel 2 or less.  These spells are taken in addition to the 2da counters.


I stand corrected - should have checked the wiki instead of going off memory - ammended my original post. However, I stand behind the remainder of my response.
               
               

               


                     Modifié par Pstemarie, 20 août 2011 - 12:54 .
                     
                  


            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_WhiZard on August 20, 2011, 02:06:08 am


               

Pstemarie wrote...
Since counterspelling is powered by the OnSpellCastAt Event, if ActionCastFakeSpell...does not signal that event to fire then the counter will never be made.


Not powered by OnSpellCastAt event.  Though I have just tested and fake spells cannot be countered, though ShadOoOw does seem to have the correct solution, if mimicking counterspells is what is being attempted.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Lightfoot8 on August 20, 2011, 02:56:14 am


               Well, Guess that teaches me for meddleing in the affairs of wizards.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Pstemarie on August 20, 2011, 10:11:21 am


               

WhiZard wrote...

Pstemarie wrote...
Since counterspelling is powered by the OnSpellCastAt Event, if ActionCastFakeSpell...does not signal that event to fire then the counter will never be made.


Not powered by OnSpellCastAt event.  Though I have just tested and fake spells cannot be countered, though ShadOoOw does seem to have the correct solution, if mimicking counterspells is what is being attempted.


I wonder what triggers it then. I had assumed it was the OnSpellCastAtEvent - something hard-coded, but I if I understand correctly what I've read in the Lexicon and wiki, that event is triggered only from the SignalEvent function? Now I'm really confused Image IPB
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_WhiZard on August 20, 2011, 04:05:59 pm


               

Pstemarie wrote...

WhiZard wrote...

Pstemarie wrote...
Since counterspelling is powered by the OnSpellCastAt Event, if ActionCastFakeSpell...does not signal that event to fire then the counter will never be made.


Not powered by OnSpellCastAt event.  Though I have just tested and fake spells cannot be countered, though ShadOoOw does seem to have the correct solution, if mimicking counterspells is what is being attempted.


I wonder what triggers it then. I had assumed it was the OnSpellCastAtEvent - something hard-coded, but I if I understand correctly what I've read in the Lexicon and wiki, that event is triggered only from the SignalEvent function? Now I'm really confused Image IPB

Likely whatever triggers the casting animation, also triggers the counterspell casting animations and the actual counterspell.
               
               

               


                     Modifié par WhiZard, 20 août 2011 - 03:06 .
                     
                  


            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_ffbj on August 22, 2011, 03:40:00 am


               Why not just make them immune to everything and then they can cast real spells at each-other, and counter-spells but never get hurt. Like make them immune to all spells below a certain level and then just give them spells just below that level.  Cheesy and easy, but that would be my approach.So like just give them all amulets that make them immune to spells below a certain level, and just make sure they don't have any spells above that level.  Seems simple enough.
               
               

               


                     Modifié par ffbj, 22 août 2011 - 02:47 .
                     
                  


            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_WhiZard on August 22, 2011, 07:33:20 pm


               

ffbj wrote...

Why not just make them immune to everything and then they can cast real spells at each-other, and counter-spells but never get hurt. Like make them immune to all spells below a certain level and then just give them spells just below that level.  Cheesy and easy, but that would be my approach.So like just give them all amulets that make them immune to spells below a certain level, and just make sure they don't have any spells above that level.  Seems simple enough.


But a few, like grease and darkness can get through.  Protection from spells only works in so far as a spell resistance check is made and used to resist all effects.

But I would like more feedback from the OP insofar as how close to the automatic counterspelling does he/she wish to be.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_ffbj on August 23, 2011, 01:56:45 am


               If you have immunity to all spells below a certain level would they still affect you?  It's not spell resistance it's no effect from spells below a certain level.  At least that would be my understanding.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_WhiZard on August 25, 2011, 11:40:47 pm


               

ffbj wrote...

If you have immunity to all spells below a certain level would they still affect you?  It's not spell resistance it's no effect from spells below a certain level.  At least that would be my understanding.


Spell Immunity is only called by the ResistSpell() command.
               
               

               
            
Title: Can ActionCastFakeSpell be countered?
Post by: Legacy_Shadooow on August 26, 2011, 11:52:59 am


               

Pstemarie wrote...

WhiZard wrote...

Pstemarie wrote...
Since counterspelling is powered by the OnSpellCastAt Event, if ActionCastFakeSpell...does not signal that event to fire then the counter will never be made.


Not powered by OnSpellCastAt event.  Though I have just tested and fake spells cannot be countered, though ShadOoOw does seem to have the correct solution, if mimicking counterspells is what is being attempted.


I wonder what triggers it then. I had assumed it was the OnSpellCastAtEvent - something hard-coded, but I if I understand correctly what I've read in the Lexicon and wiki, that event is triggered only from the SignalEvent function? Now I'm really confused Image IPB

Yea. WhiZard explained it correctly. SignalEvent has no effect on counterspelling which is completely hardcoded and cannot be altered without nwnx. Only SignalEvent effects are - making initiative check and strip invisibility/GS in case of hostile spell and triggering monsters AI/custom OnSpellCastAt script.