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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 05-06-2002, 12:47 PM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default Basic Feign Death code

After around eight hours of struggling with this, it's complete. It's very crude right now, has no "remember" factor and will only work if you're top on aggro.

Next version should have both of these fixed.

Insert into client_process.cpp:

Where the code for standing up is:
Code:
							if (sa->parameter == 0x64)
							{
//								cout << "Client " << name << " standing" << endl;
								appearance = 0;
								this->SetFeigned(0);
							}
Among skills code:
Code:
					case OP_FeignDeath:
					{
						int feignchance = GetSkill(FEIGN_DEATH);
						int primfeign = GetSkill(FEIGN_DEATH);
						if (primfeign > 100) {
							primfeign = 100;
						}
						int secfeign = GetSkill(FEIGN_DEATH);
						if (secfeign < 101) {
							secfeign = 0;
						}
						else {
							secfeign = secfeign - 100;
							secfeign = secfeign / 2;
						}
						int totalfeign = primfeign + secfeign;
						if (rand()%160 > (totalfeign)) {
							Message(0,"You have fallen to the ground");
							this->SetFeigned(0);
							appearance = 3;
						}
						else {
							this->SetFeigned(1);
							appearance = 3;
						}
						if (rand()%210 > feignchance && rand()%3 == 1 && GetSkill(FEIGN_DEATH) < 200 && GetSkill(FEIGN_DEATH) < this->GetLevel()*5+5 ) {
						    this->SetSkill(25,++pp.skills[25]);
							UpdateWho();
						}
						break;
					}
Client.cpp

Insert to bottom of Client:Client (below isgrouped=false)
Code:
	feigned = 0;
Insert to bottom of client.cpp
Code:
void Client::SetFeigned(int8 in_feigned) {
	feigned=in_feigned;
 }
client.h

Insert below bool GetPVP() { return pp.pvp; }
Code:
	void	SetFeigned(int8 in_feigned);
	int8    GetFeigned()	{ return feigned; }
Insert at bottom of client.h, just above
};
#endif

Code:
	int8 feigned;
npcAI.cpp

Replace if (!sender->IsEngaged()) with:

Code:
if (!sender->IsEngaged() && currentmob->CastToClient()>GetFeigned() != 1)
npc.cpp

And finally, just above if (target->GetID() != this->ownerid && attack_timer->Check()) (line 334) add:

Code:
if (hate_list.GetTop()->CastToClient()->GetFeigned() == 1) {
				RemoveFromHateList(GetHateTop());
			}
There it is
Reply With Quote
  #2  
Old 05-07-2002, 03:05 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Version 2.0:

- Fixed a couple crash bugs
- Added basic spell breaks feign support
- Added basic memory code (NPC's can only remember one person right now, and if it returns to spawn point, memory list is wiped)

npc.cpp:

At the top of the script, just below extern SPDat_Spell_Struct spells[SPDAT_RECORDS]; add:

Code:
int feigntimer = 0;
int forgetchance = 0;
Remove the old hate_list code, add this one instead, right above return true; on line 505 (above summon code):

Code:
	if (IsEngaged()) {
		if (hate_list.GetTop()->CastToClient()->GetFeigned() == 1) {
				char* the_id = hate_list.GetTop()->CastToClient()->GetName();
				if (this->GetLevel() > 34) {
					this->SetFeignMemory(the_id);
				}
				RemoveFromHateList(GetHateTop());
			}
	}
Then add this right below what you just added in:

Code:
	if (this->GetFeignMemory() != "0") {
		Client* remember_client = entity_list.GetClientByName(this->GetFeignMemory());
		if (remember_client) {
			if (remember_client->CastToClient()->GetFeigned()==0) {
				AddToHateList(remember_client,1);
				this->SetFeignMemory("0");
				forgetchance = 0;
			}
			else if (feigntimer > 0) {
				feigntimer = feigntimer - 1;
			}
			else if (rand()%100 <= forgetchance && feigntimer == 0) {
				this->SetFeignMemory("0");
				feigntimer = 100;
				forgetchance = 0;
			}
			else if (feigntimer == 0) {
				feigntimer = 100;
				forgetchance = forgetchance + 4;
			}
		}
		else {
			this->SetFeignMemory("0");
		}
	}
Now, go into mob.cpp. In mob::mob right below invisible = false; add:

Code:
	feign_memory = "0";
Add this to the very bottom of mob.cpp:

Code:
void Mob::SetFeignMemory(char* in_feign_memory) {
	feign_memory=in_feign_memory;
 }
Then go into mob.h. Right below int16 d_meele_texture2; add:

Code:
	char*    feign_memory;
Then in the main function array, for example under void CheckPet(); add:

Code:
	void	SetFeignMemory(char* in_feign_memory);
	char*    GetFeignMemory()	{ return feign_memory; }
Then, in spells.cpp, on whatever spell formulas you want to break feign:

Code:
			if (this->CastToClient()->GetFeigned()==1) {
				this->Message(0,"You are no longer feigning death because a spell hit you!");
				this->CastToClient()->SetFeigned(0);
			}
There. Current functions of my feign code:

- Skill gain, success and failure.
- All mobs will stop attacking you on success, if you are top of their aggro list.
- Mobs will not aggro a feigned person.
- Mobs above level 34, if they haven't returned to their spawn point, will remember one feigned person (last person who feigned). Every few seconds they have a chance to forget him. If he stands up while on memory list, they'll reaggro.
- Spells will interrupt feign.
Reply With Quote
  #3  
Old 05-07-2002, 03:10 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Also, a little todo list:

- Replace getting top aggro with cycling through aggro list.
- Support for larger memory lists.
- Spell FD with skill checks against abjure.
Reply With Quote
  #4  
Old 05-07-2002, 04:02 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Edited version 2.0 post with a couple tweaks and a bug fix.
Reply With Quote
  #5  
Old 05-07-2002, 09:56 AM
Maniac
Fire Beetle
 
Join Date: May 2002
Posts: 0
Default

when adding something like this, you complile this and all the other source files together as your zone program right? Bit new to this =)
Reply With Quote
  #6  
Old 05-07-2002, 11:09 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Right, Maniac.
Reply With Quote
  #7  
Old 05-07-2002, 01:20 PM
Maniac
Fire Beetle
 
Join Date: May 2002
Posts: 0
Default

Ok i spent like 20 mins adding all the files
to a project to find it wouldn't compile.
Is there a certain compiler i need?
Reply With Quote
  #8  
Old 05-07-2002, 01:34 PM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

What are you using? Virtual C++?
Reply With Quote
  #9  
Old 05-07-2002, 01:35 PM
Maniac
Fire Beetle
 
Join Date: May 2002
Posts: 0
Default

Dev C++ , a free one i found a while back. Open to suggestions for a better one to use =)
Reply With Quote
  #10  
Old 05-07-2002, 01:43 PM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Well, what are the compilation problems? You should just have to open the zone.dsw and compile.
Reply With Quote
  #11  
Old 05-08-2002, 11:50 AM
Maniac
Fire Beetle
 
Join Date: May 2002
Posts: 0
Default

The fact i don't seem to have zone.dsw could be a start =P
Reply With Quote
  #12  
Old 05-08-2002, 12:40 PM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Redownload the 0.3.1.1 source.
Reply With Quote
  #13  
Old 05-09-2002, 08:41 AM
Maniac
Fire Beetle
 
Join Date: May 2002
Posts: 0
Default

just did but only contained server, world, and client .dsw ...sorry to take up so much space with posts hehe =)
Reply With Quote
  #14  
Old 05-09-2002, 01:18 PM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default

Well yeah, use server.dsw then, and compile the Zone... paste any errors here.
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:24 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