Loading...   

[Show Table of Contents]


Player quests are very similar to NPC quests, much of the basic structure and function is retained. The differences being of course what variables are exported and what events are triggered, and of course instead of the quests being saved to 12345.pl or Bob_the_Mob.pl (Example file names) they are saved to player.pl in the zone folder, or global_player in the global folder.

§Events

The following events are triggered under player quests:

sub EVENT_CAST - Triggered when a client casts a spell. Exports $spell_id.
sub EVENT_CLICKDOOR - Triggered when the client clicks on a door object. and exports variable $doorid.
sub EVENT_CLICK_OBJECT - Triggered when the client clicks on an object. Exports variable $objectid which holds the entity id of the clicked object.
sub EVENT_COMBINE_SUCCESS - Triggered when a combine is successful. Used in player.pl. Exports $recipe_name and $recipe_id.
sub EVENT_COMBINE_FAILURE - Triggered when a combine is unsuccessful. Used in player.pl. Exports $recipe_name and $recipe_id.
sub EVENT_DISCOVER_ITEM - Triggered when an item is discovered (looted, tradeskilled, purchased, quest/task rewarded) for the first time (if #gm is off). Exports $itemid variable.
sub EVENT_ENTERZONE - Triggered when a player enters the zone.
sub EVENT_GROUP_CHANGE - Triggered when a group change occurs. Exports $grouped and $raided which are 0 for false, 1 for true.
sub EVENT_ITEM_ENTER_ZONE - Called when an item that would trigger EVENT_SCALE_CALC is in the inventory when a player zones in.
sub EVENT_LEVEL_UP - Triggered when the player gains a level.
sub EVENT_LOOT - Triggered when a player successfully loots an item from a corpse. Exports $looted_id and $looted_charges.
sub EVENT_PLAYER_PICKUP - Triggered when a player picks up an object from the ground. Exports $picked_up_id.
sub EVENT_POPUPRESPONSE - Used with quest::popup. Exports $popupid. Triggered when OK or Yes button is pressed by player.
sub EVENT_SIGNAL - Triggered by a call to quest::signal() or quest::signalwith().
sub EVENT_TARGET_CHANGE - Triggered when a mob changes their current target or clears it.
sub EVENT_TASK_STAGE_COMPLETE - Triggered when a task stage is completed. Exports $task_id and $activity_id.
sub EVENT_TIMER - Triggered by a quest::settimer(). Exports $timer.
sub EVENT_ZONE - Triggered when a player zones. Exports $target_zone_id.

§Variables and Qglobals

Qglobals will be automatically exported if the client should be able to see them, this means NPC-specific globals will NOT be exported to player quests. Generally the variables exported to player quests are the ones that do not deal with direct NPC interaction, so for example $ulevel is exported to player quests but $x, $y, and $z are not. If you are using Perl classes, which is very likely you will notice that the $npc object is not exported while the $client object is.

§Examples

Various examples to illustrate what can be accomplished with these quests:

A message when a player enters a zone
sub EVENT_ENTERZONE {	
	$client->Message(257, "A mysterious voice whispers to you, 'If you can feel me in your thoughts than you're seeing a player quest in action.'");
}
§Looting an item
sub EVENT_LOOT {
	$client->Message(15, "You've looted " . quest::varlink($looted_id) . " with $looted_charges charges");
}
§Leveling up
sub EVENT_LEVEL_UP {
	$client->Message(15, "You've leveled up, you are now $ulevel, perhaps you should go adventure elsewhere now.");
}
§Zoning
sub EVENT_ZONE {
	$client->Message(15, "You are trying to zone to zone ID $target_zone_id.");
}
  • A note about zoning: when this event is triggered the client is locked up awaiting a response from the server on the status of the zone attempt so $client->Message() will not work, the client will not even see it after the zoning is complete
§Clicking a door object
sub EVENT_CLICKDOOR {
	$client->Message(15, "You clicked a door with the ID $doorid.");
}
§Casting a spell
sub EVENT_CAST {
	$client->Message(15, "You cast a spell with the ID $spell_id.");
}

§A Larger Example

This example is based off Project EQ's version of the planes of power in the plane of tranquility, this example excludes some of the qglobal work at the end as it does not really pertain to the example.

sub EVENT_CLICKDOOR {
	
	#postorms, do the trials or be level 55 or higher
	if($doorid == 16 || $doorid == 272){
		if($client->GetLevel() >= 55 || ($pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1)) {
			if(quest::has_zone_flag(210) != 1) {
				quest::set_zone_flag(210);
				$client->Message(15, "You have received a character flag!");
			}
		}
	}

	#povalor, do the trials or be level 55 or higher
	if(($doorid == 21 || $doorid == 277 ) || ($doorid == 11 || $doorid == 267) || (($doorid == 20 || $doorid == 276))){
		if($client->GetLevel() >= 55 || ($pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1)) {
			if(quest::has_zone_flag(208) != 1) {
				quest::set_zone_flag(208);
				$client->Message(15, "You have received a character flag!");
			}
		}	
	}		
	
	#codecay, done the grummus quests, get bangle of disease warding from the alt access quest or be level 62 or higher
	if($doorid == 12 || $doorid == 268){
		if($client->GetLevel() >= 55 || ($pop_pod_alder_fuirstel == 1 && $pop_pod_grimmus_planar_projection == 1 && $pop_pod_elder_fuirstel == 1)) {
			if(quest::has_zone_flag(200) != 1) {
				quest::set_zone_flag(200);
				$client->Message(15, "You have received a character flag!");
			}		
		}
	}

	#potorment, done the terris and bertox line or level 62 or higher, there is also an alternate access quest
	if($doorid == 93 || $doorid == 349){
		if($client->GetLevel() >= 62 || ($pop_pod_alder_fuirstel == 1 && $pop_pod_grimmus_planar_projection == 1 && $pop_pod_elder_fuirstel == 1 && $pop_pon_construct == 1 && $pop_pon_hedge_jezith == 1 && $pop_ponb_terris == 1 && $pop_ponb_poxbourne && $pop_cod_preflag == 1 && $pop_cod_bertox == 1 && $pop_cod_final == 1)) {
			if(quest::has_zone_flag(207) != 1) {
				quest::set_zone_flag(207);
				$client->Message(15, "You have received a character flag!");
			}				
		}
	}		
	
	#bothunder, level 62 or higher; if done the askr line can get your flag in postorms.
	if($doorid == 48 || $doorid == 304){
		if($client->GetLevel() >= 62 || ($pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1 && $pop_pos_askr_the_lost == 3 && $pop_pos_askr_the_lost_final == 1)) {
			if(quest::has_zone_flag(209) != 1) {
				quest::set_zone_flag(209);
				$client->Message(15, "You have received a character flag!");
			}				
		}
	}	

	#hohonora, done the aerin line or level 62 or higher
	if($doorid == 23 || $doorid == 279){
		if($client->GetLevel() >= 62 || ($pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1 && $pop_pov_aerin_dar == 1)) {
			if(quest::has_zone_flag(211) != 1) {
				quest::set_zone_flag(211);
				$client->Message(15, "You have received a character flag!");
			}				
		}	
	}	

	#tactics done the normal quests or completed diaku emblem from the alt access quest
	if($doorid == 24 || $doorid == 280){
		if($pop_poi_dragon == 1 && $pop_poi_behometh_preflag == 1 && $pop_poi_behometh_flag == 1) {
			if(quest::has_zone_flag(214) != 1) {
				quest::set_zone_flag(214);
				$client->Message(15, "You have received a character flag!");
			}				
		}		
	}		
	
	#solrotower do the normal quests or the alternate access quest
	if($doorid == 22 || $doorid == 278){
		if($pop_poi_dragon == 1 && $pop_poi_behometh_preflag == 1 && $pop_poi_behometh_flag == 1 && $pop_tactics_tallon == 1 && $pop_tactics_vallon == 1 && $pop_tactics_ralloz == 1) {
			if(quest::has_zone_flag(212) != 1) {
				quest::set_zone_flag(212);
				$client->Message(15, "You have received a character flag!");
			}				
		}		
	}				
			
	#pofire do the normal quests
	if($doorid == 82 || $doorid == 338){
		if($pop_poi_dragon == 1 && $pop_poi_behometh_preflag == 1 && $pop_poi_behometh_flag == 1 && $pop_tactics_tallon == 1 && $pop_tactics_vallon == 1 && $pop_tactics_ralloz == 1 && $pop_sol_ro_arlyxir == 1 && $pop_sol_ro_jiva == 1 && $pop_sol_ro_rizlona == 1 && $pop_sol_ro_dresolik == 1 && $pop_sol_ro_xuzl == 1 && $pop_sol_ro_solusk == 1) {
			if(quest::has_zone_flag(217) != 1) {
				quest::set_zone_flag(217);
				$client->Message(15, "You have received a character flag!");
			}				
		}		
	}

	#poair do the normal quests
	if($doorid == 81 || $doorid == 337){
		if($pop_hohb_marr == 1 && $pop_bot_agnarr == 1 && $pop_pon_hedge_jezith == 1 && $pop_pon_construct == 1 && $pop_ponb_terris == 1 && $pop_ponb_poxbourne == 1 && $pop_pod_alder_fuirstel == 1 && $pop_pod_grimmus_planar_projection == 1 && $pop_pod_elder_fuirstel == 1 && $pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1 && $pop_pov_aerin_dar == 1 && $pop_pos_askr_the_lost == 3 && $pop_pos_askr_the_lost_final == 1 && $pop_cod_preflag == 1 && $pop_cod_bertox == 1 && $pop_cod_final == 1 && $pop_pot_shadyglade == 1 && $pop_pot_shadyglade == 1 && $pop_pot_saryrn == 1 && $pop_pot_saryn_final == 1 && $pop_hoh_faye == 1 && $pop_hoh_trell == 1 && $pop_hoh_garn == 1 && $pop_elemental_grand_librarian == 1) {
			if(quest::has_zone_flag(215) != 1) {
				quest::set_zone_flag(215);
				$client->Message(15, "You have received a character flag!");
			}				
		}	
	}	
	
	#poeartha do the normal quests
	if($doorid == 83 || $doorid == 339){
		if($pop_hohb_marr == 1 && $pop_bot_agnarr == 1 && $pop_pon_hedge_jezith == 1 && $pop_pon_construct == 1 && $pop_ponb_terris == 1 && $pop_ponb_poxbourne == 1 && $pop_pod_alder_fuirstel == 1 && $pop_pod_grimmus_planar_projection == 1 && $pop_pod_elder_fuirstel == 1 && $pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1 && $pop_pov_aerin_dar == 1 && $pop_pos_askr_the_lost == 3 && $pop_pos_askr_the_lost_final == 1 && $pop_cod_preflag == 1 && $pop_cod_bertox == 1 && $pop_cod_final == 1 && $pop_pot_shadyglade == 1 && $pop_pot_shadyglade == 1 && $pop_pot_saryrn == 1 && $pop_pot_saryn_final == 1 && $pop_hoh_faye == 1 && $pop_hoh_trell == 1 && $pop_hoh_garn == 1 && $pop_elemental_grand_librarian == 1) {
			if(quest::has_zone_flag(218) != 1) {
				quest::set_zone_flag(218);
				$client->Message(15, "You have received a character flag!");
			}				
		}		
	}
	
	#powater do the normal quests
	if($doorid == 84 || $doorid == 340){
		if($pop_hohb_marr == 1 && $pop_bot_agnarr == 1 && $pop_pon_hedge_jezith == 1 && $pop_pon_construct == 1 && $pop_ponb_terris == 1 && $pop_ponb_poxbourne == 1 && $pop_pod_alder_fuirstel == 1 && $pop_pod_grimmus_planar_projection == 1 && $pop_pod_elder_fuirstel == 1 && $pop_poj_mavuin == 1 && $pop_poj_tribunal == 1 && $pop_poj_valor_storms == 1 && $pop_pov_aerin_dar == 1 && $pop_pos_askr_the_lost == 3 && $pop_pos_askr_the_lost_final == 1 && $pop_cod_preflag == 1 && $pop_cod_bertox == 1 && $pop_cod_final == 1 && $pop_pot_shadyglade == 1 && $pop_pot_shadyglade == 1 && $pop_pot_saryrn == 1 && $pop_pot_saryn_final == 1 && $pop_hoh_faye == 1 && $pop_hoh_trell == 1 && $pop_hoh_garn == 1 && $pop_elemental_grand_librarian == 1) {
			if(quest::has_zone_flag(216) != 1) {
				quest::set_zone_flag(216);
				$client->Message(15, "You have received a character flag!");
			}				
		}		
	}
}