Back to the Vavoom Forum Archives


Forum

Disable damage randomize

Wed, 19 May 2010 01:01:48

Alex-bomber_Man

How to disable damage randomizing for weapons fnd monsters? Is there any flag that disables random damage formula (1d3 if im not making a mistake). I need it a lot for my Trium mod...
Wed, 19 May 2010 03:26:49

b0rsuk

I've found it. In file progs/common/linespec/EntityEx.Misc.vc:
//==========================================================================
//
//  HITDICE
//
//  Most damage in HERETIC and HEXEN defined using HITDICE
//
//==========================================================================

final int HITDICE(int a)
{
	return (1 + (P_Random() & 7)) * a;
}
You can redefine the function and make it return a constant. I assume P_Random() returns a float between 0 and 1.
Thu, 20 May 2010 03:26:30

b0rsuk

I realized I made an error. If you make HITDICE() return a constant, then all damage sources will deal constant damage. Afrits as much as serpents. What I would do instead is to multiply damage dealt (int a) by a constant. By default, the function multiplies damage dealt by random number between 1 and 8 (I was most likely wrong about P_Random returning a float between 0 and 1). You only need to replace that random 1-8 with a constant. Average of 1-8 is 4.5 . As far as I know you can't deal fractional damage, so if damage is an odd number you'll be making an error of +/- 0.5, but no error with even number of damage. Alternatively, you can try to hunt down all calls to HITDICE() in VavoomC code and replace them by hand. Probably cleaner in the long run, but you'd be burning bridges behind you and there's more opportunity to make an error.
Fri, 21 May 2010 14:11:15

Alex-bomber_Man

May you tell me, which file is it in?
Sun, 23 May 2010 16:36:42

b0rsuk

[quote="Alex-bomber_Man":2ko6apkl]May you tell me, which file is it in? The file progs/common/linespec/EntityEx.Misc.vc . The "progs" subdirectory is actually inside basev/basepak.pk3 . You can modify files inside the pk3 file and it will work - but it's not very clean. I have a separate directory for my mod and it's currently like this:
vavoom/myhexgame
|-- actors
|   |-- heretic
|   |-- hexen
|   |-- raven
|   `-- shared
|-- progs
|   |-- cgame
|   |-- engine
|   |-- game
|   |-- linespec
|   `-- uibase
`-- saves

12 directories
You can get the vavoomC files from your basepak.pk3, or from separate download at this page: <!-- m --><a class="postlink" href="http://www.vavoom-engine.com/download.php">http://www.vavoom-engine.com/download.php</a><!-- m -->
Sun, 23 May 2010 17:21:27

Alex-bomber_Man

I use a separate directory too, and i compile the progs any time they are modified. I wasn't writing/modifying them myself before, so i'm new to it. very glad for your help <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
Fri, 21 Jan 2011 18:52:42

b0rsuk

I have questions for Janis and Firebrand, because I don't fully understand how Hitdice function works: 1) In the code above it looks like 1 + (0-6), so 1-7 damage * a ? Normally, modulo division by X (with % in most languages) gi
Mon, 24 Jan 2011 13:23:31

Firebrand

HITDICE calls are all defined in progs and nowhere else, ou might want to check de Damage method inside EntityEx.Damage.vc to find more answers, player missiles don't use hitdice for anything their damage is also variable, but it's all defined in the weap

Back to the Vavoom Forum Archives