SphereCommunity
About the new combat system - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: About the new combat system (/Thread-About-the-new-combat-system)

Pages: 1 2 3 4


RE: About the new combat system - Lazarus - 07-19-2015 07:53 AM

something to add: IF you don't hit them you will not get skillgain from that weapon.

0 skill = fail everytime = 0 skill
10 skill = fail everytime = 0 skill
50 skill = fail everytime = 0 skill

Really, maybe it is because I don't use hit chance increase (because I use old formulas without props in weapons)
If you can do something like this, will be a bless:
use old hit chance formula(rescripted) /new hit chance formula option.


RE: About the new combat system - Coruja - 07-20-2015 02:34 AM

since there's many ppl each one wanting different combat formulas, maybe the best solution is use triggers (eg: custom block chance formula on @Hit, custom swing speed on @HitTry, ...) or even move to the softcoded combat engine instead use the hardcoded engine

because if we add a select switch to each internal formula, the code will become a real mess (and also heavy) Tongue


RE: About the new combat system - Lazarus - 07-20-2015 03:13 AM

(07-20-2015 02:34 AM)Coruja Wrote:  since there's many ppl each one wanting different combat formulas, maybe the best solution is use triggers (eg: custom block chance formula on @Hit, custom swing speed on @HitTry, ...) or even move to the softcoded combat engine instead use the hardcoded engine

because if we add a select switch to each internal formula, the code will become a real mess (and also heavy) Tongue

Maybe update some sphere_combat_formulas.scp were you can activate them with a single option in sphere.ini (Speed formula is now in Sphere.ini, and that is perfect)
Of course, you will need that .scp in your sphere scripts folder. Is not hardcoded. (you just need a switch in the original code of sphere)

If you play some old shard, this hit chance formula is bad for you. Because the skill didn't increase when you fail (is hard to train in old shards) and you can't hit anyone with 30 or 40 weapon skill, even creatures like zombies :'(


RE: About the new combat system - XuN - 07-20-2015 05:22 PM

Well, you are right in the part we should update sphere_combat.scp but to be honest it's a pain in the ass to softcode such a large script, even more when more changes are coming and coming to the combat engine ... it will be done once it reached some kind of final state.

But for now you can take a look on sphere_combat.scp (for this old shard) and use the formula I pasted you here, since speed formulas were added as a switchable option in the ini, damage is being calculated in the script, and you have the hitchance formula here too ... you have the whole old combat at your disposal.


RE: About the new combat system - Lazarus - 07-21-2015 04:35 AM

Edited with some changes that XuN made because something was wrong:

Code:
[function f_hitchance]
// src should be my target

if !(<src.isChar>)
return <r31>// must be a training dummy
endif

if ((<brain>==brain_guard) && (<serv.GuardsInstantKill>==1))
return 0
endif

// Frozen targets should be easy.
if ((<src.flags>&statf_freeze) || (<src.flags>&statf_sleeping))
return <r10>
endif

local.iSkillVal = <i.<serv.skill.<action>.key>> //<i.<action>> // value of the skill whe are using to hit.
// Offensive value mostly based on your skill and TACTICS.
// 0 - 1000
local.iSkillAttack = <local.iSkillVal> + <eval <tactics>/2>

// Defensive value mostly based on your tactics value and random DEX,
// 0 - 1000
local.iSkillDefend = <src.tactics>

// Make it easier to hit people havin a bow or crossbow due to the fact that its
// not a very "mobile" weapon, nor is it fast to change position while in
// a fight etc. Just use 90% of the statvalue when defending so its easier
// to hit than defend == more fun in combat.
local.iStam= <src.dex>
if (<serv.skill.<action>.flags>&skf_ranged)
// The defender uses ranged weapon and the attacker is not.
// Make just a bit easier to hit.
local.iSkillDefend = (<local.iSkillDefend> + (<local.iStam>*9))/2
else
// The defender is using a nonranged, or they both use bows.
local.iSkillDefend = (<local.iSkillDefend> + (<local.iStam>*10))/2
endif

local.iDiff = <eval (<local.iSkillAttack> - <local.iSkillDefend>) /5>
local.iDiff /= 10

if (<local.iDiff> < 0)
local.iDiff = 0 // just means it's very hard.
elseif (<local.iDif>> 100)
local.iDiff = 100 // just means it's very easy.
endif

return <r<local.iDiff>> //always need to have some chance.

still working weird. A Attacker with 0 all skills and a defender with 100 tactics still hits him 10/10 chances o.O

Actdiff = 0
Actdiff = 100
is the same in hittry. Tongue something is there that we don't know.

XuN asked me to test it in ON=@Start, for example in swordsmanship.
There works perfectly
Actdiff = 0 (fails almost every hit)
actdiff = 100 (hit everytime)


RE: About the new combat system - Rizz - 07-24-2015 01:07 AM

Lazarus, is this code ok now? How should I use it? Why @start and not @hittry?
On the bugtracker you said "Something weird is happening there"


RE: About the new combat system - Lazarus - 07-24-2015 03:50 AM

(07-24-2015 01:07 AM)Rizz Wrote:  Lazarus, is this code ok now? How should I use it? Why @start and not @hittry?
On the bugtracker you said "Something weird is happening there"


No, the code is without *ERRORS* but the <actdiff> is not changing, something weird is happening in the calculations.
I tried all what I can with my brain haha Tongue but nothing happens.

Tried on=@start of sword but still the calculations are wrong. There you can change the actdiff but triggers too when you try to attack someone (without attacking him with the weapon)

so... I'm just waiting for a God who can help us.


I will try now a on=@hittry
if sword... if mace... etc.
skillgain.


RE: About the new combat system - Rizz - 07-24-2015 04:09 AM

Mine is correct... but check it anyway

Code:
[function f_HitChance]
REF1=<args>


// REF1 should be my target

if !(<REF1.isChar>)
    return <r31>// must be a training dummy
endif

if ((<brain>==brain_guard) && (<serv.GuardsInstantKill>==1))
    return 0
endif

// Frozen targets should be easy.
if ((<REF1.flags>&statf_freeze) || (<REF1.flags>&statf_sleeping))
    return <r10>
endif

local.iSkillVal = <<serv.skill.<action>.key>> // value of the skill whe are using to hit.
// Offensive value mostly based on your skill and TACTICS.
// 0 - 1000
local.iSkillAttack = <eval (<local.iSkillVal> + ( <tactics>/2))>
serv.b local.iSkillAttack <dlocal.iSkillAttack>

// Defensive value mostly based on your tactics value and random DEX,
// 0 - 1000
local.iSkillDefend = <REF1.tactics>



// Make it easier to hit people havin a bow or crossbow due to the fact that its
// not a very "mobile" weapon, nor is it fast to change position while in
// a fight etc. Just use 90% of the statvalue when defending so its easier
// to hit than defend == more fun in combat.
local.iStam= <REF1.dex>


if (<serv.skill.<action>.flags>&skf_ranged)
    // The defender uses ranged weapon and the attacker is not.
    // Make just a bit easier to hit.
    local.iSkillDefend =  (<dlocal.iSkillDefend> + (<dlocal.iStam>*9))/2
    serv.b local.iSkillDefend1 <dlocal.iSkillDefend>
    else
    // The defender is using a nonranged, or they both use bows.
    local.iSkillDefend = (<dlocal.iSkillDefend> + (<dlocal.iStam>*10))/2
    serv.b local.iSkillDefend2 <dlocal.iSkillDefend>
endif

local.iDiff = ((<dlocal.iSkillAttack> - <dlocal.iSkillDefend>) /5)
serv.b local.iDiff <dlocal.iDiff>
local.iDiff /= 10
serv.b local.iDiff <dlocal.iDiff>

if (<local.iDiff> < 0)
    local.iDiff = 0 // just means it's very hard.
    elseif (<local.iDiff>> 100)
    local.iDiff = 100 // just means it's very easy.
endif

return <r<local.iDiff>> //always need to have some chance.



RE: About the new combat system - Lazarus - 07-24-2015 04:30 AM

(07-24-2015 04:09 AM)Rizz Wrote:  Mine is correct... but check it anyway

Code:
[function f_HitChance]
REF1=<args>


// REF1 should be my target

if !(<REF1.isChar>)
    return <r31>// must be a training dummy
endif

if ((<brain>==brain_guard) && (<serv.GuardsInstantKill>==1))
    return 0
endif

// Frozen targets should be easy.
if ((<REF1.flags>&statf_freeze) || (<REF1.flags>&statf_sleeping))
    return <r10>
endif

local.iSkillVal = <<serv.skill.<action>.key>> // value of the skill whe are using to hit.
// Offensive value mostly based on your skill and TACTICS.
// 0 - 1000
local.iSkillAttack = <eval (<local.iSkillVal> + ( <tactics>/2))>
serv.b local.iSkillAttack <dlocal.iSkillAttack>

// Defensive value mostly based on your tactics value and random DEX,
// 0 - 1000
local.iSkillDefend = <REF1.tactics>



// Make it easier to hit people havin a bow or crossbow due to the fact that its
// not a very "mobile" weapon, nor is it fast to change position while in
// a fight etc. Just use 90% of the statvalue when defending so its easier
// to hit than defend == more fun in combat.
local.iStam= <REF1.dex>


if (<serv.skill.<action>.flags>&skf_ranged)
    // The defender uses ranged weapon and the attacker is not.
    // Make just a bit easier to hit.
    local.iSkillDefend =  (<dlocal.iSkillDefend> + (<dlocal.iStam>*9))/2
    serv.b local.iSkillDefend1 <dlocal.iSkillDefend>
    else
    // The defender is using a nonranged, or they both use bows.
    local.iSkillDefend = (<dlocal.iSkillDefend> + (<dlocal.iStam>*10))/2
    serv.b local.iSkillDefend2 <dlocal.iSkillDefend>
endif

local.iDiff = ((<dlocal.iSkillAttack> - <dlocal.iSkillDefend>) /5)
serv.b local.iDiff <dlocal.iDiff>
local.iDiff /= 10
serv.b local.iDiff <dlocal.iDiff>

if (<local.iDiff> < 0)
    local.iDiff = 0 // just means it's very hard.
    elseif (<local.iDiff>> 100)
    local.iDiff = 100 // just means it's very easy.
endif

return <r<local.iDiff>> //always need to have some chance.

How do you call it?
ON=@HITTRY
actdiff = <f_hitchance>
??

Thanks, trying.


RE: About the new combat system - Rizz - 07-24-2015 04:39 AM

Should be if I can remember well

actdiff = <f_hitchance <src.uid>>

I am not using it right now and I replaced the script lol