[ACK PATCH] Fixing the touch macro

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

[ACK PATCH] Fixing the touch macro

Post by rld » Mon Sep 14, 2009 8:27 am

This code patch for the ACK player module (ACK02) is based on the ACK 3.251 release, using the procedure described in a previous post. Warning: given that I do not understand approximately 99% of the code in the ACK source package, it is entirely possible (and in fact quite likely) that modifying your ACK release as detailed below will result in horrific bugs and crashes. I take no responsibility for any aggravation that results from this.

It appears that the touch macro function (runs a macro when a creature scores a melee weapon hit on the player with >0 damage) is broken in the current release. This patch attempts to fix the touch macro.

THE EDITS: In O_PLAY2.PAS, starting around line 787, replace the following code in the 'hitcreature' function:

Code: Select all

     if crc^&#91;rcrc^&#91;who&#93;.crcsource&#93;.touchm<>0 then
       if weapon0t=7 then
	   if ack.ackversion>=30 then run_macro&#40;crc^&#91;rcrc^&#91;who&#93;.crcsource&#93;.touchm&#41;;

with the following code:

Code: Select all

     if crc^&#91;attacker_id&#93;.touchm<>0 then
       if weapon0t=7 then
	   if ack.ackversion>=30 then run_macro&#40;crc^&#91;attacker_id&#93;.touchm&#41;;

Also, in O_PLAY3.PAS, replace this code starting around line 562:

Code: Select all

      if crc^&#91;rcrc^&#91;who&#93;.crcsource&#93;.touchm<>0 then
       if weapon0t=7 then
	   if ack.ackversion>=30 then run_macro&#40;crc^&#91;rcrc^&#91;who&#93;.crcsource&#93;.touchm&#41;;

with the following code:

Code: Select all

      if crc^&#91;attacker_id&#93;.touchm<>0 then
        if weapon0t=7 then
          if ack.ackversion>=30 then run_macro&#40;crc^&#91;attacker_id&#93;.touchm&#41;;

Verified that this appears to work using BRIGANDS (after bumping the version up to 3.0 in the config editor):

Image

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop » Mon Sep 14, 2009 8:07 pm

Sweet! Nice work rld.
Which of you is interested in my fine wares?

Admiral Ackguh

Post by Admiral Ackguh » Tue Sep 15, 2009 8:12 pm

I haven't tried it yet but ... thank you.

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

Post by rld » Thu Oct 01, 2009 10:17 am

A useful extension to the above patch is to set the macro variables X and Y to the (X,Y) location of the creature that triggered the touch macro. This information is then available to the touch macro code.

One thing that this would allow is the creation of creatures that hit the player, run a touch macro and then disappear. (This would be done by using MAPTAKE in the touch macro to remove the creature, now that we know what space the creature is on.) For example, you could have a 'thief' creature steal a key item from the player, and the player would have to defeat the thief (later on, in a different room) to recover the item. You could even run an animation (using mosaics) to show the thief leaving the room after stealing the player's item, instead of having it simply vanish.

Code: Select all

     if crc^&#91;attacker_id&#93;.touchm<>0 then
       if weapon0t=7 then
	   if ack.ackversion>=30 then 
         begin
            ack.variables&#91;24&#93; &#58;= wxloc;
            ack.variables&#91;25&#93; &#58;= wyloc;
            run_macro&#40;crc^&#91;attacker_id&#93;.touchm&#41;;
         end;


Post Reply