Question 1:
I'm kind of noob at scripting, but I'm trying. I'm working on a few scripts to alter the function of a few spells. At this point, what those spells are doesn't matter. I looked at the tutorial written by Lilac, and was able to get a script to function through spell hooking for the PC. However, how do you get it to work for NPCs, too? I saw at the bottom of the that tutorial that "X2_L_WILD_MAGIC =1 " should be set on areas in which you want the script to affect NPC's spells too, but this did not have any effect when I placed that variable in the module's Area. I realize that tutorial was written for NWN1 and I'm wondering if the procedure is different from NWN2? Sorry that the question is so elementary, but I would appreciate any assistance. I also apologize if this has already been addressed here and I missed it in a previous thread.
Question 2: When you create an entirely new spell, how do you introduce it to the module, as a spell? I hope that question makes sense. For instance, let's say I wanted to rewrite magic missile such that it did not stop creating missiles at level 9, and I altered it to level 15 or some such, recompiled it, etc. How do I introduce it to the module so that players and NPCs would access that script for the magic missile spell? Although this particular variation on a spell is not my greater concern, I need to understand generally how the process works, or where I'm not putting a file, because I feel that I don't have a good sense of how "everything" is connected.
Thanks again,
Angra
Help with Spell Hooks & Custom Spells
Débuté par
Coercer_Angra
, sept. 07 2011 01:35
#1
Posté 07 septembre 2011 - 01:35
#2
Posté 07 septembre 2011 - 04:25
http://nwn.wikia.com/wiki/Spellhook has some info on spellhooks. Basically edit the originating calling code, and there are some wonky variables there which you can just bypass entirely if you want. You probably only want spellhooks affecting players normally, and just enabling this on a region by region basis is probably a good idea.
spells.2da, the impactscript column determines the name of the ncs file used. Note that the visuals will fire off regardless if the spellhook blocks the spell.
You need a script nss file in the module itself, in override, or in a hak, compile it so it has a matching ncs file, and it will work. Use open conversation script in the module itself to find a given script and open it in the module, edit it, then compile it, and it will work however you changed it.
At the top of each spell script, is a function that calls the spell hook script, where you can block or allow it to continue, if this is not at teh top of the spell, your spell hook script won't work. Trace out this function ( its in the switches include, and you will see how it's all working )
spells.2da, the impactscript column determines the name of the ncs file used. Note that the visuals will fire off regardless if the spellhook blocks the spell.
You need a script nss file in the module itself, in override, or in a hak, compile it so it has a matching ncs file, and it will work. Use open conversation script in the module itself to find a given script and open it in the module, edit it, then compile it, and it will work however you changed it.
At the top of each spell script, is a function that calls the spell hook script, where you can block or allow it to continue, if this is not at teh top of the spell, your spell hook script won't work. Trace out this function ( its in the switches include, and you will see how it's all working )
if (!X2PreSpellCastCode())
{
}
#3
Posté 07 septembre 2011 - 06:22
Thank you! That resolved my problem.
#4
Posté 07 septembre 2011 - 02:08
The variable requirement for spellhooking to affect NPCs probably seemed sensible when they put it in, because they were using spellhooking for things like crafting. However, removing it means you have to recompile all the spellscripts in the game. It's easier just to loop through your areas on module load and set "X2_L_WILD_MAGIC" to TRUE... I for one can see far more uses of spellhooking where you'd want to affect everyone rather than just PCs, but either way, having the option would have been nice...





Retour en haut






