The Dink Network

Reply to Getting the damage/hit value

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
March 11th, 07:03 PM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Just going through the Combat stuff

Is it possible to retrieve the exact amount of damage being done either by Dink or by an enemy sprite in a strike?

I found The Prophet's post on this, but it doesn't account for the fact that the initial strength of attack varies/is random as per the DinkC Reference

Step 1. When Dink or a monster hits the other, a number of hitpoints is randomly selected from the upper half of its strength range. In DinkC terms, you might write it like this:


int &hit_work = sp_strength(enemySprite, -1);
int &hits = math_mod(&hit_work, 2);
&hit_work / 2;
int &add_remainder = &hit_work;
&add_remainder += &hits;
&hits = random(&add_remainder, &hit_work);
&hits += 1;


Perhaps something clever can be done with sp_custom here - I still haven't got my head around this stuff, looking through magicman's persistent loot scripts... I tried to set sp_nohit() to 1 in these custom procedures so that the smashing sound of the barrel doesn't repeat all the time which I was getting in my dmod, and happens in the Persistent Loot dmod as well, but it had no effect.