How to add custom scripts to a hak pak?
#1
Posté 27 avril 2012 - 04:28
Also I need a suggestion on what to name this hak pak, as it will include JUST edited base spells...
The actual includes that control ALL spells will be in the module for adjusting...
So how would I go about adding the spell scripts to the hak pak?
#2
Posté 27 avril 2012 - 05:48
You'll have to put all your scripts in an erf file. Or you could make your scripts read settings form 2da or variables set on module.
Modifié par Alex Warren, 27 avril 2012 - 05:54 .
#3
Posté 27 avril 2012 - 06:57
Changing 2das neither spellhook wont help you however, since you still need these scripts to import somehow to the module afterall. ERF is the best choice for this purpose.
#4
Posté 27 avril 2012 - 11:26
_Guile wrote...
So how would I go about adding the spell scripts to the hak pak?
It seems like everyone wants to play _Gile and give advice instead of answering the question. LoL.
So l try and not give advice and just answer the question. Well at least one answer to the question, For there are many ways you could go about adding you spells to a Hak Pack. If you have all of your spells compiled in one module, you could just export them into an ERF and then change the extention of the .erf to .hak.
A Hak Pack is really nothing more then a ERF file with a .hak extention.
For that matter the module itself is nothing more then an ERF file with a .mod extention. So you could rename the extention on module from .mod to .hak. Then open it with the hak utility that shiped with the game ad delete everything except your spell scripts from the Hak.
Or when you open a module with the toolset, all of the files in the .mod ERF file are unpacked into a folder called temp0 located in the modules folder. You could just get all of you spell scripts out of that folder and pack them into a hak with the utility that shipped with the game.
Oh well, I guess I gave three way.
Modifié par Lightfoot8, 27 avril 2012 - 11:27 .
#5
Posté 28 avril 2012 - 03:51
So if I put the spells in the hakpak, and left the actual configuration scripts in the module / erf (for importing), the spells would stay the same, but the user could still modify the configuration scripts..
Therefore the hak pak would contain only the spells & the module would have the actual configuration scripts for editing...
This would work correct?
I wanted to put the spells in a Hak Pak for 1 reasons, and that is to reduce the # of scripts in the module, so that builders could simply add the spell system without cluttering their scripts with a bunch of nw_s0 / x2_s0 scripts...
If that's not feasible, then no big deal, as I don't mind the script count personally, I have modules with over 2000+ scripts.. (as long as you use naming conventions it's not a problem)...
Modifié par _Guile, 28 avril 2012 - 03:54 .
#6
Posté 28 avril 2012 - 06:14
spell script - covers all of the functions of a spell, may link to one or more "include" scripts for additional functions and/or constants
include - holds functions and/or constants for easier coding of multiple scripts
Normal process:
1. enable use of an "include" in a spell script by adding it to the top
#include "myincludefile"
2. write spell script, probably referencing one or more functions/constants from the include
3. save and compile spell script
- encodes entire spell script and used portions of include to the compiled script file (.ncs)
- saves script source file for future editing (.nss)
Any changes to an include file are not automatically applied to a compiled script! The script has already been compiled, using the previous version of the include functions/constants.
If changes are made to an included function/constant, each spell script that uses that must be re-compiled for the changes to take effect.
When a script is placed in a hak, that script basically becomes unchangeable while it's in the hak. If an included function/constant used by the hak-stored script is changed, the script files need to be extracted from the hak and added back to the module resources (so they can be changed/updated), recompiled with the updated include (so the changes will be included in the compiled scripts), then the compiled scripts get added back to the hak.
Hak-stored scripts are great...as long as you don't plan on changing anything about those scripts (including the "include" functions/constants).
#7
Posté 28 avril 2012 - 06:19
_Guile wrote...
Thanks Lightfoot8...
So if I put the spells in the hakpak, and left the actual configuration scripts in the module / erf (for importing), the spells would stay the same, but the user could still modify the configuration scripts..
Therefore the hak pak would contain only the spells & the module would have the actual configuration scripts for editing...
This would work correct?
Nope, AD above did a good job of explaining why It will not work.
#8
Posté 28 avril 2012 - 06:46
Link
Modifié par ShadowM, 28 avril 2012 - 06:46 .
#9
Posté 28 avril 2012 - 07:10
I'll just leave the spell scripts in the module, wouldn't be much of a problem to ignore those prefixes anyway (nw_s0 / x2_s0 / etc), just means more scripts to rummage through...
I ran into some major problems, but I'll post that in the scripting forums, thanks again everyone.





Retour en haut







