Editing Scratch

From Eternity Wiki
Jump to navigationJump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{codepointer|description=Parameterized melee monster attack. Useful for custom damage values, unlike codepointers like [[SargAttack]] which act similarly but with fixed damage formulae.
Parameterized melee monster attack. Useful for custom damage values, unlike codepointers like [[SargAttack]] which act similarly but with fixed damage formulae.
|usage=
===Parameter Information===
*'''misc1''' = (if ''Args0'' = '''usemisc1''') Amount of damage to inflict (default of 0 = 0)  
*'''misc1''' = (if ''Args0'' = '''usemisc1''') Amount of damage to inflict (default of 0 = 0)  
*'''misc2''' = Mnemonic of sound to play (default of '''null''' = no sound will be played)  
*'''misc2''' = Mnemonic of sound to play (default of '''null''' = no sound will be played)  
Line 9: Line 9:
**3 or '''useconstant''' = Use constant value specified in ''Args1''
**3 or '''useconstant''' = Use constant value specified in ''Args1''
*''Args1'' = (if ''Args0'' = '''useconstant''') constant value or (if ''Args0'' = '''usecounter''') counter number, 0 to 7, holding the value
*''Args1'' = (if ''Args0'' = '''useconstant''') constant value or (if ''Args0'' = '''usecounter''') counter number, 0 to 7, holding the value
*''Args2'' = Mnemonic of sound to play (default of '''null''' = no sound will be played). Used if misc2 is left '''null'''. This way you can call A_Scratch without using the '''misc''' parameters, which allows typing the codepointer in parenthesis notation or in Decorate heredocs.
 
*''Args3'' = Reference to a [[damagetype]], either by a string referring to the damagetype's key, or by an int referring to the damagetype's ''num'' property.
===Remarks===
|examples=
For an imp-like scratch (with the same damage as that of an imp), you can use [[CounterDiceRoll]] to get similar randomness, as follows:
IMP2 G 0 A_CounterDiceRoll(0, 3, 8, 0, assign, multiplyone)
IMP2 G 6 A_Scratch(usecounter, 0, claw)
|notes=
If the object's target is valid and is within melee range (64 units), it will damage the target for the indicated amount. If the '''misc2''' parameter is non-zero and is a valid sound name, the indicated sound will played along with the attack.
If the object's target is valid and is within melee range (64 units), it will damage the target for the indicated amount. If the '''misc2''' parameter is non-zero and is a valid sound name, the indicated sound will played along with the attack.


Parameters Args0 and Args1 allow getting a damage value from other sources. If Args0 is '''usedamage''', the object's damage value will be used. If Args0 is '''usecounter''', the value of the counter specified in Args1 will be used. Finally, if Args0 is '''useconstant''', it will use the constant value in Args1. This has a similar effect to using '''usemisc1''' and the '''misc1''' parameter, but without the side effects caused by the "misc" parameters. When Args0 = '''usecounter''' and the state is combined with others that use [[SetCounter]] or [[CounterOp]], this allows you to perform your own custom damage calculations. The Args0 default value is '''usemisc1''', ensuring compatibility with MBF.
Parameters Args0 and Args1 allow getting a damage value from other sources. If Args0 is '''usedamage''', the object's damage value will be used. If Args0 is '''usecounter''', the value of the counter specified in Args1 will be used. Finally, if Args0 is '''useconstant''', it will use the constant value in Args1. This has a similar effect to using '''usemisc1''' and the '''misc1''' parameter, but without the side effects caused by the "misc" parameters. When Args0 = '''usecounter''' and the state is combined with others that use [[SetCounter]] or [[CounterOp]], this allows you to perform your own custom damage calculations. The Args0 default value is '''usemisc1''', ensuring compatibility with MBF.
|seealso=
 
*[[CounterDiceRoll]]
[[Category:Codepointers]]
*[[MissileAttack]]
*[[SargAttack12]]}}[[Category:MBF codepointers]]
Please note that all contributions to Eternity Wiki are considered to be released under the GNU Free Documentation License 1.2 (see Eternity Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page: