Can anyone help me with one issue? How do I trigger a script off a *standard* spells cast onto an inventory object (including blank scrolls/potion bottles)?
Or, what scripts handle the standard item creation feats?
(Or, where can I get the *searchable* standard NWN scripts? Didn't work with the toolset for a few years...)
I need to modify item creation *a little* for my mod, and don't wanna to have to redo it completely or use haks for the purpose.
TIA
Catching spells cast on inventory objects /or/ item creation feat scripts
Débuté par
CheeseshireCat
, nov. 13 2010 03:29
#1
Posté 13 novembre 2010 - 03:29
#2
Posté 13 novembre 2010 - 06:31
You'll want to enable spellhooking in your module by setting a string variable in Edit>Module Properties>Advanced>Variables with the Name X2_S_UD_SPELLSCRIPT and the Value set to the name of your spellhook script.
Now in your spellhook script you'll use the following relevant functions:
-420
Now in your spellhook script you'll use the following relevant functions:
#include "x2_inc_switches"
void main()
{
object oCaster = OBJECT_SELF;
object oTarget = GetSpellTargetObject();
int nSpell = GetSpellId();
int nSpellDC = GetSpellSaveDC();
int nCastLevel = GetCasterLevel(oCaster);
if(nSpell == SPELL_MAGIC_WEAPON)
{
//Do something then execute the default spell script
}
if(nSpell == SPELL_TIME_STOP)
{
//Do something then bypass the default spell script
SetModuleOverrideSpellScriptFinished();
}
}
I use this on my server's "magic forge" to allow casters to create magic items by casting spells directly on the items.-420
Modifié par 420, 13 novembre 2010 - 06:32 .
#3
Posté 13 novembre 2010 - 07:27
#4
Posté 16 novembre 2010 - 08:54
Thanks, guys. Also, odd, but I was expecting the "subscribe to the thread" to drop me the notifiers of replies to mailbox...
#5
Posté 16 novembre 2010 - 09:18
Just in case. Did that, modified crafting script (x2_inc_craft), etc... Spent *four hours* (!) trying to find out why stuff just doesn't work (i.e., doesn't work at all, even when I inserted floating text for debugging). Finally, found that I also need to recompile a few barely related scripts for it to work. @.@ In particular, x2_pc_craft
#6
Posté 16 novembre 2010 - 10:05
I am not sure I follow what you are saying.
Include Files Do not compile on there own to make a runnable script. They are included into other scripts and then compiled into that main script. It is a methoid of keeping thins constant across several scripts. Also a way to be able to reuse code in several scripts without having to rewrite it every time.
It is also advisable (rule of thumb but not a firm rule) that you not modify the standard include files. The reason behind this is that it is not always eaisy to find or recompile every script that uses it. Somethimes in rear cases there are hard coded reasons behind why Bioware did things the way they did. If you want to modify standard include files it is often better to make a copy of it with a new name and include it into your scripts instead. This also make it a lot easier to identify scripts that may show up that still use the unmodified include. It could save you hours tracking down bugs that show up later.
Include Files Do not compile on there own to make a runnable script. They are included into other scripts and then compiled into that main script. It is a methoid of keeping thins constant across several scripts. Also a way to be able to reuse code in several scripts without having to rewrite it every time.
It is also advisable (rule of thumb but not a firm rule) that you not modify the standard include files. The reason behind this is that it is not always eaisy to find or recompile every script that uses it. Somethimes in rear cases there are hard coded reasons behind why Bioware did things the way they did. If you want to modify standard include files it is often better to make a copy of it with a new name and include it into your scripts instead. This also make it a lot easier to identify scripts that may show up that still use the unmodified include. It could save you hours tracking down bugs that show up later.
Modifié par Lightfoot8, 16 novembre 2010 - 10:09 .
#7
Posté 18 novembre 2010 - 08:00
That was what I did in the end. And what I meant is, it was pretty hard to catch which of the "main" scripts I have to alter.





Retour en haut






