![]() |
Overriding combat 'misses', ACTDIFF? - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Overriding combat 'misses', ACTDIFF? (/Thread-Overriding-combat-misses-ACTDIFF) |
Overriding combat 'misses', ACTDIFF? - Murmur - 05-06-2017 03:40 PM 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 RE: Overriding combat 'misses', ACTDIFF? - darksun84 - 05-06-2017 10:39 PM 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 RE: Overriding combat 'misses', ACTDIFF? - Murmur - 05-07-2017 02:33 AM 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... 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] Code: ACTDIFF <= -10 I found this in https://github.com/Sphereserver/Source/blob/master/docs/MANUAL.TXT Quote:ACTDIFF has no meaning in @SkillStart, because the difficulty for a skill is calculated 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] RE: Overriding combat 'misses', ACTDIFF? - darksun84 - 05-07-2017 10:31 AM 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 RE: Overriding combat 'misses', ACTDIFF? - Murmur - 05-08-2017 07:10 AM 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 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 RE: Overriding combat 'misses', ACTDIFF? - bmanny - 05-08-2017 07:19 AM 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 RE: Overriding combat 'misses', ACTDIFF? - Murmur - 05-08-2017 07:20 AM Thats exactly what I was looking for, thanks bro. |