Hit Check Function: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Taustin moved page hit Check Function to Hit Check Function without leaving a redirect) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
function HitCheck(attackResult,targetName,TargetDefense) | function HitCheck(attackResult,targetName,TargetDefense) | ||
< | <syntaxhighlight lang="mtmacro"> | ||
Code: | Code: | ||
[h: attackResult = arg(0)] | [h: attackResult = arg(0)] | ||
Line 11: | Line 11: | ||
[r,if(attackResult >= defenseValue): "Hit!"; "Miss."] | [r,if(attackResult >= defenseValue): "Hit!"; "Miss."] | ||
</ | </syntaxhighlight> | ||
Thanks to Rumble for help with this macro. | Thanks to Rumble for help with this macro. | ||
[[Category:Cookbook]] | [[Category:Cookbook]] |
Latest revision as of 23:59, 2 May 2023
Checks the value of an attack result against a target's defense. If the attack is greater than or equal to the defense, it outputs "Hit!" or "Miss."
function HitCheck(attackResult,targetName,TargetDefense)
Code:
[h: attackResult = arg(0)]
[h: targetName = arg(1)]
[h: targetDefense = arg(2)]
[h: defenseValue = getProperty(targetDefense,targetName)]
[r,if(attackResult >= defenseValue): "Hit!"; "Miss."]
Thanks to Rumble for help with this macro.