It is currently 24 Apr 2024, 11:45
   
Text Size

Second Resolution Time Action not firing

Moderator: CCGHQ Admins

Second Resolution Time Action not firing

Postby Xander9009 » 10 Jul 2015, 14:46

I'm trying to fix TFM's werewolves. It's nothing wrong with the werewolf code, though. The problem is that there are two resolution time actions associated with a triggered ability for the beginning of the game, but only the first one ever fires.

Original Code | Open
Code: Select all
   <TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         TFM_Transform().DoCardRegistration_Resolution1("_HOWLPACK_ALPHA_CW_222183")
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         TFM_Transform().DoCardRegistration_Resolution2()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
Now, after a LOT of narrowing it down more and more, I discovered that it will only fire if I remove the replacement_effect attribute. This code works properly
Altered Code | Open
Code: Select all
   <TRIGGERED_ABILITY active_zone="ZONE_ANY">
      <TRIGGER value="BEGINNING_OF_STEP">
         return MTG():GetStep() == STEP_UPKEEP and MTG():GetTurnNumber() == 0
      </TRIGGER>
      <RESOLUTION_TIME_ACTION>
         TFM_Transform().DoCardRegistration_Resolution1("_HOWLPACK_ALPHA_CW_222183")
      </RESOLUTION_TIME_ACTION>
      <RESOLUTION_TIME_ACTION>
         TFM_Transform().DoCardRegistration_Resolution2()
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
I confirmed it has nothing at all to do with the function calls themselves by completely removing them and using MTG():MessageAllPlayers("1") and ("2") in their place. Only the first one ever fired, even when the entire rest of the card's code was removed entirely. The only thing that allowed both to fire was to remove the attribute.

Is this a known issue? Is there a fix for it?

Note, the only part of the code I didn't test changes for was the trigger. It's the same trigger used by all of the planeswalkers, and probably every card that uses Riiak's Custom Characteristics for making the manager token, as well as morph and manifest cards. All of those, however, use only a single RTA in that ability, so it may have simply never been noticed.

In the meantime, I'll continue testing, see if it may be a conflict with something.

EDIT: Still no definitive information on it, but apparently, deck composition has something to do with it. Two decks had different results in the same run. (Not in the same duel, though. I didn't test that.) One contained only a Mayor of Avabruck//Howlpack Alpha. The other contained that and a variety of other cards (morph and manifest), which may be overloading the system?

EDIT2: Okay, so, a deck can apparently have any number of a single card calling a replacement start of game trigger with no problem. But if there are multiple cards (in this case, Mayor of Avabruck//Howlpack Alpha and Acid-Spewer Dragon), then only the first RTA of each will fire. This only affects werewolves and other transform cards that use TFM's transform functions (Chalice of Life//Chalice of Death), because they're the only cards with a start of game trigger using multiple RTAs.

It's also possible any number of cards using two RTAs may work, but that's as of yet untested.

EDIT3: Okay, I still don't know why the problem was happening, but I've modified the code so it has the same result but uses only a single RTA. The first RTA creates the token and the second exiles it after storing its values. Now, in the only RTA, it sets a delayed trigger for when the token enters the battlefield, overrides that event, and stores the values in an RTA there in the delayed trigger. The only problem is that the pictures aren't changing...
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Second Resolution Time Action not firing

Postby thefiremind » 10 Jul 2015, 18:01

Xander9009 wrote:The problem is that there are two resolution time actions associated with a triggered ability for the beginning of the game, but only the first one ever fires.
I had a similar problem in DotP2013, but it was related to the ignore_filter attribute, so it's most likely unrelated, anyway here is what I'm talking about.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Second Resolution Time Action not firing

Postby Xander9009 » 10 Jul 2015, 20:46

Thanks for the tip. I read through the thread, but unfortunately, it doesn't appear to be the same problem given what I've run into. That appears to be a problem with values being inaccessible or resetting. All of the values handled in the first RTA worked fine, it's just that the second was never run at all. (Or, I might be misunderstanding how they're related. I've been staring at the code for awhile, so that's a definite possibility.)

After changing the code, everything seems to work okay except for the pictures on most of the cards and a few cards don't change names. Bloodline Keeper//Lord of Lineage, Chalice of Life//Chalice of Death, and Ravenous Demon//Archdemon of Greed allkeep their original name. Everything else gets the correct name change. Civilized Scholar//Homicidal Brute works perfectly, name and picture both (as well as four other cards). But Chosen of Markov//Markov's Servant, despite apparently having basically identical code for both the front and back cards as Civilized Scholar keeps its front picture. I'm still in the process of trying to make them more and more similar until it works so I can figure out what precisely is stopping it. (I haven't even attempted to fix the two name problems, yet.)

To make it even more confusing, I noticed previously that not every werewolf I had in a test deck created a token (when I first started testing, so the second RTA never ran to exile them). After changing the code so the exile worked properly and everything, I temporarily nixed the token override to see which ones were being created. I figured maybe the ones with working pictures are the ones that actually have a token created. Instead, every one of them with a working image does NOT create a permanent token. And neither Civilized Scholar nor Chosen of Markov do, so that's not even different between them. Checked the lists in your function file to see if perhaps they're treated differently somehow, but they're not. Put in comments in the code, but it all seems to run identically. So, back to testing!

If I manage to get it working, I'll see if I can do some more tests related to the original question (for instance, I never did test if increasing Acid-Spewer Dragon's number of RTAs to 2 will allow it to work, though I highly doubt it would). Until then, I'm just going to see if I can get them all working properly. The picture isn't a big deal, but it really should be changing (and it really shouldn't be working on 5 and not the rest...).

EDIT: Alright. So I finally spotted the pattern. All of the cards whose pictures change change color when they transform. I'm not sure why that would matter, but exactly 5 cards work, and they're the five the change color, so... (Finally spotted it when I gave Civilized Scholar the ability for Chosen of Markov and it worked properly. Giving Chosen of Markov the entire code except the TITLE, CARDNAME, and FILENAME tags also worked. It stopped working when I changed its mana cost back to black and that was the only change I made.)

Any suggestions for how to work around this would be welcome. I'm thinking of intentionally making the back the wrong color and giving it a static ability which changes its color back. Another thing I'll try first is a single RTA which changes its color (and having the back be the correct color). This way, the front becomes a different color, then transforms. I guess we'll see.

EDIT2: Neither of those worked. :( Setting the token to a different color (I'm using Chosen of Markov//Markov's Servant and made the token blue), and then giving it a free activated ability to permanently set its color to black worked. So, it can be worked around. But it's certainly not cooperating.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Second Resolution Time Action not firing

Postby Xander9009 » 11 Jul 2015, 13:03

So, my guess is that it won't reevaluate the art on its own. However, when it changes the frame, it will reevaluate the art then. So, I've set up a triggered ability to change the color to what it should be and it is by default the wrong color. Unfortunately, the real problem now is that it's not fast enough. It triggers on state based effects, but when it first transforms, it leaves a token of the wrong color on the battlefield until something (anything) happens. I tried firing the trigger manually, but it doesn't seem to want to work. And when it leaves the battlefield, it keeps the back side's art because the color didn't change. Only, if I change the color before it leaves the battlefield, then it might interfere with triggers for certain colors of creatures dying. I'm starting to suspect there simply isn't a good workaround for this (at least not the way I'm doing it). So, if anyone knows a way to force the game to reevaluate the picture without changing the color of the card, I would greatly appreciate it. Otherwise, they'll be left with the wrong picture, since the image isn't worth possible wrong interactions.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: Second Resolution Time Action not firing

Postby RiiakShiNal » 11 Jul 2015, 14:00

Have you tried forcing a re-evaluation effects by calling MTG():ReevaluateContinuousEffects()?
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Second Resolution Time Action not firing

Postby Xander9009 » 11 Jul 2015, 18:44

RiiakShiNal wrote:Have you tried forcing a re-evaluation effects by calling MTG():ReevaluateContinuousEffects()?
I did. It didn't seem to work. I'll try it a bit more thoroughly when I get a chance.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 26 guests


Who is online

In total there are 26 users online :: 0 registered, 0 hidden and 26 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 26 guests

Login Form