FunkySwerve

placeable generator

Apr 15th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.66 KB | None | 0 0
  1. //
  2. // --------------------------------------------------------------------------------
  3. // This script generates static placeables from placeables.2da.
  4. // --------------------------------------------------------------------------------
  5. //
  6. //   #!/usr/bin/perl -w --
  7. //   #
  8. //  
  9. //   use strict;
  10. //  
  11. //   use NWN::Gff;
  12. //   use NWN::GffRead;
  13. //   use NWN::GffWrite;
  14. //  
  15. //   while (defined(my $line = <>)) {
  16. //     my ($app, $static, $name) = split(/\s+/, $line, 3);
  17. //  
  18. //     next if ($name =~ /\*\*\*\*/);
  19. //     $name =~ s/"//g;
  20. //     $name =~ s/\s*$//s;
  21. //     $name =~ s/\s*\([A-Za-z0-9]+\)\*$//;
  22. //     $name =~ s/\s*\*$//;
  23. //  
  24. //     my $res = sprintf("plc_static_%05d", $app);
  25. //     my $utp = undef;
  26. //  
  27. //     if (-f "temp0/$res.utp") {
  28. //       $utp = NWN::GffRead::read('filename' => "temp0/$res.utp");
  29. //     } else {
  30. //       $utp = NWN::GffRead::read('filename' => "temp0/plc_static_00001.utp");
  31. //  
  32. //       $utp->{'Tag'}            = $res;
  33. //       $utp->{'TemplateResRef'} = $res;
  34. //       $utp->{'PaletteID'}      = 4;
  35. //     }
  36. //  
  37. //     if ($name =~ /VFX: Flame/) {
  38. //       $utp->{'PaletteID'} = 231;
  39. //     } elsif ($name =~ /Lightshaft/ || $name =~ /Shaft of Light/) {
  40. //       $utp->{'PaletteID'} = 230;
  41. //     } elsif ($name =~ /Portal [0-9]/) {
  42. //       $utp->{'PaletteID'} = 232;
  43. //     }
  44. //  
  45. //     $utp->{'Appearance'} = $app;
  46. //     $utp->{'Static'}     = ($static == 1);
  47. //     $utp->{'LocName'}    = { '0' => $name };
  48. //  
  49. //     NWN::GffWrite::write($utp, 'filename' => "temp0/$res.utp");
  50. //   }
  51. //
  52. // --------------------------------------------------------------------------------
  53. //
  54. //
Advertisement
Add Comment
Please, Sign In to add comment