Touch macro extensions

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, Chris H

Post Reply
rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Touch macro extensions

Post by rld » Wed Aug 10, 2011 1:58 pm

A previous version of the ACK mega patch fixed (as far as I know) the touch macro feature, and allowed it to be triggered by either a ranged attack or melee attack, where previously only a melee attack would trigger it.

Another issue is that currently the touch macro will only be triggered when the attack actually does damage to the player. This means that if you have good armor, the touch macro will never fire, which may or may not be desirable depending on what you are trying to do.

Especially with a ranged attack, if you have a creature trying to cast a spell on the player using the touch macro, or if you are using the touch macro to implement some other event (like the player being captured), you don't necessarily want armor to be able to protect the player from it.

So, I am thinking about changing the behavior in the next patch to allow the touch macro to trigger whether or not damage is inflicted. This would also mean that the creature would not have a chance to 'miss' based on skill when triggering a touch macro.

The 'hit' message would still be displayed for attacks that do damage, followed by whatever message (if any) the touch macro displays.

For attacks that do not do damage, I would like to remove the 'miss' message if and only if a touch macro is triggered, so if a creature is set up with a damage=0 attack that is *only* meant for triggering a touch macro, there are no unneeded messages displayed.

User avatar
Tdarcos
Posts: 5609
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Re: Touch macro extensions

Post by Tdarcos » Wed Aug 10, 2011 3:10 pm

rld wrote:For attacks that do not do damage, I would like to remove the 'miss' message if and only if a touch macro is triggered, so if a creature is set up with a damage=0 attack that is *only* meant for triggering a touch macro, there are no unneeded messages displayed.
Would it be possible for the macro to be told that the attack did or did not do damage, could the touch macro be given the option to decide if damage occurs, or whether a damage message is generated?

Not that I will use these features, but someone might.
"I know what you're doing, I see it all too clear."
- Duncan Sheik, Barely Breathing

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Re: Touch macro extensions

Post by rld » Thu Aug 11, 2011 11:03 am

Tdarcos wrote:
rld wrote:For attacks that do not do damage, I would like to remove the 'miss' message if and only if a touch macro is triggered, so if a creature is set up with a damage=0 attack that is *only* meant for triggering a touch macro, there are no unneeded messages displayed.
Would it be possible for the macro to be told that the attack did or did not do damage, could the touch macro be given the option to decide if damage occurs, or whether a damage message is generated?

Not that I will use these features, but someone might.
Not a bad idea at all. I think I am going to handle it like this. There will be a variable flag (one of the unused bits in the Z variable) that allows a switch between 'old mode' and 'new mode' for handling attacks on the player.

The 'old mode' (existing) sequence goes like this.

Code: Select all

1.  Calculate weapon damage
2.  Reduce weapon damage according to armor
3.  If damage > 0:
     a. Play 'hit' sound effect
     b. Message&#58; <creature> HITS YOU FOR xxx DAMAGE!
     c. If touch macro enabled, then&#58;
         i. Set var X to X location of attacking creature
         ii. Set var Y to Y location of attacking creature
         iii.  Run touch macro
4.  Else &#40;if damage <= 0&#41;&#58;
     a. Play 'miss' sound effect
     b. Message&#58; <creature> ATTACKS YOU AND MISSES!

The 'new mode' would go as follows:

Code: Select all

1. Calculate weapon damage
2. If damage = 0 &#40;missed attack&#41;, set damage = -1 and go to 5
3. Reduce weapon damage according to armor
4. If damage = 0 &#40;blocked attack&#41;, set damage = -2
5. If touch macro is enabled&#58;
    a. Set V to damage
    b. Set W to object number of weapon used
    c. Set X,Y to attacker location
    d. Call touch macro
    e. Set damage to V

If damage > 0&#58;
   Play 'hit' sound
   Message&#58; <creature> HITS YOU FOR xxx DAMAGE!
   Reduce HP by damage amount

If damage = 0&#58;
  No sound, no message

If damage = -1&#58;
   Play 'miss' sound
   Message&#58; <creature> ATTACKS YOU AND MISSES!
   
If damage = -2&#58;
   Play 'miss' sound
   Message&#58; <creature> BLOCKED BY YOUR ARMOR!

----

This allows the touch macro to print messages / perform actions as needed, and also allows it to change the amount of damage and/or the type of combat message that is printed.

If you want a weapon that doesn't actually damage the player (for example, a creature casting a spell or some other action at a distance), then use a weapon with damage=0, and have the touch macro set V to 0 (it will be -1 on macro entry). This will prevent any 'miss' message from being displayed, while allowing the touch macro to run and do whatever it needs to do.

Post Reply