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 04-02-2004, 10:05 PM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default EVENT_HP

Here's an example on how you can use it :

Code:
sub EVENT_SPAWN
{
  quest::setnexthpevent(80);
}

sub EVENT_HP
{
  if ( $hpevent == 80 ) {
   quest::say("I have $hpratio % HP!");
   quest::setnexthpevent(45);
  }
  if ( $hpevent == 45 ) {
   quest::say("I have $hpratio % HP!");
  }
}
you have at first to initialize the hp event in an EVENT_SPAWN fonction

setnexthpevent(hp) is a command to fix at which hp ratio of the npc the next HP_EVENT will be triggered, in the example it is 80%

and there is 2 variables : $hpevent and $hpratio

$hpevent identifies the event

to implement this you have to change all this :

in mob.h : in the class Mob, just before the protected word : ~line 623 :
Code:
	// HP Event
	inline int& GetNextHPEvent() { return nexthpevent; }
	void SetNextHPEvent( int hpevent );
and in mob.h again : in the class Mob, after the protected word where you want :
Code:
	// HP Event
	int nexthpevent;
in mob.cpp now :
in the constructor :
~line 320
add this before the end '}' :
Code:
	//HP Event
	nexthpevent = 0;
in mob.cpp again :
in the function : void Mob::CreateHPPacket(APPLAYER* app, bool sendself)
where you see :
Quote:
// they don't need to know the real hp
ds->cur_hp = (int)GetHPRatio();
ds->max_hp = 100;
add this in the else : after line "ds->max_hp=100;" for example
Quote:
// hp event
if ( IsNPC() && ( GetNextHPEvent() > 0 ) ) {
if ( ds->cur_hp < GetNextHPEvent() ) {
int lasthpevent = GetNextHPEvent();
parse->Event(EVENT_HP, GetNPCTypeID(), 0, this, 0);
if ( lasthpevent == GetNextHPEvent() )
SetNextHPEvent(0);
}
}
in mob.cpp again :
at the end of the file add this :
Quote:
// HP Event
void Mob::SetNextHPEvent( int hpevent ) {
nexthpevent = hpevent;
if ( nexthpevent < 0 ) {
nexthpevent = 0;
}
}
now in parser.cpp :
at the end of the function :
void Parser::ExCommands(string command, string parms, int argnums, int32 npcid, Mob* other, Mob* mob )
~ line 1257 after :
Code:
			else if (!strcmp(strlwr(command),"rebind")) {
				if(mob->IsClient()){
					if (mob) mob->CastToClient()->SetBindPoint( atoi(arglist[0]), atof(arglist[1]), atof(arglist[2]), atof(arglist[3]));
				}
			}
add this :
Code:
			// HP Event
			else if (!strcmp(strlwr(command),"setnexthpevent")) {
				if (other) other->SetNextHPEvent( atoi(arglist[0]) );
			}
that's not finished =)

now in embparser.cpp :
in the function : void PerlembParser::Event(int event, int32 npcid, const char * data, Mob* npcmob, Mob* mob)
~ line 271 after the case EVENT_SIGNAL for example :
add this :
Code:
// HP_Event
		case EVENT_HP: {
			if (npcmob) {
				ExportVar(packagename.c_str(), "hpevent", itoa(npcmob->GetNextHPEvent()));
				ExportVar(packagename.c_str(), "hpratio", itoa(npcmob->GetHPRatio())); 
				SendCommands(packagename.c_str(), "EVENT_HP", npcid, npcmob, mob);
			}
			break;
		}
in embarser.cpp again :
in function : void PerlembParser::map_funs(void) const
add this after scop2k global commands ~line 440:
Code:
// HP Event
"sub setnexthpevent{push(@cmd_queue,{func=>'setnexthpevent',args=>join(',',@_)});}"
and finally in event_codes.h :
add this at the end :
Quote:
#define EVENT_HP 10
__________________
Sandy
Reply With Quote
  #2  
Old 04-03-2004, 10:06 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

forgot the initialisation in mob.cpp ' s constructor line 318
nexthpevent = 0;
__________________
Sandy
Reply With Quote
  #3  
Old 04-03-2004, 11:22 AM
Shadow-Wolf
Dragon
 
Join Date: Oct 2003
Posts: 511
Default

looks to be correct, id do it but ive been having some problems with my compiler. could you maybe send me binaries with your functions enabled?
Reply With Quote
  #4  
Old 04-22-2004, 09:44 PM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

did someone try it ???
__________________
Sandy
Reply With Quote
  #5  
Old 04-30-2004, 08:30 AM
Cripp's Avatar
Cripp
Discordant
 
Join Date: Oct 2003
Location: The Shire
Posts: 474
Default

ill try it as soon as i get my world codes the way i want them hehehe. for some reason im getting that item bug and im at still running 5.6 :(
__________________
Nug Blazers - ServerOP / founder
^^comming... later!

www.nugblazers.com
Reply With Quote
  #6  
Old 05-20-2004, 08:26 AM
t7x53
Fire Beetle
 
Join Date: May 2004
Posts: 12
Default

I know the post is almost a month old but has it been added to any of the more recent source releases?
Reply With Quote
  #7  
Old 05-21-2004, 07:04 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

not added =)
__________________
Sandy
Reply With Quote
  #8  
Old 05-21-2004, 05:47 PM
t7x53
Fire Beetle
 
Join Date: May 2004
Posts: 12
Default

I tested this and the events themselves seem to work fine, but if I use a quest::spawn() inside any of the events I get a casttoclient mob error maybe 15 times at which point the zone crashes. Any ideas if I'm doing something wrong or if it's the code? I can still use quest::spawn outside of the Hp events and it works.
Reply With Quote
  #9  
Old 05-24-2004, 01:50 AM
sandy
Hill Giant
 
Join Date: Oct 2002
Posts: 212
Default

no idea, for me it is working

only bug i have is when I give a spawn event script to a monster that i spawned with quest::spawn
__________________
Sandy
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 12:16 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3