But there is a problem. There's no documentation for the Perl scripting features. I've only found a couple of other scripts that use it, and they don't have documentation either. What I'm aiming to do, is raise the level of all NPCs to 20, adjusting their stats depending on their class, and have some classes give an even higher level boost also dependent on their class. But, sadly, no documentation. This is what I've got so far:
Code: Select all
use strict;
sub main {
my($npcToChange) = @_;
my $iCurrentLevel = 0;
my $iNewLevel = 20;
my $strElementSignature = '';
if ($npcToChange->rectype eq 'NPC_'){
foreach my $Element (@{$npcToChange->{SL}}) {
$strElementSignature = $Element->subtype;
if ($strElementSignature eq 'NPDT' && ($Element->{level} + 0 ) < 20 {
$element->{level} = $iNewLevel
}
}
}
}
Code: Select all
sub main {
my($tr) = @_; # tr = the record
my $ok = 0;
my $angle = 0;
my $delta = 0;
my $newangle = 0;
my $subtype = '';
my $name = '';
if ($tr->rectype eq 'CELL') { # only interested in CELL records
if (!$tr->is_interior) { # that are not interiors
$ok = 0;
foreach my $tsr (@{$tr->{SL}}) { # tsr = the sub-record
$subtype = $tsr->subtype;
if ( $ok == 0 ) {
if ($subtype eq 'FRMR') {
$ok = 1;
}
}