Aller au contenu

Photo

Spell Hooking Questions


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
Dann-J

Dann-J
  • Members
  • 3 161 messages
I'm surprised there isn't a general 'sticky' thread for spell hooking (there's one for walkpoints), but in it's absence I'll start a new one.

I've been able to follow Lilac Soul's spell hooking tutorial, but I have an additional question: is there a way to short-circuit the spell visual effect as well as the spell's impact script?
 
I've been able to implement a very simple form of wild magic, but it looks strange when you can still see the fireball or ice storm projectile and impact effects even though they're supposed to have fizzled, or backfired on the caster.

#2
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
You do it in script like they did it in NWN1. ( I did this for my CSL library version of the spells ) Remove the VFX from spells.2da in the impact column and move it into the script itself. And yes to do this means redoing all the spell scripts and it's a big project.

You probably will want to look at what i've done, as you kind of need a lot of higher level systems to do wild magic. ( spell casting framework is an older system which i've managed to integrate its functionality from, but i've not finished implementing and testing the various wild magic features from the wild magic content on the vault - got a good chunk of the ground work in place but i just have not had time to review it all and get it up to the quality level i require before using it. Mostly i've got the final effects working like changing the players sex, random element subbing, size changing, target changing, even the rags, but not really wrapped it into the full wild magic system which makes both wild mages and wild areas. )

( if you cast a fireball, the damage type lets say is random, and the AOE size, my code will do a visual based on the size category and element type, so a caster might do a sonic ball which is colossal in size, or a acid ball which is tiny in size - all of which is run via spell hook code, and allows on the fly adjustments to spells based on environment, wildmagic, etc just by setting variables on the caster. )

( last release is from august and was testing getting my content working in SP as follows with kaldor's OC override, the latest kaedrins at that time, and quite a few other things also integrated. )

Goes in "My Docs/Neverwinter Nights 2/"
http://dl.dropbox.co...g4th/dialog.TLK

Goes in "My Docs/Neverwinter Nights 2/Campaign/"
http://dl.dropbox.co... 2 Campaign.zip ( kaldors, place in player campaign folder as is, events have comments so i can see when they are firing )

Goes in "My Docs/Neverwinter Nights 2/Override/"
http://dl.dropbox.co...upportFiles.zip
http://dl.dropbox.co.../CSLScripts.zip
http://dl.dropbox.co...g4th/CSL2da.zip
http://dl.dropbox.co...th/CSLIcons.zip
http://dl.dropbox.co...LAppearance.zip ( same as hak )
http://dl.dropbox.co...4th/CSLGear.zip ( same as hak )
http://dl.dropbox.co...SLRofModels.zip ( same as hak )
http://dl.dropbox.co...th/CSLRofUI.zip ( same as hak )
http://dl.dropbox.co...4th/CSLSefs.zip ( same as hak )
http://dl.dropbox.co...omeOfBattle.zip ( same as hak )

( the same as hak ones are from pains monster pack, just packaged up as a folder for the OC )

Modifié par painofdungeoneternal, 27 février 2012 - 05:28 .


#3
Artemis Absinthe

Artemis Absinthe
  • Members
  • 59 messages
DannJ, something like this ? -> nwvault.ign.com/View.php

Modifié par Artemis Absinthe, 27 février 2012 - 03:44 .


#4
luna_hawke

luna_hawke
  • Members
  • 88 messages
DannJ, I think if you just have the spell hook cancel the spell for a particular spell, it will not show the vfx or run the impact script.

I think it's these two function in a spell hook that do it (pasted below).

Otherwise, ye following the wild magic example seems like a place to look even though that might be a really complex example.

                //Call this in a spell hook to cancel the spell
                ClearAllActions();
                SetModuleOverrideSpellScriptFinished(); return;


#5
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
It requires moving vfx from the impact column of spells.2da to the spell script itself. It does the vfx prior to the script runnng if it's in the 2da, and what you have to do is trigger the visuals via script instead. ( I already implemented all this, no other way to do it. )

The wild magic example is complex because there is no other way to do it. It was based on the spell casting framework as well ( which was an amazing project in it's day ). You need to have the ability to use a spell hook to completely change what a spell does to have wild magic work right. This means recompiling all the spells completely, and bypassing quite a few "features" of the engine, so you really must have a "framework" of some sort that bypasses the vanilla functions.

#6
The Fred

The Fred
  • Members
  • 2 516 messages
Spellhooking is supposed to alleviate the need for such a framework (well, it *is* such a framework) but unfortunately there are one or two issues with it. Still very powerful, but you just have to realise that you're essentially hooking into the impact script rather than the actual casting.

#7
luna_hawke

luna_hawke
  • Members
  • 88 messages
I might be wrong about this pain, but I thought in my case when I cancelled the spell in the spell hook, there was no vfx.
You still go through the animation and sound of casting the spell, but nothing else happened.

It was a few months ago I was messing with this, so I can't remember for sure.

#8
Dann-J

Dann-J
  • Members
  • 3 161 messages
Thanks for the replies. I've been experimenting a bit further, and it seems that spell hooking cancels the projectile VFX for some spells but not others. I suppose it depends on whether the spell impact script waits for a projectile VFX to land before firing (such as fireball or ice storm), or whether the effect on the target is instant (such as those that use beam effects). Or it could be AOE verses individual targetting that makes the difference.

Since I'm only using wild magic in one relatively small area, I don't fancy having to recompile every spell script. I've decided to change what I want to suit what can most easily be done. I initially wanted the following possibilities:

* Spell fizzles with a warning
* Spell fizzles with a backlash against the caster
* Spell casts normally
* Spell casts normally with a backlash against the caster
* Spell casts, but the results are random

Instead, I've decided to have the area impose 25% spell failure, and do away with the fails/backlash option. Then the spell hook script randomly chooses between normal casting, casting with a backlash, and casting with random results.

I don't suppose there's any way to hook into the spell failure message? It'd be great if it was a recognised event, so I could include a fizzle effect on the caster and send a message to the player other than the standard one. I half expect that spell failure is hard-coded though (things usually are when I want to change them).

#9
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
There is a visual - even if there is no impact script... The spell hook is actually in the head of the actual spells impact script.

Only on those that have anything in the impact column though, not every spell does as there really is no need to do the visual in the 2da. The spells.2da stuff fires prior to the scripting layer, so if it's there, it cannot be stopped and actually is happening right before the spell hook is triggered. You need to review the impact effect column ( whatever it's specific name is ), and then test this with a spell which you know has an effect there.

The spell hook is a scripting feature basically invented by end users, and then used by the NWN1 devs without a lot of changes -- it's a great idea really, but it does not actually work with the engine and could have been implemented exactly as it is now even if no one had yet ever thought of it.

The ones where it's working are actually doing the visual in the spells .nss file - there are functions that use the current row in spells.2da to describe the projectile. I had players doing ice storm in town ( i think it was that one ) and complaining about it doing no damage, when i was completely blocking it via spell hook, or that it could not be blocked ( since they saw the visual they thought it was firing when it wasn't ).

( i have done extensive work related to this and got a lot of user feedback as well, and specifically to allowing the visual to vary based on damage type, or just blocking spells - i tried to make it so my work actually allows other developers to really leverage the spell hook to implement features instead of having to recompile all spell scripts. )

If you zap the impact column, change all the lines to ****, and put in whatever was there as a visual effect at the spell target location ( again examples are in the links i posted ), you just have to recompile the ones which don't have **** in the impact column.

Modifié par painofdungeoneternal, 27 février 2012 - 09:53 .