PDA

View Full Version : Tally count w 2 zone pop-up?


Maceblade
10-05-2015, 01:10 PM
I'm looking to create a script that keeps tally of 2 races. Gnolls and orcs. I want it to pop-up a count of gnoll/orc deaths every time one is killed and broadcast either globally or in 2 specified zones. I'm not gonna be picky, so if it is a combined script that works to. Also was hoping their was a way to keep track of player records as far as who killed the most gnolls/orcs. Any help or direction would be appreciated.

Maceblade
10-07-2015, 10:16 AM
This is what Ive got so far, however the $counts do not show in the emote...

sub EVENT_DEATH_COMPLETE{
if(!defined($qglobals{"orcslay1"})){ $client->SetGlobal("orcslay1", "0", 7, 'F'); }
my $CountOrcs = $qglobals{"orcslay1"};
quest::ze(15, "Dead orcs = " . $CountOrcs . "Dead Gnolls =" . $CountGnolls . "...");
$client->SetGlobal("orcslay1", ($qglobals{"orcslay1"} + 1) , 7, 'F');}

Changed it bc it kept setting the orcslay1 global to 0...

sub EVENT_DEATH_COMPLETE{

my $CountOrcs = $qglobals{"orcslay1"};
$client->SetGlobal("orcslay1", ($qglobals{"orcslay1"} + 1) , 7, 'F');
quest::ze(15, "Dead orcs = " . $CountOrcs . "Dead Gnolls =" . $CountGnolls . "...");}

However, the count will not exceed 1, and the ze will not give the quantity...

Maceblade
10-07-2015, 10:37 AM
Nevermind I just realized I never turned on the mobs Qglobals so of course the count would not exceed 1. Also the counter started working after I did that. Im curious as to if I put this in the player.pl and set a range of npc ID's if this would work for every orc death, and does anyone know of an easy way to do that rather than add 200 id's individually?

chrsschb
10-07-2015, 11:04 AM
Why not just add a small script to the orc/gnoll death that increments the counter?

Maceblade
10-07-2015, 11:29 AM
It does increment the counter with every death. I was hoping there was an easy way within the player.pl to do a sub EVENT_DEATH_COMPLETE if death is between npc id 58000 and 58100 then add 1 global. This would be the zones player pl and not the global one. Would be kinda neat to add a "-" hit to any death that is NOT an NPC death, just to keep it more competitive

ghanja
10-07-2015, 11:42 AM
sub EVENT_KILLED_MERIT



$killed

Shendare
10-07-2015, 11:44 AM
Yeah, there's probably a global event you could use that provides the npc that was killed. Then you could just: (pseudo-code, not actual Perl)


if ($npc->GetRace() == 458) {
orc_global++;
}
elif ($npc->GetRace() == 524) {
gnoll_global++;
}


Those are the race numbers for the new DoD+ orcs and gnolls. Could put in checks for the old ones if you use 'em instead, or for any other race, I would think.

Not sure which event would work best, though, that would provide the $npc and $client that killed 'em. Maybe someone else can chime in.

Maceblade
10-07-2015, 11:56 AM
right now I have it tied to an orc centurion (58000.pl) and the script is functional and working as intended, but rather than have 100 different PL's for all the npc id's id like to know if there was a way to make it easier... one script that accounts for all the orcs in thus said zone, crushbone.

I do like the one you posted Shen that would work awesomely in a mixed race zone or in the global PL to account for all orcs not just specified zones..

Ghanja I wouldn't know how to incorporate what you posted into a script and have it be functional... im still a newb when it comes to this stuff.

Shendare
10-07-2015, 12:09 PM
If you want to separate out tallies by zone, you just use a different setting in the qglobal. :) You could still have the tally logic in one single global place.

Could even tally separately by other things, like whether the npc's name starts with # to indicate a named or something.

Maceblade
10-07-2015, 12:14 PM
Yea that tally system is currently working in both zones, im just trying to figure out how to simplify this down to one script per zone. For instance, I don't want to have a 58001.pl, 58002.pl 58003.pl etc etc for every single mob in the zone... im wondering if there is a better place or better way to handle this... I tried adding it in the player.pl I created for the zone, all I need now is the proper coding. so that when a orc dies the counter goes up, when a player dies counter goes against it.... ill post what I have in a second.

Maceblade
10-07-2015, 12:28 PM
sub EVENT_DEATH_COMPLETE{

my $CountOrcs = $qglobals{"orcslay1"};
my $CountGnolls = $qglobals{"gnollslay1"};

if ($npc->GetRace() == 54) {
$client->SetGlobal("orcslay1", ($qglobals{"orcslay1"}+1) , 7, 'F');
quest::ze(14, "Dead orcs = " . $CountOrcs . " Dead Gnolls =" . $CountGnolls . " ...");}

elsif ($npc->GetRace() == 17) {
$client->SetGlobal("gnollslay1", ($qglobals{"gnollslay1"}+1) , 7, 'F');
quest::ze(14, "Dead orcs = " . $CountOrcs . " Dead Gnolls =" . $CountGnolls . " ...");}
}
This is in my player.pl, and it does not work lol. im not sure what im doing wrong.

Kayen
10-07-2015, 12:29 PM
If you want it triggering off NPC's in the zone.

Run it off the default.pl

That runs the code on every NPC in zone that doesn't have a specific .pl file

You don't need to set the global to a client, just use a type 7 global on the NPC that will save it across all zones and can be accessed by anything.

Shendare
10-07-2015, 12:33 PM
And if you change the qglobal's type to 3 instead of 7, it'll track the tallies separately for each zone the script runs in.

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

Maceblade
10-07-2015, 12:37 PM
I saved it to "default.pl" and threw all the other scripts for the zone into a folder. It will not work now. Do you have an example of how to set a global w.o assigning it to a client by any chance?

Shendare
10-07-2015, 12:39 PM
default.pl has to be in EQEmuServer\quests. Setting the qglobal type to 7 (as you have it) and to 3 both set it for all clients and not just the one that triggered the event.

Check out that wiki page on qglobals and this one on quests in general:

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

Maceblade
10-07-2015, 12:41 PM
Thanks Shen I did not realize that was there, now its book marked lol. And Kay are you talking about using quest::setglobal for every death? Ill post my default.pl.... sub EVENT_DEATH_COMPLETE{

my $CountOrcs = $qglobals{"orcslay1"};
my $CountGnolls = $qglobals{"gnollslay1"};
$client->SetGlobal("orcslay1", ($qglobals{"orcslay1"}+1) , 7, 'F');
quest::ze(14, "Dead orcs = " . $CountOrcs . " Dead Gnolls =" . $CountGnolls . " ...");}

ghanja
10-07-2015, 12:51 PM
So, you have multiple NPC ID's for both Gnolls and Orcs. You would like to keep track of the deaths of them in only two zones (currently).

That's my understanding.

Do you wish to give credit for the kills if no experience is yielded? What if groups go out killing them? You only wish for the one with the final blow to get the credit?

Maceblade
10-07-2015, 01:03 PM
Its a controlled event, blackburrow and crushbone, every orc/gnoll, level 10 PC max(is not a concern as there is a zone autoboot script already in place), personal credit is not a priority. Its living vs undead and when you are undead you play as undead gnolls raiding crushbone. as the living you play as orcs raiding blackburrow.

My simplistic version is to just keep track of orc and gnoll deaths, and broadcast them to their own zone.

What I really wanted was, every gnoll death whether it be PC or NPC acted as a gnoll kill etc etc.

The dwarves were all changed to orcs to make it easier on the default script.

Maceblade
10-09-2015, 05:47 PM
Anyone care to tell me why this default.pl does not work, yet when I assign it to an NPC it works fine?

sub EVENT_DEATH_COMPLETE{

my $CountOrcs = $qglobals{"orcslay1"};
my $CountGnolls = $qglobals{"gnollslay1"};
$client->SetGlobal("gnollslay1", ($qglobals{"gnollslay1"}+1) , 7, 'F');
quest::ze(14, "Dead orcs = " . $CountOrcs . " Dead Gnolls =" . $CountGnolls . " ...");}

Kingly_Krab
10-09-2015, 06:15 PM
Do ALL the NPCs you're trying to use that on have their 'qglobal' column set to '1' in 'npc_types'?

Maceblade
10-09-2015, 08:15 PM
yea I used navicat and had them all set

Kingly_Krab
10-09-2015, 08:15 PM
Hmm, pretty weird, didn't look at the code, but I'll get back to you on something, message me on Skype (Kingly.krab).

Maceblade
10-10-2015, 09:48 AM
Ok so I got it to work as a default script... only issue is it does not work with all the npcs in the zone. There is no other scripts other than mine in the zone file. Orcs and gnolls globally, all share the same script when dying, the only issue is I cant find it. I looked in the global file and nothing. Are there hard coded scripts when they die they automatically say those things that will superceed my default file?

sub EVENT_DEATH_COMPLETE{

my $CountOrcs = $qglobals{"orcslay1"};
my $CountGnolls = $qglobals{"gnollslay1"};
quest::setglobal("gnollslay1", ($qglobals{"gnollslay1"}+1) , 7, 'F');
quest::ze(13, "<<<<---Dead orcs = " . $CountOrcs . " Dead Gnolls = " . $CountGnolls . " --->>>>");}