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.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-02-2002, 06:38 AM
quester
Hill Giant
 
Join Date: Oct 2002
Posts: 108
Default Here is code (DIFFs) to add mob melee procs

I've added in code to allow mobs to have melee procs...I'm sure it could be improved.. mainly the chance formula probably sucks, so i'm open to improvements.

The big problem I see here, is that currently in the emu it appears every mob always has a DEX of 75. IMHO, the npc_types DB should be expanded to allow stats to be set.

The following info should give you everythign needed to add this change.. You need to recompile both the shared dll and the zone server. You also need to make a small DB addition.

To add this code:
1) You will need to modify your npc_types table to add a new column:
"mysql.exe"
"use eq;"
"ALTER TABLE npc_types ADD npcproc int(7);"

2) DIFFs for changed files:
zone/attack.cpp
Code:
779d778
<     if (this->ownerid != 0)
779a779,781
> 	// quester: All NPCs now have the ability to proc melee abilities
> 	// so removign this special proc code for pets
>     /*if (this->ownerid != 0)
804c806
<     }
==========
>     }*/
854a857,876
> 	  
> 	  // quester: added for npc procs
> 	  // Attempt to proc on target.. NPCs CAN proc on a miss!
> 	  // Proc percentages are based on DEX, and will probably need to be tuned
> 	  // I'm no mathemitician, so its a sure bet this formula can be improved
> 	  int16 myProc = this->NPCProc;
> 	  int16 myDex = this->DEX;
> 	  if ((myProc > 0) && (myProc < 65535))
> 	  {
> 		//this->target->CastToClient()->Message(0, "Checking for mob proc chance, effect: %i", myProc);
> 		if (myDex <= 0)
> 			myDex = 1;
> 		//this->target->CastToClient()->Message(0, "Mob's DEX: %i", myDex);
> 		float procChance = myDex / 300.0f;
> 		procChance = procChance * 100.0f;
> 		//this->target->CastToClient()->Message(0, "Mob's proc chancet: %f", myProc);
> 	    if (((float)rand()/RAND_MAX)*100 <= procChance)
> 		{
> 			// Proc
> 			this->SpellFinished(myProc, this->target->GetID(), 10, 0);
855a878,880
> 		else
> 		{
> 			// No Proc
856a882,885
> 	  }
> 
>     }
>   }
common/database.cpp
Code:
2257c2257
< 	query = new char[256];
==========
> 	query = new char[300];
2279a2280
> 			// quester: added npcproc field
2280c2281
< 			MakeAnyLenString(&query, "SELECT id,name,level,race,class,hp,gender,texture,helmtexture,size,loottable_id, merchant_id, banish, mindmg, maxdmg, npcspecialattks,usedspells,d_meele_texture1,d_meele_texture2, walkspeed, runspeed,fixedz,hp_regen_rate,mana_regen_rate FROM npc_types");//WHERE zone='%s'", zone_name
==========
> 			MakeAnyLenString(&query, "SELECT id,name,level,race,class,hp,gender,texture,helmtexture,size,loottable_id, merchant_id, banish, mindmg, maxdmg, npcspecialattks,usedspells,d_meele_texture1,d_meele_texture2, walkspeed, runspeed,fixedz,hp_regen_rate,mana_regen_rate, npcproc FROM npc_types");//WHERE zone='%s'", zone_name
2318a2320,2322
> 					// quester: added npcproc field
> 					if (row[24])
> 						tmpNPCType.npcproc = atoi(row[24]);
zone/npc.cpp
Code:
115a116
> 	NPCProc = d->npcproc;
zone/zonedump.h
Code:
88a89,90
> 	// quester: added for npc melee procs.. contains effect ID of spell to proc
> 	int16	npcproc;
zone/npc.h
Code:
89a90
> 	int16 NPCProc; // quester: added for NPC melee procs
To make a mob have a melee proc, simply insert the effect ID you want procced in the "npcproc" column which I added to the npc_types table. You will need to do this with mysql since the admin tool doesn't know about it:

"mysql"
"use eq;"
"UPDATE npc_types SET npcproc=901 WHERE id=5509;"

The abopve example, would give the proc 901 (GhoulRoot) to the npc_type identified by ID 5509, which is "a_ghoul"

If anyone has suggestions on improving the proc formula, once again i'd be glad to hear it. I know it can be improved.

Hopefully I haven't left anythign out here that you need, but if I did let me know and I will edit the message. This is tested on my server and it does work. Although since every mob right now has a DEX of 75, the chance of proc is low.. 25% I think it comes out too... In a (short) fight with a ghoul, I got rooted once.
Reply With Quote
 


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 07:08 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