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

11-02-2002, 06:38 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
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.
|
 |
|
 |

11-02-2002, 11:43 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Damn good addition...
I can tell you've coded professionally, you actually commented your code.. LOL...
|

11-02-2002, 02:00 PM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Nice addition.
Suggest you make myDEX bigger than int8 though, dex is a int16 value.
|

11-02-2002, 03:42 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
Quote:
Originally Posted by Trumpcard
Damn good addition...
I can tell you've coded professionally, you actually commented your code.. LOL...
|
Heh, yeah I own my own development company.. and in fact worked on EQ in the past.
That code SHOULD be commented more, but I plan to do some revamping so I wastn' too worried aout it. Thanks for the "comments" though :p
|

11-02-2002, 03:44 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
Quote:
Originally Posted by Wiz
Nice addition.
Suggest you make myDEX bigger than int8 though, dex is a int16 value.
|
Nice catch.. thanks. I'll make that change.
The issue of the NPC stats needs to be looked at though. Currently they are all hardcoded to 75, and no way to change them. Ideally, the stats, and AC, should be added as new columns in the npc_types database. Thats how they are in the real EQ database IIRC. (Not positive, because to be honest 99% of the time we would just copy a record from a similiar mob and alter it as needed.. I do'nt think I ever once set stats on a mob while I worked there lol).
|

11-02-2002, 04:08 PM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
Do weapons proc at the moment, for either PC or NPC?
If not, I think I will pull this out into its own function, and put tie ins so that PC and PC used weapons will also proc.
|

11-03-2002, 03:38 AM
|
Discordant
|
|
Join Date: May 2002
Posts: 434
|
|
PC weapons proc, npcs should too
__________________
++[>++++++<-]>[<++++++>-]<.>++++[>+++++<-]>[<
+++++>-]<+.+++++++..+++.>>+++++[<++++++>-]<+
+.<<+++++++++++++++.>.+++.------.--------.>+.
|

11-03-2002, 06:18 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
Ok great.. then I won't worry about that part.
|

11-03-2002, 06:25 AM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
Can NPC's even equip weapons?
|

11-03-2002, 10:17 AM
|
Fire Beetle
|
|
Join Date: Sep 2002
Posts: 0
|
|
yes.
NPCs drop weapons, and 90% of the time they are wielding it.
Example:
In Highpass Hold there is a gnoll that drops an axe that has a buff proc, while fighting him there is a chance that he will proc it.
But a lot of NPCs have weapons that are in their model.. like some of the PoP gods.
|

11-03-2002, 10:22 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
It appears I can't give a weapon to an NPC though and have them equip it.
I just sumoned up a pet and gave it a weapon.. it never equipped it.
I'm diggig through the code now trying to find the trade stuff to see if I can iron it out.
|

11-03-2002, 01:20 PM
|
Dragon
|
|
Join Date: Feb 2002
Posts: 583
|
|
I meant in EQemu. i haven't seen any code for NPC inventories.
|

11-11-2002, 03:26 AM
|
Fire Beetle
|
|
Join Date: Sep 2002
Posts: 0
|
|
Curious, considering pets arent NPCs in the database, how does your code manage their procs?
|

11-11-2002, 06:08 PM
|
 |
Dragon
|
|
Join Date: Jan 2002
Posts: 708
|
|
Cool 
|

11-12-2002, 07:14 AM
|
Hill Giant
|
|
Join Date: Oct 2002
Posts: 108
|
|
Quote:
Originally Posted by image
Curious, considering pets arent NPCs in the database, how does your code manage their procs?
|
It doesn't yet. I'm working towards that.. My plan is to have pets as database entries, but i'm taking it a step at a time.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 08:23 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |