The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sphere_combat >.<
Author Message
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #1
sphere_combat >.<
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

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
(This post was last modified: 05-04-2017 01:31 PM by Murmur.)
05-04-2017 01:26 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #2
RE: sphere_combat >.<
sphere_combat.scp got added on sphere 56c to replace the hardcoded combat engine with the same engine but now softcoded on scripts. But if you choose to use it, it will replace the hardcoded engine. On the other hand, if you're not using the softcoded engine, these changes on softcoded engine won't make any effect on the hardcoded engine

if you just want customize the swing speed formula, maybe it's better keep using the hardcoded engine and just use ARGN1 on @HitTry char trigger to create your own swing delay formula (http://wiki.spherecommunity.net/index.php?title=@HitTry). You will only need sphere_combat.scp if you're planning to do huge changes on the combat engine (eg: rewrite the entire engine)

PS: sphere_combat.scp got added on 56c, that's why you can't find it on these old 56b servers
(This post was last modified: 05-04-2017 02:33 PM by Coruja.)
05-04-2017 02:30 PM
Find all posts by this user Like Post Quote this message in a reply
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #3
RE: sphere_combat >.<
Thanks for your time Coruja.

I definitely don't have any plans for completely rewriting, so I'll use this override instead.

After reading your reply, I did a search within my scripts for @HitTry and didn't look like it pulled up anything.

Then I searched the forums for more info on @HitTry, and from what I'm seeing I need to create a new .scp (such as e_player.scp) for events, such as [EVENTS e_player], and then add the triggers in this event. Or add the new event to sphere_events_humans.scp?

My newbieness prevents me knowing what to do with it from there, if I am right about the above paragraph, where/how do I call that on the character?

Is a 'character' considered a 'human' as in a reference to sphere_events_human.scp?

I apologize for losing you at that point, I really appreciate your help.

-Murmur

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
05-04-2017 03:25 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #4
RE: sphere_combat >.<
You can put an event in whatever file you want.
Example:

Create a new file named new_events.scp (or whatever name you want).

Inside the file write the event you want and the triggers:
Code:
[EVENTS e_players]
ON=@HitTry
serv.log HitTry from e_players event fired!

Now we have to install the events on players, a quick way is to open sphere.ini file and search the following line:
Code:
// Events related to all players
//EventsPlayer=
Uncomment the EventsPlayer line and add your event name to it.
Result will be:
Code:
// Events related to all players
EventsPlayer=e_players
In this way all the players will automatically have the events installed.
Then resync.

Notice that if we have created the new file (new_events.scp) when sphere was running, we need to load it.
In the sphere console type:
load new_events.scp (default path is "scripts", if the file is in a different folder we will need to type load myfolder/new_events.scp

File will be loaded and ready to use by Sphere.
05-04-2017 07:18 PM
Find all posts by this user Like Post Quote this message in a reply
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #5
RE: sphere_combat >.<
Awesome, thank you darksun84. I'm one step closer to getting this figured out.

So I messed around with this earlier, I created my e_player.scp, uncommented EventsPlayer and confirmed that [EVENTS e_player] with @HitTry and confirmed it works with a SAY for debugging.

I created a quick and simple block to test with.

Here is the code I created with your help:

Code:
[EVENTS e_player]

ON=@HitTry

ARGN1=1

SAY ARGN1 is <ARGN1>

[EOF]

Looks like I'm getting my intended results. THANK YOU!

However (nothing can ever go smooth, right?) archery does not seem to adhere to these rules. I'm assuming there is something hardcoded preventing a normal i_bow from firing 10 arrows a second, like it does with daggers and halberds (thats all I tested it with, Im assuming all the other melee weapons work).

Any ideas what else I should be overriding to get my bow to fire super fast too?

Thanks again for all the help!

-Murmur

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
05-05-2017 01:47 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: sphere_combat >.<
Open sphere_skill.scp and check in the ARCHERY block if you have a line that starts with:
DELAY=some numbers

If yes, comment or remove it and restart the server.
Hoverwer, having that line means you are using an old script pack.
05-05-2017 06:41 PM
Find all posts by this user Like Post Quote this message in a reply
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #7
RE: sphere_combat >.<
Party on darksun84, that worked!

And yeah, apparently I got my original scripts from http://scripts.sphere.torfo.org/

Did some investigating and found out that https://github.com/Sphereserver/Scripts is where all the newest scripts are being kept, so if anyone new made the same mistake I did, make sure to go to https://github.com/Sphereserver/Scripts for your initial scripts.

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
05-06-2017 02:29 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Murmur's post
bmanny
Apprentice
*

Posts: 25
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2017
Reputation: 0



Post: #8
RE: sphere_combat >.<
Maybe you can help. I tried adding e_combat_system to players and I get this error

13:07:(sphere_combat.scp,28)combat_hit bryan
13:07:ERROR:(sphere_combat.scp,196)Undefined symbol 'SWING_READY' ['SWING_READY )']
13:07:ERROR:(sphere_combat.scp,206)Can't resolve <max 1,1>
13:07:ERROR:(sphere_combat.scp,215)Undefined symbol 'SWING_READY' ['SWING_READY )']
13:07:ERROR:(sphere_combat.scp,253)Undefined symbol 'SWING_SWINGING' ['SWING_SWINGING']
13:07:ERROR:(sphere_combat.scp,255)Can't resolve <getswingtimer>
05-08-2017 06:25 AM
Find all posts by this user Like Post Quote this message in a reply
Murmur
Apprentice
*

Posts: 33
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Feb 2013
Reputation: 0



Post: #9
RE: sphere_combat >.<
I'm assuming you are trying to use sphere_combat.scp as your player event.

Coruja mentioned earlier in this post:

Quote:sphere_combat.scp got added on sphere 56c to replace the hardcoded combat engine with the same engine but now softcoded on scripts. But if you choose to use it, it will replace the hardcoded engine. On the other hand, if you're not using the softcoded engine, these changes on softcoded engine won't make any effect on the hardcoded engine

So basically sphere_combat is just a reference of what is hardcoded. As far as editing the sphere_combat.scp, then using as the player events, I don't know how easy that is going to be, it would probably require a deep understanding of the syntax to get it all to work properly.

In my case, I just created a brand new events .scp, named it e_player.scp, then put e_player.scp as my player events file in sphere.ini (also outlined very well earlier in this post).

Hopefully that helps answers part of the issue.

*you glance to your left to a region you just surveyed... you glimpse a magical being, more shadow than substance, caught midway in transformation... the figure smiles, the corners of his mouth jut upwards slightly on the edges, suddenly stretched to a length not at all human...*
05-08-2017 07:19 AM
Find all posts by this user Like Post Quote this message in a reply
bmanny
Apprentice
*

Posts: 25
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: May 2017
Reputation: 0



Post: #10
RE: sphere_combat >.<
Yes, thank you! PM me if you are interested in working together on some of this as we are doing close to the same thing. My degree and formal training is in computer game programming and design, but I haven't touched sphere since I was 14. I'm 28 now Sad A lot has changed and I'm trying to catch back up.
05-08-2017 07:21 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)