View Single Post
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 2,847

Old July 11th, 2020, 04:35 AM
Quote:
Originally Posted by Illyahr View Post
The coding for the Hida Defender's Critical Focus ability (Oriental Adventures) doesn't function quite right. Please adjust to the following:

Code:
if (field[usrChosen1].chosen.tagis[thingid.wBattleaxe] <> 0) then
  foreach pick in hero from BaseWep where "WepFocus.? & IsWeapon.wBattleaxe"
    perform each.delete[wCritMult.?]
    perform each.assign[wCritMult.4]
  nexteach
elseif (field[usrChosen1].chosen.tagis[thingid.wWarhammer] <> 0) then
  foreach pick in hero from BaseWep where "WepFocus.? & IsWeapon.wWarhammer"
    perform each.delete[wCritMult.?]
    perform each.assign[wCritMult.4]
  nexteach
elseif (field[usrChosen1].chosen.tagis[thingid.wGreatclub] <> 0) then
  foreach pick in hero from BaseWep where "WepFocus.? & IsWeapon.wGreatclub"
    perform each.delete[wCritMult.?]
    perform each.assign[wCritMult.3]
  nexteach
endif
foreach loops are powerful, but also notoriously slow. As a modification, please try this:

Code:
~ Assign the appropriate tag to all weapons that meet the criteria
  foreach pick in hero where "WepFocus.? & (thingid.wBattleaxe | thingid.wWarhammer | thingid.wGreatclub)"
        perform each.delete[wCritMult.?]
    if (eachpick.tagis[thingid.wGreatclub] <> 0) then
        perform eachpick.assign[wCritMult.3]
    else
        perform eachpick.assign[wCritMult.4]
    endif
  nexteach
Sendric is offline   #1000 Reply With Quote