Jump to content
Sign in to follow this  
Plane

Make lightning 33% chance instead of 60% of elemental damage on weapons

Recommended Posts

In UDKGame/Classes/DunDefHeroManager.uc, there's a function called GetRandomDamageType().  This function is called whenever a random additional damage type is placed on a generated weapon, for example a classic staff or a BF Drill. 

This function should return one of three random damage types:

 ・ DunDefDamageType_Poison
 ・ DunDefDamageType_Fire
 ・ DunDefDamageType_Lightning

However, there are actually two more damage types, for a total of five.  The other two are actually sub-types of lightning:

 ・ DunDefDamageType_Poison
 ・ DunDefDamageType_Fire
 ・ DunDefDamageType_Lightning
 ・ DunDefDamageType_Lightning_FullMomentum
 ・ DunDefDamageType_LightingTower

The last two are treated the same as lightning 99% of the time, but this function nonetheless has an equal chance of returning any of the five.  As a result, lightning damage is chosen 60% of the time, and poison and fire are given 20% chances each. 

This seems like a bug.  It doesn't make any sense to apply the special "lightning tower" damage type to a weapon.  In fact, the two special traits that it has don't make any sense on weapons and are largely ignored, so it's basically treated the same as regular lightning.  And in the cases where it's not, it's silly; if you have a blaster rifle with additional lightning, and it happens to be the "lightning tower" type, then copters will ignore your additional lightning damage when they're dropping flares.  I don't think Trendy really meant for it to work this way.

I made a little change to this function, and I got a 1/3 chance for each of them.  I changed the return value line so it looked like this:

        return elementalTypes[rand(3)];

The first three types in the array are poison, fire, and lightning, so this little hack will make it so the game no longer randomly assigns DunDefDamageType_Lightning_FullMomentum or DunDefDamageType_LightingTower types to weapons. 

Since I was recently able to get the DDDK scripts to compile, I was able to test this out and it worked.  (This is the first thing I've done with the DDDK!  Yay me :)

P.S. Mambo, this is why you keep finding lightning-type lupine bows.

Share this post


Link to post
Share on other sites

So that explains it, I always wondered why my lupine bows were always over 50% chance it'd be electric. I knew it couldn't have just been bad luck after getting so many of the things.

Share this post


Link to post
Share on other sites

I don't have access to the revision history for the code, but what seems most likely to me is that it was originally a 1/3 chance for each element and GetRandomDamageType() worked exactly as designed, but then when they added the sub-types of lightning without changing the function, it ended up 3/5 1/5 1/5 instead.  The way the code is written, it doesn't seem intentional at all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...