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 .
How to make insta-hit
Moderator: POL Developer
-
- New User
- Posts: 3
- Joined: Wed Jul 16, 2008 7:28 am
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.
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.
One possibility
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
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