Syshook: AttackDelay

Archive of the older Feature Request Forum Posts

Moderator: POL Developer

Locked
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Syshook: AttackDelay

Post by ncrsn »

I know mobile.delay_mod exists.

As far as I'm concerned, during combat, if mobile has an opponent, core calculates time to actually do the hit: this delay is based on mobile.delay_mod, weapon's speed, dexterity, at least. What I'm suggesting, is AttackDelayHook, which, if exists, is called every time core is about to do the above calculation. Needed parameters would be attacker and defender. Needless to say, should the script exist, it's return value would be used as delay before the swing (making the core's calculation unnecessary).

Having hook like this would make it easier to create more dynamic combat situations and strategies, like: if you don't move between hits, your delay between hits will slowly decrease. Or, should this be affected by stamina? That could be easily done. Using mobile.delay_mod is possibility, but management of all instances that could affect it's value would soon become hard. What if attacker switched his/her weapon? Drank a dexterity potion? Died? -- Using hook the value would not be needed to be managed in scripts, as it would be re-evaluated every now and then.

This, I understand, would be somewhat CPU intensive hook, but being optional it should not harm no-one - and comparing to attack hook, this should have close to no impact in overall. Still, it would be nice if somehow (config setting?) this could be set to affect PCs only. NPCs would be nice to have but way less important, if so happens that this drains the last cycles out of my CPU.

Is there something wrong in the idea or did I overlook some very special thing? You tell me.
qrak
Grandmaster Poster
Posts: 198
Joined: Sun Feb 05, 2006 4:35 pm
Location: Poland

Post by qrak »

I'm waiting for that feature. Reducing Archery delay after moving character would me much easier. Anyway anybody know how to do it?
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Post by MontuZ »

I highly doubt this would effect cpu usage. My attackhook is so damn ridiculously large I sometimes want to slit my wrists because I know I am going to have to eventually rewrite it. But it doesn't effect much cpu usage at all, if any.
phao
Grandmaster Poster
Posts: 129
Joined: Fri Aug 31, 2007 2:25 pm
Location: Brazil

Re: Syshook: AttackDelay

Post by phao »

ncrsn was talking about his idea in the irc channel some days ago, very good one.

But don't need a syshook to that does it? just a function like => RoundDelay(delay_in_ms) <= is enough in my opinion.

This function could just set the "next swing delay".

But for me there isn't much difference between them, just think a function call would be simpler (for scripters at least) than an syshook.

Anyway, very good ideia, it could be implement.

:smile: :grin:
phao
Grandmaster Poster
Posts: 129
Joined: Fri Aug 31, 2007 2:25 pm
Location: Brazil

Re: Syshook: AttackDelay

Post by phao »

bringing it back to live...

I've though of something here to simulate that function I've talked about in the previous message of mine.

You could use the formula that returns the swing delay and multiply it to -1, then assign the result to delay_mod, that way you'd remove any swing delay, right after that (in the next line of code or so), one could add a number, returned by a swing delay calculation function, and this number would be the new swing delay.

So:

Code: Select all

pc.delay_mod := -1 * calc_swing_delay(weapon_speed, char_dex);
pc.delay_mod := 300;
I think this is a good way of solving this problem, but I've tried a few times (5 or 6) implementng that, adding those lines at the end of my attack hook, it didn't work, POL CORE was "ignoring" it (in fact it was setting it to 0 before using it), I've started a thread about it (http://forums.polserver.com/viewtopic.php?f=11&t=2391), and I'm not sure if I'm coding it wrong or if it's really a bug.

But if anyone here knows how to overcome that "bug", you could post here and this swing delay issue may be solved.
Locked