View Single Post
  #1  
Old 05-14-2004, 11:03 AM
Rogean's Avatar
Rogean
Administrator
 
Join Date: Jul 2003
Location: Massachusetts
Posts: 708
Default Target Variables

I wanted people to have a change to test these before i put them in the code. Heres some more Variables!

$hpp - Returns the HitPoints Numerical Perecent of the Mob
$engaged - Returns 1 if the mob is Engaged (Attacking)
$hastarget - Returns 1 if the mob has a Target
$target[isclient] - Returns 1 if our target IS a Client (Player)
$target[accountid] - Returns Account Id if mob's target is a Client
$target[accountname] - Returns Account Name if mob's target is a client
$target[charid] - Returns CharacterID if mob's target is a client
$target[userid] - Returns UserID if mob's target is a client
$target[guildrank] - Returns Guild Rank if mob's target is a client
$target[status] - Returns Status if mob's target is a client
$target[isnpc] - Returns 1 if mob's target is an NPC
$target[name] - Returns the Name of the mob's target
$target[race] - Returns the Race of the mob's target
$target[class] - Returns the Class of the mob's target
$target[level] - Returns the Level of the mob's target
$target[hpp] - Returns the HitPoint Percent of the mob's target

Here is the Code:

Code:
EmbParser.cpp in PerlembParser::Event Under packagename = GetPkgPrefix(npcid); Add:

	ExportVar(packagename.c_str(), "hpp", itoa(npcmob->GetHPRatio()));
	if (npcmob->IsEngaged()) ExportVar(packagename.c_str(), "engaged", "1");
	if (npcmob->GetTarget()) {
		ExportVar(packagename.c_str(), "hastarget", "1");
		Mob* target = npcmob->GetTarget();
		if (target->IsClient()) {
			ExportVar(packagename.c_str(), "target[isclient]", "1");
			ExportVar(packagename.c_str(), "target[accountid]", itoa(target->CastToClient()->AccountID()));
			ExportVar(packagename.c_str(), "target[accountname]", target->CastToClient()->AccountName());
			ExportVar(packagename.c_str(), "target[charid]", itoa(target->CastToClient()->CharacterID()));
			ExportVar(packagename.c_str(), "target[userid]", itoa(target->GetID()));
			ExportVar(packagename.c_str(), "target[guildrank]", itoa(target->CastToClient()->GuildRank()));
			ExportVar(packagename.c_str(), "target[status]", itoa(target->CastToClient()->Admin())); 

		} else ExportVar(packagename.c_str(), "target[isnpc]", "1");

		ExportVar(packagename.c_str(), "target[name]", target->GetName());
		ExportVar(packagename.c_str(), "target[race]", GetRaceName(target->GetRace()));
		ExportVar(packagename.c_str(), "target[class]", GetEQClassName(target->GetClass()));
		ExportVar(packagename.c_str(), "target[level]", itoa(target->GetLevel()));
		ExportVar(packagename.c_str(), "taget[hpp]", itoa(target->GetHPRatio()));
	}
Thats it! Compile and have fun. Heres an example Death Touch script that will cause the mob to DT His Target every 5 minutes:

Code:
sub EVENT_SPAWN
{
	quest::settimer(1,300);

sub EVENT_ATTACK
{
	if (!$hastouched){
		quest::castspell($userid,982);
		quest::setglobal("hastouched","1","7","M5");
	}
}

sub EVENT_TIMER
{
	if (!$hastouched && $hastarget && $engaged){
		quest::castspell($userid,982);
		quest::setglobal("hastouched","1","7","M5");
	}
}
Go test and post how it works =)
__________________
EQEmulator Developer / Administrator
Reply With Quote