PDA

View Full Version : Mod: Mass Weapon and Spell Viewer


Akkadius
12-24-2013, 01:45 AM
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.

-----------

q8wOhNtEgC8

-----------

overthere/player.pl

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

-------------------------------

# 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++;
}
}
}
}

Township EQ
12-24-2013, 02:12 AM
this is so awesome.. thanks!

Bohbo
01-10-2015, 09:04 PM
Hey Akkadius,

I got the mobs in the DB and the quest in OT and working. Except for one thing... I dont seem to get any effects or weapons to display just a bunch of invisible men with their name showing.

I have them set as Race 127 BodyType 1 Material 0 both melee textures set to 0.

Any idea why the textures themselves won't populate on the beautiful rows of invis mobs?

Akkadius
01-10-2015, 09:08 PM
Make sure you name the NPC's appropriately.

'effects' for effects NPC's and 'weapon' for weapons NPC's

Bohbo
01-10-2015, 09:14 PM
Make sure you name the NPC's appropriately.

'effects' for effects NPC's and 'weapon' for weapons NPC's

I have them named exactly now, not sure it helped though. I repopped the zone and talked to controller and said weapon and i get a bunch of "weapon" then they start to turn into "!weapon" but no graphics.


If i click a weapon it does return the ID though, just no graphic.

Akkadius
01-10-2015, 09:35 PM
I have them named exactly now, not sure it helped though. I repopped the zone and talked to controller and said weapon and i get a bunch of "weapon" then they start to turn into "!weapon" but no graphics.


If i click a weapon it does return the ID though, just no graphic.

Try different ranges, you might be using ranges that you just can't see on your client

Bohbo
01-10-2015, 09:48 PM
Try different ranges, you might be using ranges that you just can't see on your client

I dont think that is the issue, for example for effects I cant see a single one with UF or RoF2... i am stumped.


EDIT:: what about REQUIRED: For the least issues, you use this script while in Overthere instance Version of 1

I am using overthere off of the PoK book and then i depopped zone

Akkadius
01-10-2015, 09:52 PM
I dont think that is the issue, for example for effects I cant see a single one with UF or RoF2... i am stumped.


EDIT:: what about REQUIRED: For the least issues, you use this script while in Overthere instance Version of 1

I am using overthere off of the PoK book and then i depopped zone

Are you in an instance? Using version 1?

Bohbo
01-10-2015, 09:54 PM
Are you in an instance? Using version 1?

No i haven't delved into instances yet. I guess that might be my problem. Any chance you have a link handy on how to make an Overthere instance 1?

Akkadius
01-10-2015, 09:57 PM
Given you have standard plugins, this should work.

Put this somewhere in your EVENT_SAY (global_player.pl) or wherever you want to trigger this.

sub EVENT_SAY{
if($text=~/#gmzone visuals/i){
plugin::SendToInstance("public", "overthere", 1, 1836, 3098, -50, "GM_Zone3", 604800);
} # Send to Overthere for Weapons/Spells Preview
}

Bohbo
01-10-2015, 10:29 PM
I apparently don't have all the default plugins.... I thought i had everything checked on the compile though. I tried it on global and an NPC and no response with the sendtoinstance command.

I will get this part solved first i suppose.

EDIT: I have the Instances.pl file in my plugins folder. So should be active right?

Akkadius
01-10-2015, 10:41 PM
I apparently don't have all the default plugins.... I thought i had everything checked on the compile though. I tried it on global and an NPC and no response with the sendtoinstance command.

I will get this part solved first i suppose.

EDIT: I have the Instances.pl file in my plugins folder. So should be active right?

Yes, that has the SendTo.

http://wiki.eqemulator.org/p?Perl_Plugins_Master_Reference

Bohbo
01-10-2015, 11:24 PM
Yes, that has the SendTo.

http://wiki.eqemulator.org/p?Perl_Plugins_Master_Reference

You really make me feel like a noob! However you are tremendously helpful I can't thank you enough. I renamed my perl install and copied db version to replace it. That seems fine. I put in my DB info in mysql.pl file and rebooted server. I still don't seem to have those commands. Do i have to manually load a list it seems like it should be working from there right?

EDIT: I figured it out! I had made a players.pl file in globals and i didn't use the global_player one. Wish me luck on the rest!

EDIT: Once in the instance effects are working YOU ARE THE MAN!

Akkadius
01-11-2015, 12:16 AM
Good to hear!

pharone1
01-23-2019, 11:08 AM
I implemented this last night, so it still works in 2019 for anyone concerned.

I initially had trouble getting it to work, but that was just because I am still new to how EQemu works over all. Thanks for the help in Discord Akkadius.

Here are my tips for anyone else wanting to implement this and is very new to EQemu like myself:


Create 7 NPCs in your database (1 for effects and 6 for weapons) in the npc_types table
I named my weapon NPCs 'weapon'
I named my effects NPC 'effect'
$effect_npc
Change the values for $effect_npc and $mob_# (ex $mob_1) to the npctypeid for the effects and weapon npcs you created
Change the instanceversion value to 0 in the script UNLESS you have an instanceversion 1 to zone in to for Overthere


I know all of these things seem super insanely simple to figure out if you have been using EQemu for a while now, but for someone like myself that had never even opened a .pl file before, I was pretty lost lol.

My biggest problem was that I had no idea what an instance version even was little lone how to create and/or access one. In the end, I ended up modifying the script (as stated above) to simply use instanceversion 0 instead, and everything started working.

In the end, I learned a lot about how to modify these pl files, so it was a great exercise.

Also, I was wondering how I could find out if parts of my script were even firing off, and it occurred to me that I can use the $client->Message function to send messages to the player to let me know when certain parts of the script ran. To do this, just add the following to any spot in the script where you would want a message to pop up on the players chat window (for example: to see if the event_spawn was running).

$client->Message(15, "*** Debug *** Entered XYZ part of the code.");

When the script comes across that line, it will say "*** Debug *** Entered XYZ part of the code." in the chat window for the player, so you know your script is running and it got to that part of the script. Makes debugging a bit easier.

This works great, and I have already used it to identify some weapon skins I want to use.

Oh one last thing about the weapon skins. When you click on one of the NPCs holding the weapons, the npc tells you the IDs of the weapons that NPC is wielding. This is the idfileid (I think that's what the field is called in the items table). You need to add the letter IT to the front of that number when you go to add the weapon skin to another weapon. For example, if the id was 12345, the actual skin id is IT12345.

I hope this helps anyone looking to try this out in the future.