Author Topic: Spell Advice  (Read 605 times)

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Spell Advice
« on: September 05, 2011, 04:16:47 am »


               I'm wondering if I should spell it "color" or "colour" on my in-game placards.

Also, I'm not sure about how to proceed on an all-encompassing spell customization program. All I want to do is to have an include script in my spells that would allow changes to be done more easily to all spells or spells by type. What I'm unsure about is:

1) Is adding to the end of "x2_inc_spellhook" a good or bad idea for this purpose?

2) If it's a bad idea, I thought maybe I could do a "Find and Replace" kind of process, but I don't know a program that would allow that (i.e. replace "#include "x2_inc_spellhook"" with "#include "x2_inc_spellhook" (Space, space) #include "new include script""). Oddly, when I do a Find In Files of #include "x2_inc_spellhook" in the toolset it returns the scripts I have modified and ignores all the rest, so that's not even a viable way of finding the instances to do it manually, which hopefully will not be the way to proceed.

I started rambling there, but basically I'm asking if, in the case where messing with x2_inc_spellhook is a bad idea, is there a program that will allow me to search and replace all instances of it?

Thanks in advance.
               
               

               
            

Legacy_the.gray.fox

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Spell Advice
« Reply #1 on: September 05, 2011, 09:26:14 am »


               Hello.

This is not a full answer to all your questions.
But a good start.
Much more is there to tell -- but I am strict on time.
Others will be happy to share more details :-)



------------------------------------------------------------
Color should be fine.
Colour is almost in disuse.
People will understand either word, anyway.

But maybe Color is better?
If you do not have to think about the extra U, you can not
forget to write it (less typos, you know).


------------------------------------------------------------
The [x2_inc_spellhook] header is nothing special.
They called it spellhook and people get scared to touch it.
It is only a name. If they called it mickeymouse I am sure
you would not think twice before opening and modify it.
So help yourself. That header contains code you can alter,
just like any other header.
Usuallly it is handy to stuff modifications in there because
the header is included in pretty much every spellscript.
People want to walk the cheap road, you know. Often the
spellhook is "abused" because of this.
But nothing is wrong in messing with it, so long you take
care to not write bugs. Else they too get included in every
spellscript :-)

(Open...
Actually I suggest that you detach it from being physically
included in every spellscript, by using ExecuteScript().
Not a mandatory thing, but it would allow your spellscripts
(altogether) to recompile to MegaBytes less code than they do
now.
No need to tell, NWN can only benefit from this.
... closed)


------------------------------------------------------------
If you want to perform a global search/replace on scripts,
you first have to extract them.
You can do this "offline", with the [nwexplorer] tool.
Seek it on the vault.
Once you have all scripts inside the same folder on your
harddrive you can quickly reduce their number by keeping only
those whose name contains either _s0_, _s1_, _s2_ or _s3_
(underscore characters included).
Not all of them shall #include the [x2_inc_spellhook].
At this point you can further refine the list by searching
for [#include "x2_inc_spellhook"] inside the scripts.
Expect to find a few hundreds of them.
From there, it is your call.


-fox
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Spell Advice
« Reply #2 on: September 05, 2011, 02:40:53 pm »


               I don't understand why you would want to alter the x2_inc_spellhook  include script anyway...
Basically it just let's a person use their own special scripts for ALL spells or a Specific spell from one script, that was the entire purpose of spell hooking to begin with...

Furthermore I just released a custom spell system which will allow the builder to control all spells from just one include script, also it already has spell hooking properly setup, you can find it here: 1.69 Custom Spell System by Genisys
               
               

               


                     Modifié par _Guile, 05 septembre 2011 - 01:41 .
                     
                  


            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Spell Advice
« Reply #3 on: September 06, 2011, 05:04:44 am »


               I'm going with "colour" just to be rebellious. I'll also start saying "rubbish" instead of "garbage".

As for the other stuff:

I could have sworn there was a warning within x2_inc_spellhook that warned against modifications, but on re-checking I was thinking of another script I can't seem to remember (it said something like "the order these functions are called in DOES matter and changing them WILL break the script").

The part about manually replacing it kind of sets the path for me. I really just wanted to avoid that if I could, hence asking if a program could do it quickly or if adding my own changes could be done in one place. I exported the x2_inc_spellhook script and it's 16KB, which isn't that huge but I guess the size is multiplied by how many scripts it's included in when the module compiles?

As for the existing spell control switches, they do a lot of cool stuff but not what I want in order to manage my spells. Some features might be useful later on but again, it's a matter of manually including it in all scripts when the few changes I want, I can add at the bottom of x2_inc_spellhook.

Thanks for the advice, though!
               
               

               


                     Modifié par Hardcore UFO, 06 septembre 2011 - 04:05 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Spell Advice
« Reply #4 on: September 06, 2011, 12:59:11 pm »


               I thought you did not have to include the spellhook script because all the spell scripts are run thro it as a matter of course.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Spell Advice
« Reply #5 on: September 06, 2011, 03:22:12 pm »


               If you are at start then try my unofficial patch. I have rewritten all spellscript onto new engine that allows easily to change caster level, metamagic etc.

spellhook is not very good place for this as it doesnt allow these changes, can only block spell. Of course you can add more functionality but that would still need total rewrite of all spellscripts so usage of spellhook would be contraproductive.
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Spell Advice
« Reply #6 on: September 07, 2011, 01:11:17 am »


               

Of course you can add more functionality but that would still need total rewrite of all spellscripts


How so? My understanding is that any script that is included in another has all its contents made available to the script that calls/includes it.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Spell Advice
« Reply #7 on: September 07, 2011, 02:06:45 am »


               

Hardcore UFO wrote...

Of course you can add more functionality but that would still need total rewrite of all spellscripts


How so? My understanding is that any script that is included in another has all its contents made available to the script that calls/includes it.


  Say you didn't like how Bioware handled MetaMagic feats when related to items, and added something like this into your spellhook (taken from the one I wrote for mine):

if (nType == BASE_ITEM_ENCHANTED_SCROLL || nType == BASE_ITEM_SCROLL    ||
     nType == BASE_ITEM_ENCHANTED_WAND   || nType == BASE_ITEM_MAGICWAND ||
     nType == BASE_ITEM_MAGICROD         || nType == BASE_ITEM_MAGICSTAFF)
    {
     SetLocalInt (oCaster, "FB_METAMAGIC", METAMAGIC_NONE);
     if (!FB_UMDScrollCheck() ) return FALSE;
    }
 else SetLocalInt (oCaster, "FB_METAMAGIC", GetMetaMagicFeat() );


  While all spells that run the spellhook would now set that variable, you would have to go through every spell individually and change the Metamagic feat check over to something that checks that variable instead.  At least, that's an example of what I think Shadooow meant.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Spell Advice
« Reply #8 on: September 07, 2011, 02:38:00 am »


               Thanks Failed.Bard thats exactly what I meant.

My solution is different, I created a new structure that contains all spell information and these informations are loaded into the structure from external include. So if you want to make a change into metamagic then you just need to open my include change line which gets loaded GetMetaMagic and then recompile all spellscripts (which is needed for your previous solution anyway). BTW I already fixed metamagic bug with items.

If you are interested Ill show you some code and examples.
               
               

               


                     Modifié par ShaDoOoW, 07 septembre 2011 - 01:38 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Spell Advice
« Reply #9 on: September 07, 2011, 04:19:18 am »


               

Hardcore UFO wrote...

Of course you can add more functionality but that would still need total rewrite of all spellscripts


How so? My understanding is that any script that is included in another has all its contents made available to the script that calls/includes it.


Just to give the answer here a little then the two already correct answers before this one. 

There is a big differance between source scripts and  and compiled code.   

your statement is not compleatly correct just from the fact that you are using the word script to many times.   It would be more accurate to state it as.  

Any script that is included in another script has all of its contents made available to the compiler when the script is compiled.   Futher more things like constants and functions will only be added to the compiled code if they are used by the main body of the script. 

changing an include file and not recompiling the scripts that use it, is not different then changing a script and forgeting to recompile it.   Without recompiling there is just no change to the compiled code and it will run the same way as it did before you changed the source code.  
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Spell Advice
« Reply #10 on: September 08, 2011, 02:47:58 am »


               That begs many questions to me, at least with regards to how I was planning to proceed.

Firstly, I was assuming that saving the module and starting it had a compilation phase somewhere in there. So if, for instance, I change my block of code for a commonly included function called GetJiggyWith() from the script inc_smithisdown. The function GetJiggyWith() is used in the scripts clowncollage_01 through to clowncollage_19; all these scripts need to be recompiled individually to have the new version of GetJiggyWith()? The game won't at any point make these updates globally when sifting through scripts (during saves and loads)?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Spell Advice
« Reply #11 on: September 08, 2011, 02:58:27 am »


               Yes. Thats why I have on vault and in my unofficial patch resources all spellscripts for easy recompile. As even if you change include, toolset wont compile scripts that are not in your module.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Spell Advice
« Reply #12 on: September 08, 2011, 03:28:15 am »


               

Hardcore UFO wrote...
 
Firstly, I was assuming that saving the module and starting it had a compilation phase somewhere in there. So if, for instance, I change my block of code for a commonly included function called GetJiggyWith() from the script inc_smithisdown. The function GetJiggyWith() is used in the scripts clowncollage_01 through to clowncollage_19; all these scripts need to be recompiled individually to have the new version of GetJiggyWith()? The game won't at any point make these updates globally when sifting through scripts (during saves and loads)?


If all of the scripts are in the module that would work.  By in the module I mean in the .mod file.  

so your clowncollage_ * scripts could all be compiled with all of the other scripts in the module by doing a build on the module having the compile all scripts option selected.   

The spell scripts though are not in the module  (.Mod file)  they are standard game files in the bif' files.  now it you evenr open one of then and modify it  the toolset places the modified version into the .mod file.  At theat point then yes you could then just do a rebuild and have then all recompiled.  You would just need to add all of the scripts into the module.  .    
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
Spell Advice
« Reply #13 on: September 08, 2011, 06:13:33 am »


               That certaily puts a damper on my plans. It means I have to sort out any and all classes I am ever going to include into some form of spell level calculation now, as well as any spell feat, before any spell modifications or additions. I'll be delving into the spell systems posted here for sure.

Thank you again for the information.