Ok I give up and coming here to see if someone can point me in the right direction.
First, I'll explain what I'm trying to do, and then explain what I've done so far to achieve the goal.
I want to rewrite how weapon swing timers work. Lets set up some variables.
I have 2 weapons at the default speeds. A dagger (weapon speed 56) and a halberd (weapon speed 29).
I want dex to drastically effect swing timers.
So lets say I have 25 dex. I want the dagger swing time to be really slow, like 3 seconds each swing.
Lets say I have 100 dex. I want the dagger swing time to be quick, like 1 second for each swing.
Lets say I have 200 dex. I want the dagger to swing like a damn Gatling gun, like .2 or .1 seconds per swing.
Same deal with halberd, only it would be equally slower at each dex value on a curve.
I don't want 'thresholds' like if you have 25 dex, you would swing the same speed at 26 dex, 27 dex......49 dex, then at 50 dex you all of sudden hit a threshold that enables you to swing faster. I want an algorithm that works on a curve, so that at 100 dex the swing timer is faster than having 99 dex, and having 101 dex actually makes you swing slightly faster than 100 dex.
So what I've done so far.
The first thing I did was play around with CombatSpeedEra and SpeedScaleFactor in sphere.ini. For my purposes, no matter what option I chose on CombatSpeedEra, it didn't seem to have an effect on anything. SpeedScaleFactor does have an effect, but does not give me the drastic differences in the speed timers from the slow end to the high end.
So then I started messing around with GetWeaponSwingTimer.
Is it just me or does editing anything in Sphere_Combat.scp have zero effect on anything?
Here is the block of the code I've been focusing on for a few days of brainstorming:
Code:
[function GetWeaponSwingTimer]
if ( <weapon> )
local.speed=<qval <tag0.override.speed> ? <tag.override.speed> : <weapon.speed> >
if ( <local.speed> )
local.waittime = <eval (<serv.SpeedScaleFactor> * 10 ) / (<max <dex>+100,1> * <local.speed>)>
return <qval <local.waittime> > 5 ?5:<dlocal.waittime>>
endif
endif
if (<brain>==brain_guard)
return 1
endif
// Base speed is just your DEX range=40 to 0
local.waittime = <muldiv (100-<dex>),40,100>
if ( <local.waittime> < 5 ) // no-one needs to be this fast.
local.waittime = 5
else
local.waittime +=5 // why this 'free' increase of wait time?
endif
The first thing I tried was taking out this part:
Code:
if ( <local.waittime> < 5 ) // no-one needs to be this fast.
local.waittime = 5
else
local.waittime +=5 // why this 'free' increase of wait time?
endif
Because I'm trying to do exactly what this code is trying to prevent, I want to swing VERY fast on that end of the spectrum.
Then I tried adjusting, one at time, all the constants in the algorithms in GetWeaponSwingTimer.
From what I can tell, no matter what I did in GetWeaponSwingTimer, it didn't have any perceivable changes.
I even tried to put sysmessages in those blocks of code so I could see the value of local.waittime, and even failed at getting that to work.
I thought that I might be able to avoid reinventing the wheel, went to all the distros I've collected of the years (Coldfire, CloudBR, Blackrock etc) and realized that none of those distros had Sphere_combat.scp in them, and I had trouble even finding any scripts that dealt with the swing timers at all.
That is the point that I realized I'm missing something and came to the forums. I did a search on combat and found many posts about the swing animations, but none of them referenced the actual time between damage dealing (the swing).
I'm definitely not asking for someone's custom damage calc, I'd just like help understanding where I need to edit this code, or how I can just override the existing algorithms to reach my goal. Even if I have to go in and add code to every weapon on my server to override the code, I'm willing to do it.
I appreciate any advice or help.
Thanks! -Murmur