Iterative Attacks

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Iterative Attacks

Post by Bone White »

You're moving more and more towards requiring a weapons database. In the meantime you could have different properties on a token. Attack1CriticalRange, Attack2CriticalRange etc so:

[code=php][attack1CriticalRange = "19,20"]
[attack2CriticalRange = "18,19,20"]
[for(attack,0,listLength(meleeAttackList)),Code:{
   [currentAttackCriticalRange = getProperty("attack" + attack + "CriticalRange")]
   [attackRoll = 1d20+attack]
   [if (listContains(currentAttackCriticalRange,attackRoll)): attackRoll = attackRoll + 1d20]
   [attackRoll] for [meleeDamage] [if (listContains(currentAttackCriticalRange,attackRoll)): "Critical!"]
}] [/code]


Yes this is messy, and you may need to tweak the code to fit your game, but I can't think of a simpler way off the top of my head. A database is the way to go and the sooner you start on that the easier your life will be.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Iterative Attacks

Post by wolph42 »

Why would you use ranges ? It's convoluted and slower. Simply set the crit value eg critRange=18 and then if(roll >= critRange):... Is much simpler.

Xannelson
Kobold
Posts: 23
Joined: Tue Oct 25, 2011 10:46 pm

Re: Iterative Attacks

Post by Xannelson »

Oh...well that makes a lot more sense.

User avatar
Bone White
Great Wyrm
Posts: 1124
Joined: Tue Aug 23, 2011 11:41 am
Location: Cornwall, UK

Re: Iterative Attacks

Post by Bone White »

wolph42 wrote:Why would you use ranges ? It's convoluted and slower. Simply set the crit value eg critRange=18 and then if(roll >= critRange):... Is much simpler.
It's more powerful and allows for ranges which are not simply just greater than or equal. It also teaches the user about lists, which is the current topic of tutoring.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Iterative Attacks

Post by wolph42 »

Bone White wrote:
wolph42 wrote:Why would you use ranges ? It's convoluted and slower. Simply set the crit value eg critRange=18 and then if(roll >= critRange):... Is much simpler.
It's more powerful and allows for ranges which are not simply just greater than or equal. It also teaches the user about lists, which is the current topic of tutoring.
true, but I think the lesson to be learned should be: use the most optimal form for the occasion!

Queenwalts
Kobold
Posts: 1
Joined: Sat Jun 07, 2014 4:18 am
Location: 123 street
Contact:

Re: Iterative Attacks

Post by Queenwalts »

I'm planning a character that has 2 claw attacks and a tail attack as natural weapons, but now I'm a little confused about the mechanics of using them all.

Post Reply

Return to “Macros”