Jump to content

Home

Saber Damage, found the code lines but what next?


NITEMARE

Recommended Posts

like i postet in general editing, i wanted to balance the saber damage to make normal strikes a serious threat and backstabs just a tactical move for some situation only (not one hit killermove). please help me with the coding, since im just a grafiks guy and a server admin.

-----------------------------------------------------------------------

dmg = SABER_HITDAMAGE;

 

if (self->client->ps.fd.saberAnimLevel == 3) // red stance?

{

//new damage-ramping system

if (!saberInSpecial && !inBackAttack)

{

dmg = G_GetAttackDamage(self, 2, 120, 0.5f); // changed 120 to 80, however, the backspins are less damaging now

}

else if (saberInSpecial &&

(self->client->ps.saberMove == LS_A_JUMP_T__B_))

{

dmg = G_GetAttackDamage(self, 2, 180, 0.65f);

}

else if (inBackAttack)

{

dmg = G_GetAttackDamage(self, 2, 30, 0.5f); // changed it form 30 to 65 and it worked! }

else

{

dmg = 100; // i think this is the prepatch value but it doesnt have any effect now

}

}

else if (self->client->ps.fd.saberAnimLevel == 2) // yellow stance?

{

if (saberInSpecial &&

(self->client->ps.saberMove == LS_A_FLIP_STAB || self->client->ps.saberMove == LS_A_FLIP_SLASH))

{ //a well-timed hit with this can do a full 85

dmg = G_GetAttackDamage(self, 2, 80, 0.5f);

}

else if (inBackAttack)

{

dmg = G_GetAttackDamage(self, 2, 25, 0.5f); // changed 20 to 40

}

else

{

dmg = 60; // prepatch value

}

}

else if (self->client->ps.fd.saberAnimLevel == 1) // blue stance?

{

if (saberInSpecial &&

(self->client->ps.saberMove == LS_A_LUNGE))

{

dmg = G_GetAttackDamage(self, 2, SABER_HITDAMAGE-5, 0.3f);

}

else if (inBackAttack)

{

dmg = G_GetAttackDamage(self, 2, 30, 0.5f); // changed to 25

}

else

{

dmg = SABER_HITDAMAGE;

}

}

 

attackStr = self->client->ps.fd.saberAnimLevel;

---------------------------------------------------------------

Link to comment
Share on other sites

I would suggest using the {code}{/code} (replace with []) around the code you pasted, it'll come out better :D

 

Anyway.. i'm sure i'll be poking around that code, so i'll give you any information as I come across it :D

 

:jawa

Link to comment
Share on other sites

it stands to reason that if you make the numbers smaller, the saber will do less damage.

 

If you can't read the code well enough to find out where to do that, you probably aren't cut out for making mods.

Link to comment
Share on other sites

Originally posted by Xzzy

it stands to reason that if you make the numbers smaller, the saber will do less damage.

 

If you can't read the code well enough to find out where to do that, you probably aren't cut out for making mods.

 

Eh, be nicer! He directly stated he was a server admin & graphics guy, not a real coder.

 

Anyway -- your assumption is not always correct, that could be a modifier in regards to damage that increases damage done.

Link to comment
Share on other sites

ok

the function G_GetAttackDamage(entity, midamage, maxdamage, multpoint) is working like this:

assume that totaldamage=maxdamage

first get the animation length of the attack

then set the PeakPoint (the point with the most damage) as AnimLength-Multpoint*AnimLength (multpoint is the last argument)

so it sets the peak point in animation.

now, it executes the following code:

get the current point of animation

set the damage factor as the CurrentPoint/PeakPoint...

if it's >1 (current point is after peak), substract it from 2

so its a bit like a curve....getting bigger till PeakPoint, then getting back smaller at the end of the swing

it then multiplies the totaldamage by the factor, making it smaller

then it check for the minimum damage and maximum damage bounds and caps the damage at them.

 

So basically:

if the last parameter is bigger, the maximum damage is done at an earlier stage of the attack

if the min/max damage are bigger/smaller, the attack will potentially do more/less damage

 

hope it helped

Link to comment
Share on other sites

heh Xzzy, i know that the numbers have to be increased! doh!

but im not fit for coding, modding however does not require so much knowledge. in my simillar post i said that i already compiled a test mod with a medium succsess, backstabbs were useles and normal strikes more damaging, but still to be optimized. thanks to ASk i now know how it works. thanks!

phu i knew coding is nothing for me and mahts too...

Link to comment
Share on other sites

1. Does anyone know where is the size of lightsabers hit

box, bounding box or what ever (that box determines

if that saber hit something...) ????

 

2. Does anyone know where the damage factor of idle

saber is and that does it cut objects in pieces.... ???

Link to comment
Share on other sites

heh check out the w_saber.c file and search for

SABER_NONATTACK_DAMAGE

i changed it to 2. but tho i found some lines with the saber_box settings i dont have any idea what to change, so betterlet this one as is until ASk tells us more. why do u want to change the hitbox anyway? make everything unblockable?

Link to comment
Share on other sites

"...change the hitbox anyway? make everything unblockable?"

 

I DON'T want to weaken blocking BUT I WANT that my

saber damages and cuts things only when it REALLY

touch them

 

Currently it seems to damage things from 20-40cm

radius around it (even sabers glow isn't that wide)

and that actual blade which should be the thing

which makes damage is maybe 2-3cm thick

 

Is my english understandable ???

Link to comment
Share on other sites

Originally posted by ALIEN_JL

1. Does anyone know where is the size of lightsabers hit

box, bounding box or what ever (that box determines

if that saber hit something...) ????

 

At the top of w_sabers.c there is a #define called DEBUG_SABER_BOX. It should be commented out by default.

 

Uncomment the line, recompile, and load up the game. You will notice two red boxes on the screen, these appear to be the bounding box for the (hidden) entity that is representing your saber.

 

Interesting things to do with this is analyze at what point in the swings your saber has a hitbox. Blue stance spins, for example, are literally incapable of doing damage when the saber is "behind" you.. there's no hit box.

 

I haven't yet verified that the hitbox shown is actually what the game uses to calculate hits but so far it seems to be accurate.

Link to comment
Share on other sites

Hm. Well I guess all explicit questions were already answered and the ramping damage curve was already explained. I'll just recap the saber damage function for people who don't want to go through the code. People who love code need not read this =P

 

The "special moves" are the likes of the DFA, back moves, the flip stab and slashes, etc. Otherwise it's just a normal move. The "else" parts where dmg = 60 in the medium stance block and dmg = SABER_HITDAMAGE in the light stance block are the *BASE* values for the normal attacks. (The normal attacks for heavy attacks were overriden in the patch by the first part where it calculates the damage on a curve from 2 to 120.)

 

After that code, the damage values all get scaled up or down in a few different situations. If the attacker is a Jedi Master, the damage dealt out gets doubled (one line of code). If the target is a non-jedi, the damage they receive is 1.5 times as great. If the target is a jedi wielding a light saber then: if your attack is doing the base light stance damage, then they receive 70% of the damage, otherwise they receive only 50% of the damage. That's why it "feels" like they killed off medium stance attacks because the base normal attack value is set to 60 and 50% of that is 30 and light stance normal attacks are currently set to a base value of 35 and 70% of that is 24. However, if the target is a jedi NOT holding a light saber, they receive the normal base amount of damage.

 

If you turn on the g_jediVmerc flag (I don't have the source with me at work, so I believe that is the spelling) in your config, then in G_Damage, they multiply the damage a non-jedi receives by 4 on TOP of the 1.5 times they receive which results in a magnification of 6 times (capped off at 100).

 

The code following the G_Damage line in CheckSaberDamage handles all the deflections, locking, and parrying checks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...