So I was determined to get this to work and thought I'd share the code with you. Disclaimer: the script checks for possession of the actual 4 blocker items, not a global variable changed as a result of turning in those 4 items. The script could easily be altered to do so. Also, I know originally there was an accompanying Mire of Crimson Mists runspeed debuff but you can simply add that spell to the list cast (after a spellcompleted command) or make another npc/script for that debuff. All the item and spell numbers are correct.
In the second code block you'll find my original use of this code for tiered instances of citymist on my server. I adapted the script for use in dreadspire for your use (those attempting to recreate Live with fidelity).
Use and modify as you wish for functionality on your server.
crimson_mists.pl
Code:
#############
#crimson_mists.pl
#Crimson Mists debuff controller for Dreadspire
#Author: Salvanna (Asylum)
#Items Involved: #52522 Congealed Blood of Redfang #52523 Rune-Etched Stone #52524 Shrunken Head #52525 Sister's Handkerchief
#NPC Involved: crimson_mists race 240, type set to 11 (untargetable) after placement anywhere in zone
#Location: dreadspire (Demi-Plane of Blood)
#Currently checks for ownership of the 4 blocker items, but could be adjusted to check status of a qglobal after item turnins
#############
sub EVENT_SPAWN {
$npc->TempName("");
quest::settimer("debuff", 300);
}
sub EVENT_TIMER {
if ($timer eq "debuff") {
my @clientlist = $entity_list->GetClientList();
foreach $ent (@clientlist) {
#has all 4 blockers
if (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52523) && plugin::check_hasitem($ent, 52524) && plugin::check_hasitem($ent, 52525)) {
$ent->Message(315, "You are fully acclimated to the Demi-Plane of Blood. The environment no longer causes you any ill effects.");
}
#has any 3 of 4 blockers
elsif (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52523) && plugin::check_hasitem($ent, 52524)) {
my $eid = $ent->GetID(); $ent->CastSpell(7026,$eid);
}
elsif (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52523) && plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7026,$eid);
}
elsif (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52524) && plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7026,$eid);
}
elsif (plugin::check_hasitem($ent, 52523) && plugin::check_hasitem($ent, 52524) && plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7026,$eid);
}
#has any 2 of 4 blockers
elsif (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52523)) {
my $eid = $ent->GetID(); $ent->CastSpell(7025,$eid);
}
elsif (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52524)) {
my $eid = $ent->GetID(); $ent->CastSpell(7025,$eid);
}
elsif (plugin::check_hasitem($ent, 52522) && plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7025,$eid);
}
elsif (plugin::check_hasitem($ent, 52523) && plugin::check_hasitem($ent, 52524)) {
my $eid = $ent->GetID(); $ent->CastSpell(7025,$eid);
}
elsif (plugin::check_hasitem($ent, 52523) && plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7025,$eid);
}
elsif (plugin::check_hasitem($ent, 52524) && plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7025,$eid);
}
#has any 1 of 4 blockers
elsif (plugin::check_hasitem($ent, 52522)) {
my $eid = $ent->GetID(); $ent->CastSpell(7024,$eid);
}
elsif (plugin::check_hasitem($ent, 52523)) {
my $eid = $ent->GetID(); $ent->CastSpell(7024,$eid);
}
elsif (plugin::check_hasitem($ent, 52524)) {
my $eid = $ent->GetID(); $ent->CastSpell(7024,$eid);
}
elsif (plugin::check_hasitem($ent, 52525)) {
my $eid = $ent->GetID(); $ent->CastSpell(7024,$eid);
}
#has 0 of 4 blockers
else {
my $eid = $ent->GetID(); $ent->CastSpell(7023,$eid);
}
}
}
}
mists.pl
Code:
sub EVENT_SPAWN {
$npc->TempName("");
quest::settimer("debuff", 120);
}
sub EVENT_TIMER {
if ($timer eq "debuff") {
my @clientlist = $entity_list->GetClientList();
foreach $ent (@clientlist) {
if (plugin::check_hasitem($ent, 6486)) { #check ownership of item Ring_of_the_Mist (not equipment, just a token)
$ent->Message(315, "Your item protects you from the effects of the mist.");
}
else {
my $eid = $ent->GetID(); #Get this client's Entity_ID
$ent->CastSpell(7026,$eid); #casts Aura of Crimson Mists IV
my $h_ent_name = $ent->GetCleanName();
quest::ze(4, "The ancient mists pummel $h_ent_name with waves of agony.");
}
}
}
}