Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Quests

Archive::Quests Archive area for Quests's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 05-14-2004, 02:06 PM
m0oni9
Hill Giant
 
Join Date: Dec 2003
Posts: 166
Default

Any chance you could look at changing these into C functions? As long as there is some sort of mob ID that can be used to look things up from the server it should be pretty doable. Also, a lot of those itoa() conversions, etc, could be done away with. Would save lots of overhead.

BTW, there is a typo in the below code: ExportVar(packagename.c_str(), "taget[hpp]", itoa(target->GetHPRatio()));
Reply With Quote
  #3  
Old 05-16-2004, 09:16 AM
smogo
Discordant
 
Join Date: Jan 2004
Location: 47
Posts: 339
Default

yup, this is gonna look like a bump to m0oni's post

If you can give it a try, accessing EMU variables from perl just takes you to declare prototype in a *.xs source file, then you call for that function in the quest as you need, instead of processing all ExportVars for each event.

Also, maybe i missed something, but is this is Perl, $target[xxx] just thrills me (means you exported the xxx as a constant to qstnnn:: package )

take a look there :
http://www.eqemulator.net/forums/viewtopic.php?t=12393
__________________
EQEMu Quest Repository is down until something new :(
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:44 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3