Hit Check Function

From RPTools Wiki
Revision as of 02:13, 7 October 2009 by Hawke (talk | contribs) (New page: 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,target...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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."]