PDA

View Full Version : Weapon proc spell target


Kaiyodo
02-18-2002, 02:11 AM
I've written a small bit of code to enable weapon procs to work, however, I can't see a way of working out who the spell should be cast on (always casts on target at the moment). The spell effecttype for 'Avatar' on Primal weapons (which are cast on the player) is the same as 'Anarchy' on the Sceptre of destruction (which should be cast on the target).

Anyone know how to determine who the target should be from the spell/item? I've included to the code I put in, should anyone want it. It goes in right at the bottom of Client::Attack() in attack.cpp.


// Check for proc on weapon, proc based on DEX (Kaiyodo mod)
if((float)rand()/RAND_MAX < (GetDEX()/1500.0f)) // 255 dex = 0.17 chance of proc.
{
if(item && other && other->GetHP() > 0)
{
if((item->common.spellId < 65535ul) && (item->common.effecttype == 0))
SpellFinished(item->common.spellId, other->GetID(), 10, 0);
}
}


K.

Schmuck
02-18-2002, 02:39 AM
Well, once/if/when someone comes out with a spell editor, you could create a spell that is exactly like Avatar, only it is self-only and see if that works. Have you tried putting Gate as an item effect? Or Minor Shielding?

Kaiyodo
02-18-2002, 03:52 AM
The Minor Shielding and Gate spells are flagged as 'Self-only' in the spell data (their spelltype is 'ST_Self'). Spells of this type, as well as any flagged with 'ST_AETarget' or 'ST_AECaster' will work just fine on a proccing weapon. The problems is with spells of type 'ST_Target' that need more information that I actually have, i.e. who to make the target.

I thought for a while that 'beneficial' spells would always proc on the player, while offensive spells proc on the target, but then remembered a few 'cursed' items that can proc offensive spells on the player (like the Cancel Magic proccing sword), so that was a non-starter.

K.

Schmuck
02-18-2002, 09:15 AM
I know, but if self-only spells proc on yourself, you could make a spell exactly like Avatar, call it something different (or maybe you wouldn't have to, I don't know much about spell identification), but just make it self-only. This would be the "jerry-rigging" temporary fix, but it should work...

Kaiyodo
02-18-2002, 10:26 AM
That would certainly work, I've got a temporary bodge in there at the moment that basically goes 'if spell = avatar, target = me'. It's crude, but it lets me have fun with the primal weapons :)

K.

Lurker_005
02-18-2002, 12:06 PM
Is there possibly an overlooked bit of data in the item info that says who the spell proc is on? That would seem to make the most sense. Try comparing items that proc on target with items that proc on wielder....

Pyrotek
02-19-2002, 01:48 AM
Avatar is the spell that shamans get. Primal Avatar is the proc on the weapon. I haven't looked but i'm betting it's self only.

Kaiyodo
02-19-2002, 05:39 AM
I'm pretty sure it's a targetable spell, Primal Avatar is a dropped spell in Sleepers I believe, a componentless version of Avatar.

The weapons I've been testing with are from the standard DB in the EQEmu zipfile (Primal velium warsword to be specific) so I'd presume all of the data for the weapon is spot on, i.e. packet sniffed from real EQ. All I do is cast the spell number that the weapon tells me to, I'm sure I'm just missing a bit of secret info stored in the weapon somewhere.

K.

Pyrotek
02-19-2002, 06:58 AM
Well, was a shot. I'll take a look deeper when i'm at home and have some time. :)

Yodason
02-19-2002, 08:55 AM
theres a primal avatar for shamans it doesnt take regent.