Small code change help
HI :)
Sorry if this is not the right forum. Please feel free to move as needed. I would like to make a change where the necro pet reverts back 15 years lol By this I mean, once upon a time, a necro could give his pet 2 noobie daggers and the pet would use the attack speed from the daggers but still retain the pet innate damage. Just looking to be pointed in the right direction on where I might find the necro pet code etc. I have a linux install up and running and everything seems to be working fine. I am not a programmer but I can normally figure things out with a little google fu. Why do I want this you ask? Well, way back, i can remember watching a necro kill freeport guards. He then entertained me for a few minutes while his pet talked to me and he did all kinds of wonderful things ( I had no idea what was going on at that time in the game). Anyway, I instantly logged out and made a necro of course.. and within a few days they patched that weapon speed feature out of the game lol .. It is still one of my best memories from eq when everything was new and magical.. The butcherblock dwarves were a common target as well.. and they dropped a 25pp axe .. I was so envious and couldn't wait to do those things lol I know how to change the guards hp back in the db .. I even think i have logs from back then lol. Just looking for a pointer in the right direction or if this is even possible. Thanks in advance :) |
I doubt that it was a 'feature' .. but, rather an honest to goodness bug.
There's nothing keeping you from changing combat behavior - or any behavior for that matter - to anything that you wish :) That's the whole point of customization! There is no specific code for necro pet melee combat. All pets (mobs?) share the same basic code. You would need to add special checks to account for the pet class and (probably) just add an empty-handed damage check to whatever weapon damage is reported. This is the attack processing code: https://github.com/EQEmu/Server/blob...one/attack.cpp That would be a good place to start and just follow the calls backwards as needed. Just remember..unless you explicitly specify to only check for client-owned pets, all pets - including mob-owned - will receive this modifier. |
Thank you so much, Uleat, for pointing me in the right direction. HEHE you caught my use of the word "feature" right away lol
Having said that I think what I was asking about might already be the default .. reading through the attack.cpp i found this: // Technically NPCs should do some logic for weapons, but the effect is minimal // What they do is take the lower of their set delay and the weapon's // ex. Mob's delay set to 20, weapon set to 19, delay 19 // Mob's delay set to 20, weapon set to 21, delay 20 This is assuming that pets are using NPC melee code.. I'm sill looking lol But, taking a look in the database, i see this pet for example: 566 SumAirR16 attack_speed -19 / attack_delay 29 Im not sure what attack_speed -19 does but a quick google and I found a post that said it was no longer used and replaced by attack_delay (not sure if true or not). But according to the comment in the attack.cpp file if i give any weapon to this air pet (or any pet with a attack_delay higher than the weapon delay) with a delay lower than 29 it should use the lower delay of the weapon. I can honestly say that I never tried it (parsed) lol, and if this is true than it is defiantly not live like for 15 years or so .. I am totally new to this so if I am way off base here please cut me some slack lol.. Im fragile :) |
I've honestly never touched the eqemu codebase before, so everything is still entirely foreign to me.
I'm confident in most of the logic here other than how I attempt to grab the weapon(s) equipped by the pet. Random shot in the dark, untested, likely won't work. But, I can't test this right now. Code:
diff --git a/zone/attack.cpp b/zone/attack.cpp |
As I anticipated, I tested this last night and it doesn't work. Going to need to brush up more on the codebase and, having come from the land of Perl, I'm at a disadvantage. In theory all that needs to be fixed is the correct way of nabbing the pet's equipped weapons to read in their delay. The rest of the logic to only apply it if it's faster and only if it's a Client/PC pet should work. Maybe this weekend I'll try and expand my mind on the eqemu codebase and revisit.
But, should you be more versed in eqemu's codebase, the above should at least give you a great starting point to accomplish what you want. |
Doing this off the top of my head, but the NPC use-case could be something like this to get the weapon delay:
const Item_Struct* ItemToUse = NULL; int itemID = CastToNPC()->GetEquipment(MATERIAL_PRIMARY); if (itemID > 0) ItemToUse = database.GetItem(itemID); then you can check if ItemToUse isn't null and use ItemToUse->Delay |
Got bored enough to give this another look see tonight. Thanks, image. That helped. I've cobbled together something that gives you the functionality you want, Slaymore.
Tested this by confirming that NEC's "Invoke Death" pet (base 33 delay) gets appropriately set to 19 when given a Lamentation. I didn't thoroughly test all scenarios, but weapons should NOT be able to make a pet hit slower. If the delay is worse, it ignores the delay. If it's faster, it uses it. Code:
diff --git a/zone/attack.cpp b/zone/attack.cpp |
Wow That is awesome thank you so much, Freshmaker!!
lol having said that let me see if I can figure out how to apply this. So, my directory structure is like so: :~/eqemu$ ls bin CMakeLists.txt loginserver ucs changelog.txt common luabind utils client_files dependencies Makefile world cmake eqlaunch queryserv zone CMakeCache.txt freshmaker_petattackspeed_patch.diff README.md CMakeFiles GPL.txt shared_memory cmake_install.cmake LICENSE.md tests I created the file freshmaker_petattackspeed_patch.diff , pasted in your code. Now i believe i will need to edit this part of the file: diff --git a/zone/attack.cpp b/zone/attack.cpp index 2fdf5f1..9b7a1b9 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp to this: diff --git freshmaker_petattackspeed_patch.diff /zone/attack.cpp index 2fdf5f1..9b7a1b9 100644 --- freshmaker_petattackspeed_patch.diff +++ /zone/attack.cpp then run: git apply freshmaker_petattackspeed_patch.diff then: make clean make How does that look? Am I in the ball park? |
Without any modification to the snippet, you should just be able to save it and then use "git apply" against it. The diff is against the current master branch of EQEmu as of 2016-02-10, so if you get any chunk failures make sure you're up-to-date against master first.
But yeah, you'e got the right idea. |
Early on pets would use the delay of weapons if it was faster. This was patched. (it still works for normal NPCs AFAIK)
Pets damage can actually change if the weapon's base damage is higher than the pets base damage. (this is something we don't support) |
Success!! lol thank you so much!
This would have been so OP when it was on live lol. I logged into my cleric and gave her a red dragon tooth (single use Invoke Death pet) Gave him a Mosscovered Twig off hand (3/10) and a Revultant Whip (5/14) main hand. No other haste or buffs. Had him attack the level 65 dummy in the arena.. he missed most of the time but check out this attack spam lol. Zenarer could open up a tattoo parlor :) On a side note.. is there a way to see attack delay or haste as a number in GamParse? Again thank you so much.. now that I see how to do these customizations I will have to give writing some code a try.. [Fri Feb 12 12:46:23 2016] Zenarer tells you, 'Attacking an undead training dummy Master.' [Fri Feb 12 12:46:23 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:23 2016] Zenarer tries to crush an undead training dummy, but an undead training dummy parries! [Fri Feb 12 12:46:23 2016] Zenarer tries to kick an undead training dummy, but misses! [Fri Feb 12 12:46:24 2016] Zenarer tries to crush an undead training dummy, but an undead training dummy dodges! [Fri Feb 12 12:46:24 2016] Zenarer tries to crush an undead training dummy, but an undead training dummy dodges! [Fri Feb 12 12:46:24 2016] Zenarer tries to slash an undead training dummy, but an undead training dummy dodges! [Fri Feb 12 12:46:25 2016] An undead training dummy hits Zenarer for 3 points of damage. [Fri Feb 12 12:46:25 2016] Zenarer tries to crush an undead training dummy, but an undead training dummy ripostes! [Fri Feb 12 12:46:26 2016] Zenarer slashes an undead training dummy for 59 points of damage. [Fri Feb 12 12:46:26 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:27 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:27 2016] Zenarer tries to slash an undead training dummy, but an undead training dummy parries! [Fri Feb 12 12:46:28 2016] Zenarer tries to crush an undead training dummy, but misses! [Fri Feb 12 12:46:29 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:29 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:29 2016] Zenarer tries to crush an undead training dummy, but misses! [Fri Feb 12 12:46:30 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:31 2016] Zenarer tries to crush an undead training dummy, but misses! [Fri Feb 12 12:46:31 2016] Zenarer tries to kick an undead training dummy, but misses! [Fri Feb 12 12:46:31 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:31 2016] Zenarer tries to slash an undead training dummy, but an undead training dummy dodges! [Fri Feb 12 12:46:33 2016] Zenarer tries to crush an undead training dummy, but misses! [Fri Feb 12 12:46:33 2016] Zenarer tries to crush an undead training dummy, but misses! [Fri Feb 12 12:46:33 2016] Zenarer slashes an undead training dummy for 55 points of damage. [Fri Feb 12 12:46:34 2016] Zenarer tries to crush an undead training dummy, but an undead training dummy dodges! [Fri Feb 12 12:46:34 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:34 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:35 2016] Zenarer tries to crush an undead training dummy, but an undead training dummy dodges! [Fri Feb 12 12:46:35 2016] Zenarer tries to crush an undead training dummy, but misses! [Fri Feb 12 12:46:36 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:36 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:37 2016] Zenarer slashes an undead training dummy for 59 points of damage. [Fri Feb 12 12:46:37 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:38 2016] Zenarer tries to slash an undead training dummy, but an undead training dummy parries! [Fri Feb 12 12:46:39 2016] Zenarer tries to bash an undead training dummy, but misses! [Fri Feb 12 12:46:40 2016] Zenarer tries to slash an undead training dummy, but misses! [Fri Feb 12 12:46:40 2016] Zenarer tries to slash an undead training dummy, but misses! |
All times are GMT -4. The time now is 11:00 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.