PDA

View Full Version : POJ - Trial of Hanging


kilst87
10-30-2014, 10:16 PM
So I finished off another trial and thought I'd share my script.

The script is mostly modified from the trial of flame.

I couldn't get quest::me("text") working, so I have the spirits of suffocation just "saying" the emotes.

Also, the trial on live, there are 3 different prisoners (2 aren't in the DB from what I can tell), each having their own set of suffocation emotes. To make it live-like, I'd need to create the NPC's and move part of the suffocation script to the prisoners.

For now, it just spawns the same prisoner.

You'll need to update the NPC trash assist and/or aggro radius. It's set to low to auto aggro in trial.

Here it is:

#Event_Hanging_Control.pl

##Event_Hanging_Control.pl
#Trial of Hanging
#Kilelen
#Modified by kilst87 from "#Event_Burning_Control.pl"

sub EVENT_SIGNAL {
if ($signal == 3) {
quest::settimer("hanging_wave1", 30);
quest::spawn2(201424, 0, 0, 440, -1175, 80.13, 0);
quest::spawn2(201424, 0, 0, 490, -1175, 80.13, 0);
quest::spawn2(201424, 0, 0, 540, -1175, 80.13, 0);

#starts waves
#spawns the 3 prisoners
}

elsif ($signal == 2) {
quest::stoptimer("hanging_wave1");
quest::stoptimer("hanging_wave2");
quest::stoptimer("hanging_wave3");
quest::stoptimer("hanging_wave4");
quest::stoptimer("second_spirit");
quest::stoptimer("boss_mob");
#quest::signalwith(201436, 0, 5);
quest::signalwith(201461, 1, 1);
quest::signalwith(201424, 1, 1);
quest::signalwith(201456, 1, 1);
quest::signalwith(201459, 1, 1);
quest::signalwith(201460, 1, 1);
quest::depop()
#depop event hanging control
#signal for a loss
#stop all timers, depop all mobs
}

elsif ($signal == 3) {
quest::stoptimer("hanging_wave1");
quest::stoptimer("hanging_wave2");
quest::stoptimer("hanging_wave3");
quest::stoptimer("hanging_wave4");
quest::stoptimer("second_spirit");
quest::stoptimer("boss_mob");
#quest::signalwith(201436, 0, 5);
quest::signalwith(201424, 1, 1);
quest::depop()
#depop event hanging control
#signal for a win
#stop all timers, depop prisoners only.
}
}

sub EVENT_TIMER {
if ($timer eq "hanging_wave1") {
quest::stoptimer("hanging_wave1");
SpawnHangingMobs();
SpawnSpiritMob();
quest::settimer("second_spirit", 50);
quest::settimer("hanging_wave2", 120);
#1st wave
}

elsif ($timer eq "hanging_wave2") {
quest::stoptimer("hanging_wave2");
SpawnHangingMobs();
SpawnSpiritMob();
quest::settimer("second_spirit", 50);
quest::settimer("hanging_wave3", 120);
#2nd wave
}

elsif ($timer eq "hanging_wave3") {
quest::stoptimer("hanging_wave3");
SpawnHangingMobs();
SpawnSpiritMob();
quest::settimer("second_spirit", 50);
quest::settimer("hanging_wave4", 120);
#3rd wave
}

elsif ($timer eq "hanging_wave4") {
quest::stoptimer("hanging_wave4");
SpawnHangingMobs();
SpawnSpiritMob();
quest::settimer("second_spirit", 50);
quest::settimer("boss_mob", 120);
#4th wave
}

elsif ($timer eq "boss_mob") {
quest::stoptimer("boss_mob");
quest::spawn2(201461,0,0,490,-1054,73.13,0);
#spawn Gallows Master Teion
}

elsif ($timer eq "second_spirit") {
SpawnSpiritMob();
quest::stoptimer("second_spirit");
#second spirit of every wave
}

}

sub SpawnHangingMobs {
#For our loop
my $count = 1;

#Locations to spawn mobs at
my @locX = qw(460 519);
my @locY = qw(-1082 -1082);
my @locZ = qw(73.13 73.13);
my @locH = qw(65 190);

#Loop and spawn, baby.
for ($count = 0; $count <= 3; $count++) {
my $test = rand(99);

if ($test < 69) {
#a breathless void, common mob
quest::spawn2(201456, 0, 0, $locX[$count], $locY[$count], $locZ[$count], $locH[$count]);
}

else {
#a stifling nemesis, less common
quest::spawn2(201459, 0, 0, $locX[$count], $locY[$count], $locZ[$count], $locH[$count]);
}
}
}

sub SpawnSpiritMob {
#need to update aggro and assist radius
my $randi = int(rand(3));

if ($randi == 0) {
quest::spawn2(201460, 0, 0, 440, -1142, 73.13, 0);
}

elsif ($randi == 1) {
quest::spawn2(201460, 0, 0, 490, -1142, 73.13, 0);
}

elsif ($randi == 2) {
quest::spawn2(201460, 0, 0, 540, -1142, 73.13, 0);
}
#Spirit of Suffocation spawn points and randomizer
}

201436.pl (The Tribunal)

#201436.pl
#Trial of Hanging
#Kilelen
#Modified by kilst87 from "201434.pl" (Trial of Flame)

sub EVENT_SAY
{
if(defined $qglobals{pop_poj_mavuin}) {
if($text=~/Hail/i) {
quest::emote(" fixes you with a dark, peircing gaze. 'What do you want, mortal? Are you [prepared]?");
}

elsif($text=~/prepared/i) {
quest::say("Very well. When you are ready, you may begin the trial of hanging. Act quickly to destroy the spirits of suffocation before their victims perish. We shall judge the mark of your success.");
}

elsif($text=~/begin the trial of hanging/i) {
if (!defined $hanging) {
quest::say("Then begin.");
quest::movegrp(201,500,-1045,73.1);
quest::settimer(301,30);
quest::spawn2(201448,0,0,500,-1045,73.1,128);
#spawn event hanging control
quest::signalwith(201448, 3, 30);
#signal event start
$hanging=1;
#start trial, move group, spawn even_haning_control & signal timer start.
}

else {
quest::say("I'm sorry, the Trial of Hanging is currently unavilable to you.");
}
}

elsif($text=~/what evidence of Mavuin/i) {
if(plugin::check_hasitem($client, 31842)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_execution", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
}

elsif(plugin::check_hasitem($client, 31796)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_flame", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
}

elsif(plugin::check_hasitem($client, 31960)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_lashing", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
}

elsif(plugin::check_hasitem($client, 31845)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_stoning", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
}

elsif(plugin::check_hasitem($client, 31844)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_torture", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
}

elsif(plugin::check_hasitem($client, 31846)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_hanging", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
}
}
}
}


sub EVENT_TIMER
{
if($timer == 300) {
$hanging = undef;
quest::stoptimer(300);
quest::signalwith(201436,0,5);
#25 min fail timer complete
}

elsif($timer == 301) {
$hanging = 6;
quest::stoptimer(301);
quest::settimer(300, 1200);
#set 25 min timer until fail
}
}

sub EVENT_SIGNAL
{
if ($signal == 0) {
quest::shout("The Trial of Hanging is now available."); #notify once timer expires OR FAIL. (~25 minutes)
$hanging=undef;
quest::stoptimer(300);
#Actually tell the controller to fail the trial, if I can.
#quest::signalwith(201448, 2, 5);
}
}

sub EVENT_ITEM
{
if(defined $qglobals{pop_poj_mavuin}) {
if(plugin::check_handin(\%itemcount, 31842 => 1)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_execution", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
quest::summonitem(31842);
}

elsif(plugin::check_handin(\%itemcount, 31796 => 1)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_flame", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
quest::summonitem(31796);
}

elsif(plugin::check_handin(\%itemcount, 31960 => 1)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_lashing", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
quest::summonitem(31960);
}

elsif(plugin::check_handin(\%itemcount, 31845 => 1)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_stoning", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
quest::summonitem(31845);
}

elsif(plugin::check_handin(\%itemcount, 31844 => 1)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_torture", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
quest::summonitem(31844);
}

elsif(plugin::check_handin(\%itemcount, 31846 => 1)) {
$client->Message(4,"You have completed a trial - impressive for mortals. You can tell Mavuin that we will hear his plea. We will seek him out as time befits us.");
quest::setglobal("pop_poj_tribunal", 1, 5, "F");
quest::setglobal("pop_poj_hanging", 1, 5, "F");
$client->Message(4,"You receive a character flag!");
quest::summonitem(31846);
}

}

plugin::return_items(\%itemcount);

}


Spirit_of_Suffocation.pl

#Spirit_of_Suffocation.pl
#Trial of Hanging
#Kilst87

sub EVENT_SPAWN {

quest::settimer("spirit_timer1", 1);
#spirit spawned, start fail timer.
}

sub EVENT_SIGNAL {
if ($signal == 1) {
quest::depop();
}
}

sub EVENT_TIMER {

if ($timer eq "spirit_timer1") {
quest::stoptimer("spirit_timer1");
quest::say("The prisoner begins to choke as an invisible noose tightens around his neck.");
#quest::me("The prisoner begins to choke as an invisible noose tightens around his neck.");
quest::settimer("spirit_timer2", 15);
#1st warning, 45 seconds until fail.
}

elsif ($timer eq "spirit_timer2") {
quest::stoptimer("spirit_timer2");
quest::say("The prisoner clutches at his throat, trying desperately to breathe.");
#quest::me("The prisoner clutches at his throat, trying desperately to breathe.");
quest::settimer("spirit_timer3", 15);
#2nd warning, 30 seconds until fail.
}

elsif ($timer eq "spirit_timer3") {
quest::stoptimer("spirit_timer3");
quest::say("The prisoner falls to the ground, legs kicking and fingers clawing at its throat.");
#quest::me("The prisoner falls to the ground, legs kicking and fingers clawing at its throat.");
quest::settimer("spirit_timer4", 15);
#3rd warning, 15 seconds until fail.
}


elsif ($timer eq "spirit_timer4") {
quest::stoptimer("spirit_timer4");
quest::say("The prisoner falls to the ground, legs kicking and fingers clawing at his throat. You have failed.");
#quest::me("The prisoner falls to the ground, legs kicking and fingers clawing at his throat. You have failed.");
quest::signalwith(201448, 2, 1);
#Event_Hanging_Control fail
quest::signalwith(201436, 0, 1);
#The tribunal fail
#spirit wasn't killed in time, fail event
}

}

sub EVENT_DEATH_COMPLETE {
quest::stoptimer("spirit_timer1");
quest::stoptimer("spirit_timer2");
quest::stoptimer("spirit_timer3");
quest::stoptimer("spirit_timer4");
quest::say("The prisoner gasps, taking in large breaths and coughing as the invisible noose disappears.");
#quest::me("The prisoner gasps, taking in large breaths and coughing as the invisible noose disappears.");
#Spirit killed, stop timers
}

Gallows_Master_Teion.pl

#Gallows_Master_Teion.pl
#Trial of Hanging
#Kilelen
#Modified by kilst87

sub EVENT_SIGNAL {
if ($signal == 1) {
quest::depop();
}
}

sub EVENT_DEATH_COMPLETE {

quest::signalwith(201448, 2, 5);
#stop timers and depop prisoners/#Event_Hanging_Control
}


a_stifling_nemesis.pl, A_Breathless_Void.pl, a_sentenced_prisoner.pl
sub EVENT_SIGNAL {
if ($signal == 1) {
quest::depop();
}
}

joligario
10-30-2014, 10:44 PM
PEQ added their version on 13 OCT. Maybe you can check it with yours and see where either can be improved! http://www.peqtgc.com/phpBB3/viewtopic.php?f=1&t=15129

kilst87
10-30-2014, 10:47 PM
Oh sweet, hadn't checked peq in a few weeks. Thanks for the link! Looks like all of them are complete. Well, the experience was fun anyway.

Edit: Their script looks really polished with lots of checks, so I won't be developing this any further.