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
Overriding combat 'misses', ACTDIFF?
Author Message
Murmur
Apprentice
*

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



Post: #1
Overriding combat 'misses', ACTDIFF?
Finally got my custom swing speed calculations totally working, thanks for all the help on that post.

Next I guess I'm having to rewrite how combat 'misses' happen because the default combat code is definitely crazy. I have 200 dex, 100 archery and 100 tactics and I miss like 50% of the time. I need to fix that.

So I can handle the code part, I just need to figure out what property I need to override in @HitTry. I searched the forums and there were a few posts about ACTDIFF, but I tried ACTDIFF=0, no change, ACTDIFF=-100, no change, ACTDIFF=100, no change, ACTDIFF=-10000, no change, ACTDIFF=10000, no change.

So I'm assuming ACTDIFF is not the solution here, does anyone know if there is a property that I can override kind of like the ARGN1 in swing speed?

As always, I appreciate 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-06-2017 03:40 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: #2
RE: Overriding combat 'misses', ACTDIFF?
IN @HitTry:

actdiff > - 10 always success.
actdiff <= -10 always fail.

The number -10 because the actdiff value get "cut down" so -4 is cut down to 0 (no rounding up or down, just straight cut) 19 is cut down to 10 and so on.

If this doesn't work make sure to check for conflicts
05-06-2017 10:39 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes darksun84's post
Murmur
Apprentice
*

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



Post: #3
RE: Overriding combat 'misses', ACTDIFF?
Thanks for the reply darksun84.

I just tried a bunch of stuff, first here my console commands after saving e_player.scp and resynching:

Code:
Indexing 262 scripts...
WARNING:Resource 'scripts/custom/events/e_player.scp' changed, resync.
Done loading scripts (58 of 199 triggers used)
Resync complete!
Server is being PAUSED for Resync
Resync Restart
Indexing 262 scripts...
Done loading scripts (58 of 199 triggers used)
Resync complete!

Then I cleared out my ON=@HitTry event, and below that I'll type out all the different variations of code I just tried:

Code:
[EVENTS e_player]

ON=@HitTry

//Insert all the different ACTDIFF code snippets I tried below

[EOF]

Code:
ACTDIFF <= -10
ACTDIFF > -10
ACTDIFF <=  10
ACTDIFF > - 10
ACTDIFF <= - 10
ACTDIFF > -10
ACTDIFF <= 10
ACTDIFF > -10

//Then I tried all the above code lines with LOCAL. on them
//Then I tried to set LOCAL.ACTDIFF = <ACTDIFF>
//None of these seemed to change the behavior of hitting and missing at all.

I found this in https://github.com/Sphereserver/Source/b...MANUAL.TXT

Quote:ACTDIFF has no meaning in @SkillStart, because the difficulty for a skill is calculated
afterwards. You can enable the OF_Skill_DiffFirst, to make @SkillStart come first. This has
the (only known) sideffect of making @SpellCast come before @SkillStart, as is the usual.
@HitMiss is another trigger in which you can change ACTDIFF to a value equal or above 0
to hit an otherwise failing blow.

So I'm not sure whats up, I'm sure I'm just missing one simple thing.

I appreciate your time looking at this.
-Murmur[/quote]

*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-07-2017 02:33 AM
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: Overriding combat 'misses', ACTDIFF?
Hmm are you trying the skills with GM enabled? I remember that skills always succeed with GM mode enabled.
Try turning it off by using the .gm command
05-07-2017 10:31 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: #5
RE: Overriding combat 'misses', ACTDIFF?
Thanks again for your reply darksun84.

I went ahead and started testing a PLEVEL=1 character and found that in this particular instance it didn't matter.

However, I wanted to share what I have found messing around with this today:

From what I can tell, doing this in the @HitTry event:

Code:
ACTDIFF = <eval -10>

Makes you miss every single time.

Doing this below, as you said, makes you 'hit' every single time:
Code:
ACTDIFF = <eval 10>

Then, since I wanted to create my own 'chance to hit' code that depends on what your tactics skill is, solely, I started playing around with different values for ACTDIFF. What I found is that ANY value less than or equal to -10, makes you miss every time. And from my quick testing, ANY value greater than or equal to -9 makes you hit every single time. (Please correct me if I'm wrong).

So in my instance, I wanted to make code that if you have 100 or more Tactics, you would have a 1 in 10 chance to miss, said another way, a 9 in 10 chance to hit. So I created this code that seems to work perfectly for my uses:

Code:
IF <eval <I.tactics>> >= 100
    ACTDIFF = <eval RAND(-10,-1)>
    SAY actdiff is <ACTDIFF>
    RETURN 0
ENDIF

As you can see the use of a random number...

From my preliminary testing, this seems to work. However, I've run into another issue (of course!!!).

So in my @HitTry, I am first calculating my swing speed timer with ARGN1 based on my dex, then after that block of code, I'm using more code to decide what my chance to hit is by checking what my tactics is.

This is where I ran into an issue, I need a command like 'GOTO line 2314' or something like that. In otherwords, in my original @HitTry that I created to determine my swing time in reference to my DEX value, I was using RETURN 0 to jump out of the IF statements. What command do I need to use to 'jump' out of my swing speed code, and jump down to my chance to hit code?

Again I appreciate your time.
-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-08-2017 07:11 AM by Murmur.)
05-08-2017 07:10 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: #6
RE: Overriding combat 'misses', ACTDIFF?
You need to call the function or create a new function after you run your code. Just make sure you don't call anything that could loop back to @HitTry in the function you call from it or you will create an infinite loop.

pseudo code:

@HitTry
do your code
call function ChanceToHit
return 0

Function ChangeToHit
do your code
return 0
05-08-2017 07:19 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: #7
RE: Overriding combat 'misses', ACTDIFF?
Thats exactly what I was looking for, thanks bro.

*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:20 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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