ENGLISH
That script have to be saved as "script file" (pat_CusHenchUp name is just a suggestion).
The aim is to allow you to use and level up custom henchmen.
You know that to use standard NWN henchman level up functions you need to generate henchmen strictly as standard NWN class packages requires.
With that script, at the contrary, you could create a serie of henchman blueprints that should follow the growth of the henchman (note their ResRef).
You neen to create a copy of that script file for every expected "Level Up" and insert the "Next Level Henchman Blueprint's ResRef string" where specified in the script.
Then, using that script as action in the last sentence of the henchman' dialogue "Level Up" branch, it will:
- Create the new henchman;
- Pass all inventory items form the old to the new henchman version;
- Equip\Wear\Grasp on the new henchman everything the old henchman had equipped\weared\grasped (except if the slot would result as already taken*);
- Delete old henchman;
- Add the new henchman in the group.
* If the new henchman already Equip\Wear\Grasp something by blueprint, the old item will however be present in its inventory.
There are two notes to know:
1) "Next version" blueprints should be "bared" about everything that will be inherited from old versions. It should "own" something only if you want that a new\stronger item will be gained on level up.
Everything that both new and old henchman version own, will result as duplicated.
2) Everything that would be inherited and then equipped\wearer\grasped, MUST be checked as "identified".
If something will result as not "identified", the ActionEquipItem() function will fail.
Extra note (suggestion): If you're experienced with Local Variables, you could use a single version of that script for every level up and every henchmen.
To do that, you'll need to set on every henchman version a "LocalString" that contains the ResRef of the next version's blueprint.
In that way, you need just to substitute ~HERE Next Level Henchman Blueprint's ResRef string~ text in my script, with the properly "GetLocalString()" function. ;)
-------------------------------------
ITALIANO
Questo script deve essere salvato come "file di script" (il nome pat_CusHenchUp è da intendersi solo come suggerimento).
Lo scopo è di permettere di usare e livellare henchmen customizzati.
Sapete che per usare le funzioni standard di livellamento per henchmen di NWN c'è bisogno di generare gli henchmen esattamente come richiesto dai pacchetti standard delle classi di NWN.
Con questo script, invece, potete creare una serie di progetti dell'henchman che seguiranno la sua crescita (annotate i loro ResRef).
Dovrete creare una copia di questo file di script per ogni "Livellamento" previsto ed inserire il ResRef del progetto del livello successivo dove specificato nello script. ("HERE Next Level Henchman Blueprint's ResRef string")
Quindi, usando questo script come azione nel dialogo dell'henchman, nell'ultima frase del ramo del "Livellamento", questo farà le seguenti cose:
- Creerà il nuovo henchman;
- Passerà tutti gli oggetti dell'inventario dal vecchio al nuovo henchman;
- Equipaggerà\Indosserà\Impugnerà sul nuovo henchman tutto quello che era equipaggiato\indossato\impugnato sul vecchio henchman (ammenoché lo slot non risulti già occupato*);
- Cancellerà il vecchio henchman;
- Aggiungerà il nuovo henchman al gruppo.
* Se il nuovo henchman equipaggia\indossa\impugna già qualcosa da progetto, il vecchio oggetto sarà comunque presente nel suo inventario.
Ci sono due note da sapere:
1) Il proggetto della "versione successiva" dovrebbe essere spogliato di ogni oggetto che sarà ereditato dalla vecchia versione. Dovrebbe "possedere" qualcosa soltanto se volete che guadagni un nuovo\più forte oggetto col passaggio di livello.
Qualsiasi cosa sarà posseduta sia dal nuovo che dal vecchio henchman, risulterà come duplicata.
2) Qualsiasi cosa che dovrebbe essere ereditata e poi equipaggiata\indossata\impugnata, DEVE essere settata come "identificata".
Se qualcosa risulterà come non "identificata", la funzione ActionEquipItem() fallirà.
Nota extra (suggerimento): Se avete esperienza con le Variabili Locali, potreste usare una singola versione di questo script per ogni livellamento di qualsiasi henchman.
Per far ciò, avrete bisogno di settare su qualsiasi versione dell'henchman una "LocalString" (Variabile Locale di tipo Stringa) che contenga il ResRef del progetto della versione successiva.
In questo modo, avrete soltanto bisogno di sostituire il testo ~HERE Next Level Henchman Blueprint's ResRef string~ dello script, con la funzione correttamente impostata "GetLocalString()". ;)