Ignorance
08-10-2011, 06:01 PM
I am having trouble getting a spawned mob to enter into the EVENT_TIMER subroutine. The mob executes EVENT_SPAWN and sets timers to appropriate values, but does not ever enter into EVENT_TIMER. I would be grateful if someone could look over the code and give some advice.
################################################## ##################################################
# Document Notes...
# Author: Ignorance (thecerealkillers@gmail.com)
# Created: 2011 08 01 Last Modified: 2011 08 08
# Related Files: Template_RemoteController, Template_LocalController, Template_Herald,
# Template_Translocator
# General File Relationships
# RemoteController <-Global Variables-> LocalController
# . . --> Herald, Translocator
# Loop Loop . .
# X X
# Translocator Description
# Periodically announces when and where the in-zone translocatation will happen.
# Executes translocation.
# Despawns after translocation.
# Despawns on errors.
################################################## ##################################################
@LocationNamesList = ( "Freeport Arena" );
@LocationX1List = ( -293 );
@LocationX2List = ( -155 );
@LocationY1List = ( -377 );
@LocationY2List = ( -267 );
@LocationZ1List = ( -39 );
@LocationZ2List = ( -24 );
sub EVENT_SPAWN
{
$timerNumber = 0;
if( !defined $qglobals{FightClubfreportwLocationsInZone} )
{
# Set locations in zone
quest::setglobal( "FightClubfreportwLocationsInZone", 1, 7, "F" );
}
if( defined $qglobals{FightClubFreeportPeriod} && defined $qglobals{FightClubTranslocateDuration} && defined $qglobals{FightClubTranslocatorAdPeriod} && defined $qglobals{FightClubfreportwLocationsInZone} )
{
# Randomize the in zone location chosen
quest::setglobal( "FightClubfreportwActiveLocation", (int( rand( $qglobals{FightClubfreportwLocationsInZone} )) + 1), 7, "F" );
# Set Advertizement Timers
while( $timerNumber < $qglobals{FightClubFreeportPeriod})
{
quest::settimer( $timerNumber, $timerNumber );
$timerNumber = $timerNumber + $qglobals{FightClubTranslocatorAdPeriod};
}
# Set Translocate Timer
quest::settimer( $qglobals{FightClubFreeportPeriod}, $qglobals{FightClubFreeportPeriod} );
# Set Translocation Close / Depop Timer
quest::settimer( ($qglobals{FightClubFreeportPeriod} + $qglobals{FightClubTranslocateDuration}), ($qglobals{FightClubFreeportPeriod} + $qglobals{FightClubTranslocateDuration}) );
}
else
{
# Global Variables Undefined, Bad Execution
quest::depop();
}
}
sub EVENT_TIMER
{
if( defined $qglobals{FightClubFreeportPeriod} && defined $qglobals{FightClubFreeportTranslocateDuration} && defined $qglobals{FightClubTranslocatorAdPeriod} && defined $qglobals{FightClubfreportwActiveLocation} )
{
$locationNumber = $qglobals{FightClubfreportwActiveLocation};
if( $timer == $qglobals{FightClubFreeportPeriod} )
{
quest::shout("Executing ".$LocationNamesList[$locationNumber]." teleport.");
# Execute Translocation
quest::set_proximity($LocationX1List[$locationNumber], $LocationX2List[$locationNumber], $LocationY1List[$locationNumber], $LocationY2List[$locationNumber], $LocationZ1List[$locationNumber], $LocationZ2List[$locationNumber]);
}
else
{
# Prevents double advertizing upon translocate execution
if( $timer % $qglobals{FightClubTranslocatorAdPeriod} )
{
# Advertize Location
quest::shout("The ".$LocationNamesList[$locationNumber]." teleport executes in ".( $qglobals{FightClubFreeportPeriod} - $timer )." seconds.");
}
}
if( $timer == ($qglobals{FightClubFreeportPeriod} + $qglobals{FightClubTranslocateDuration}) )
{
# Success, Despawn Mob
quest::shout( $LocationNamesList[$locationNumber]." teleport executed.");
quest::depop();
}
}
else
{
# Global Variables Undefined, Bad Execution
quest::depop();
}
}
sub EVENT_ENTER
{
quest::movepc( 96, 4366.94, -12256.9, -265 );
}
################################################## ##################################################
# Document Notes...
# Author: Ignorance (thecerealkillers@gmail.com)
# Created: 2011 08 01 Last Modified: 2011 08 08
# Related Files: Template_RemoteController, Template_LocalController, Template_Herald,
# Template_Translocator
# General File Relationships
# RemoteController <-Global Variables-> LocalController
# . . --> Herald, Translocator
# Loop Loop . .
# X X
# Translocator Description
# Periodically announces when and where the in-zone translocatation will happen.
# Executes translocation.
# Despawns after translocation.
# Despawns on errors.
################################################## ##################################################
@LocationNamesList = ( "Freeport Arena" );
@LocationX1List = ( -293 );
@LocationX2List = ( -155 );
@LocationY1List = ( -377 );
@LocationY2List = ( -267 );
@LocationZ1List = ( -39 );
@LocationZ2List = ( -24 );
sub EVENT_SPAWN
{
$timerNumber = 0;
if( !defined $qglobals{FightClubfreportwLocationsInZone} )
{
# Set locations in zone
quest::setglobal( "FightClubfreportwLocationsInZone", 1, 7, "F" );
}
if( defined $qglobals{FightClubFreeportPeriod} && defined $qglobals{FightClubTranslocateDuration} && defined $qglobals{FightClubTranslocatorAdPeriod} && defined $qglobals{FightClubfreportwLocationsInZone} )
{
# Randomize the in zone location chosen
quest::setglobal( "FightClubfreportwActiveLocation", (int( rand( $qglobals{FightClubfreportwLocationsInZone} )) + 1), 7, "F" );
# Set Advertizement Timers
while( $timerNumber < $qglobals{FightClubFreeportPeriod})
{
quest::settimer( $timerNumber, $timerNumber );
$timerNumber = $timerNumber + $qglobals{FightClubTranslocatorAdPeriod};
}
# Set Translocate Timer
quest::settimer( $qglobals{FightClubFreeportPeriod}, $qglobals{FightClubFreeportPeriod} );
# Set Translocation Close / Depop Timer
quest::settimer( ($qglobals{FightClubFreeportPeriod} + $qglobals{FightClubTranslocateDuration}), ($qglobals{FightClubFreeportPeriod} + $qglobals{FightClubTranslocateDuration}) );
}
else
{
# Global Variables Undefined, Bad Execution
quest::depop();
}
}
sub EVENT_TIMER
{
if( defined $qglobals{FightClubFreeportPeriod} && defined $qglobals{FightClubFreeportTranslocateDuration} && defined $qglobals{FightClubTranslocatorAdPeriod} && defined $qglobals{FightClubfreportwActiveLocation} )
{
$locationNumber = $qglobals{FightClubfreportwActiveLocation};
if( $timer == $qglobals{FightClubFreeportPeriod} )
{
quest::shout("Executing ".$LocationNamesList[$locationNumber]." teleport.");
# Execute Translocation
quest::set_proximity($LocationX1List[$locationNumber], $LocationX2List[$locationNumber], $LocationY1List[$locationNumber], $LocationY2List[$locationNumber], $LocationZ1List[$locationNumber], $LocationZ2List[$locationNumber]);
}
else
{
# Prevents double advertizing upon translocate execution
if( $timer % $qglobals{FightClubTranslocatorAdPeriod} )
{
# Advertize Location
quest::shout("The ".$LocationNamesList[$locationNumber]." teleport executes in ".( $qglobals{FightClubFreeportPeriod} - $timer )." seconds.");
}
}
if( $timer == ($qglobals{FightClubFreeportPeriod} + $qglobals{FightClubTranslocateDuration}) )
{
# Success, Despawn Mob
quest::shout( $LocationNamesList[$locationNumber]." teleport executed.");
quest::depop();
}
}
else
{
# Global Variables Undefined, Bad Execution
quest::depop();
}
}
sub EVENT_ENTER
{
quest::movepc( 96, 4366.94, -12256.9, -265 );
}