Hit Check Function: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Conversion script moved page Hit Check Function to hit Check Function: Converting page titles to lowercase)
(No difference)

Revision as of 23:24, 9 February 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.