Purpose:
When you're developing and shit, have you ever wanted to view a large amount of weapon models or spell models at the same time?
I know I have and wanted to be able to do it in game while developing on another box. Check out the video first, sorry for poor quality. Nothing too crazy about this mod.
-----------
-----------
overthere/player.pl
Code:
sub EVENT_TARGET_CHANGE{
$CT = $client->GetTarget();
if($CT && $CT->IsNPC()){
if($CT->GetCleanName()=~/effect/i){
if($CT->GetEntityVariable("effectid")){
$client->Message(15, "[Effect ID]: " . $CT->GetEntityVariable("effectid"));
}
}
if($CT->GetCleanName()=~/weapon/i){
if($CT->GetEntityVariable("weaponid")){
$client->Message(15, "[Weapon 1]: " . $CT->GetEntityVariable("weaponid"));
$client->Message(15, "[Weapon 2]: " . $CT->GetEntityVariable("weaponid2"));
}
}
}
}
overthere/default.pl
REQUIRED: You need to create several invisible NPC's (Race 127) and they need to be different ID's because the entity tracker in the zone will run out of unique names and the zone will crash, it is really a quick and dirty hack. Don't ask questions. They are defined in the script below under EVENT_SAY as $mob_1 etc, change them to fit your database system.
REQUIRED: Your controller NPC needs to be named 'Controller' usually placed next to the PoK book in the Overthere
REQUIRED: For the least issues, you use this script while in Overthere instance Version of 1
-------------------------------
Code:
# This function generates random strings of a given length
sub generate_random_string
{
my $length_of_randomstring=shift;# the length of
# the random string to generate
my @chars=('a'..'z','A'..'Z','0'..'9','_');
my $random_string;
foreach (1..$length_of_randomstring)
{
# rand @chars will generate a random
# number between 0 and scalar @chars
$random_string.=$chars[rand @chars];
}
return $random_string;
}
sub RunDepop{
my @nlist = $entity_list->GetNPCList();
foreach $val (@nlist){
if($val->GetCleanName()=~/effect/i || $val->GetCleanName()=~/weapon/i){
$val->Depop();
$eid++;
}
}
}
sub EVENT_SPAWN{
$nn = $npc->GetCleanName();
if($instanceversion == 1){ }
if($instanceversion == 1 && $nn=~/effect/i){ quest::settimer("effectshow", 10); }
if($instanceversion == 1 && $nn=~/weapon/i){
$npc->TempName(generate_random_string(21)); quest::settimer("weaponshow", 10);
}
}
sub EVENT_SAY{
my $effect_npc = 1006288;
my $mob_1 = 1006289;
my $mob_2 = 1006290;
my $mob_3 = 1006292;
my $mob_4 = 1006293;
my $mob_5 = 1006294;
my $mob_6 = 1006295;
my @arg = split(' ', $text); ### Break out arguements
$nn=$npc->GetCleanName();
if($nn=~/controller/i){
if($text=~/effects/i){
$eid = 50;
if($nn=~/controller/i){
my $sx = 1786;
my $sy = 3214;
$n=1;
for($i=1;$i<=700;$i++){
quest::spawn2($effect_npc, 0, 0, $sx, $sy, 50, 128);
$sx-=10;
$n++;
if($n == 20){
$sy-=60;
$sx = 1786;
$n=1;
}
}
quest::settimer("assigneffects", 5);
}
}
elsif($text=~/weapon/i){
$eid = $arg[1];
if($nn=~/controller/i){
RunDepop();
my $sx = 1786;
my $sy = 3214;
$n=1;
for($i=1;$i<=1000;$i++){
if($i <= 500){ $mobspawn = $mob_1; }
if($i >= 500 && $i<= 1000){ $mobspawn = $mob_2; }
if($i >= 1000 && $i<= 1500){ $mobspawn = $mob_3; }
if($i >= 1500 && $i<= 2000){ $mobspawn = $mob_4; }
if($i >= 2000 && $i<= 2500){ $mobspawn = $mob_5; }
if($i >= 2500 && $i<= 3000){ $mobspawn = $mob_6; }
quest::spawn2($mobspawn, 0, 0, $sx, $sy, -40, 128);
$sx-=10;
$n++;
if($n == 100){
$sy-=60;
$sx = 1786;
$n=1;
}
}
quest::settimer("assignweapons", 10);
}
}
elsif($text=~/depop/i){ RunDepop(); }
else{
$client->Message(15, "[" . quest::saylink("Effects", 1) . "]");
$client->Message(15, "[" . quest::saylink("Weapons", 1) . "] [" . quest::saylink("weapon 1 2000", 1, "1 - 2000") . "] [" . quest::saylink("weapon 10000 12000", 1, "10000 - 12000") . "] [" .
quest::saylink("weapon 12000 14000", 1, "12000 - 14000") . "] [" . quest::saylink("weapon 14000 16000", 1, "14000 - 16000") . "] [" . quest::saylink("weapon 16000 18000", 1, "16000 - 18000") . "] [" .
quest::saylink("weapon 20000 22000", 1, "20000 - 22000") . "] [" . quest::saylink("weapon 22000 24000", 1, "22000 - 24000") . "]");
}
}
}
sub EVENT_TIMER{
if($timer eq "effectshow"){
my $neid = $npc->GetEntityVariable("effectid");
$npc->SpellEffect($neid);
}
if($timer eq "weaponshow"){
my $neid = $npc->GetEntityVariable("weaponid");
quest::wearchange(7, $neid);
my $neidd = $npc->GetEntityVariable("weaponid2");
quest::wearchange(8, $neidd);
}
if($timer eq "assigneffects"){
quest::stoptimer("assigneffects");
my @nlist = $entity_list->GetNPCList();
foreach $val (@nlist){
if($val->GetCleanName()=~/effect/i){
if($eid == 167){ $eid++; }
else{
$val->SetEntityVariable("effectid", $eid);
$eid++;
}
}
}
}
if($timer eq "assignweapons"){
quest::stoptimer("assignweapons");
my @nlist = $entity_list->GetNPCList();
foreach $val (@nlist){
if($val->GetCleanName()=~/weapon/i){
$val->SetEntityVariable("weaponid", $eid);
$eid++;
$val->SetEntityVariable("weaponid2", $eid);
$eid++;
}
}
}
}