How to make insta-hit

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 096.
Note: Core 096 is no longer officially supported.

Moderator: POL Developer

Post Reply
Gotterdammerung
New User
Posts: 3
Joined: Wed Jul 16, 2008 7:28 am

How to make insta-hit

Post by Gotterdammerung »

Hello. I wonder how to make insta -hit on my server. Now when i attack someone i must wait weapon delay to hit someone

Example
wearing hally and have war off
switch war on and attack player which is next to me
must wait about 3s to first attack

I want to have first hit at beggining of the war on ( or when i am in meele range and didnt hit yet ) and then wait weapon delay. I waschecking many files where is it or where does pol inflicts weapon delays but couldn't find it. Please help. Sorry for my english :).
Marcolo88
New User
Posts: 13
Joined: Tue Oct 23, 2007 5:24 am

Post by Marcolo88 »

mh i think it's an hardcoded function, but i'm not sure...
Gotterdammerung
New User
Posts: 3
Joined: Wed Jul 16, 2008 7:28 am

Post by Gotterdammerung »

someone else have idea?
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am
Location: Poland

Post by coltain »

as I preasume You have combat hooked

simple but not very efficient

set weapon speed +100 (if weapon has speed 20 then set it 120)
in a combat script reduce weapon speed by 100

its not an instant but ....
Gotterdammerung
New User
Posts: 3
Joined: Wed Jul 16, 2008 7:28 am

Post by Gotterdammerung »

hmmm and is there any way to check when player swtich war off/on ? (is there any packet which is sending when war is switching? ). I know player.warmode but i want to do smth when player switch his warmode on/off (maybe is there script which handle it?).
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn »

With hooks you can.

1. Instead of speed, define delay (in ms) to weapons' itemdesc element.
2. Hook request attack packet (0x05), in it, set character.delay_mod to or over the weapon.delay value, but negative (eg. delay is 1000 -> -1000). You probably want to do some checking regarding instahitting, too. Return 0, so core works on it.
3. Hook allow/refuse attack packet (0xAA), check if the attack was allowed. If it wasn't, undo the just set character.delay_mod. Return 0.
4. Hook attack (syshook), and in it's script, undo the character.delay_mod, so next swing won't happen instantly. Return value depends of your combat system.

It should work out like so. Never did exactly the same, so be sure to tell if and how you got it to work.
bloob
New User
Posts: 4
Joined: Mon May 12, 2008 1:07 am

Post by bloob »

Why the weapon delay prop?

Wouldnt it be just as good to just set the character.delay_mod to -1000 right away?
We're aiming at instahit anyway.
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn »

It doesn't have an effect if weapon's delay is not defined. That's according to my test results.
bloob
New User
Posts: 4
Joined: Mon May 12, 2008 1:07 am

Post by bloob »

Hmm got any formulas to calculate the delay value from weapon speed? ;o
Justae
Expert Poster
Posts: 79
Joined: Thu May 24, 2007 2:12 pm
Location: South Africa

One possibility

Post by Justae »

Not sure how applicable this will be to you, but this is basically how it's done on my shard.

If you want to calculate how much damage a weapon will do over a given amount of time, ie, given that all weapons have a speed factor which is also critical, here is a good example on how to go about calculating that factor in.

EffectiveDex = (BaseDex + TempDexMod + InstrinsicDex) / 10
spd_div = (EffectiveDex + 100) * weaponspeed
clock_to_next_swing = (15,000,000 / spd_div) msecs

Test-case:
--> Char with 50 dex and a speed 35 weapon

BaseDex = 50
TempDexMod = 0
IntrinsicDex = 0

(for this example, EffectiveDex = 50 )

spd_div = (EffectiveDex + 100) * 35 = 150 * 35 = 5250
clock_to_next_swing = (15000000 / 5250) = 2857 ms = 2.857 seconds

This isn't factoring-in any DEX modifiers. You would add any DEX modifier to 'EffectiveDex' variable right at the top of this example.

In this example as given, the weapon will deal it's calculated damage once every 2.857 seconds. Any weapons damage is re-calculated for every swing. Other calculations are done for resistances and Armor of the target being hit.

That number you see above your head when hitting things is the final result of damage being dealt as a result of quite a few calculations, and they are done every swing/use of the weapon.

I hope this helps in some small way.

Regards
Justae
Post Reply