Page 2 of 2

Re: CounterSpell

PostPosted: 15 Mar 2012, 11:13
by sadlyblue
But if that's the problem, shouldn't the RemoveFromGame solve that?
The diference from my code and the Isochron Scepter is the spell being played is a token vs a copy of an exiled card. That's what leads me to conclude the problem is obtaining the token doesn't copy the whole card.
More, what puzzles me is that is lets me make the choices, but it doesn't deal the damage (in the case of the Shock).

Btw:
Code: Select all
local card = MTG():ObtainToken( "SHOCK_245012", Object():GetController() )
card:RemoveFromGame()
if card:GetZone() == ZONE_REMOVED_FROM_GAME then
card:PlayFreeFromAnywhere( Object():GetController() )
end
Did the same thing. Since it lets me choose the targets this way i think proves the token is not nowhere.

Re: CounterSpell

PostPosted: 15 Mar 2012, 12:06
by thefiremind
I think I understood the problem. A token disappears when it moves to a zone that is not the battlefield. You can choose the targets because it happens before actually playing the spell, but then the game tries to move the token on the stack and it disappears. I'm afraid there's no solution to that.

Re: CounterSpell

PostPosted: 15 Mar 2012, 19:01
by sadlyblue
The only solution would be to load the card counterspell to a variable.
I've tried io, but didn't managed to save any thing. I think those libraries are not loaded, and i don't know how to solve it.
If we were able to save an Object, we could know were the problem is. And would help with other code in the future.
Unfortunately, i'm a beginner coder. Emphasis on beginner.
If anyone, more experience with lua, knows how to do it, pls let me know.

Re: CounterSpell

PostPosted: 22 Mar 2012, 10:35
by sadlyblue
I know it not the ideal but this works.
Code: Select all
<TRIGGERED_ABILITY active_zone="any" auto_skip="1">
<TRIGGER value="COMES_INTO_PLAY" simple_qualifier="self" />
<RESOLUTION_TIME_ACTION>
  local card = MTG():ObtainToken( "LAVA_SPIKE_12340091", Object():GetController() )
  MTG():ObjectDataChest():Set_CardPtr( 1, card )
  Object():RetainDataChest()
  Object():GetPlayer():CopySpellWithNewTargets( card )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
As the creature entered battlefield it played the Lava Spike. And it will play any spell (like counterspell).
Not sure it needs the retaindata and set_cardptr. I was trying for so long this ability had the most comment lines ever :lol:

This is sort of good news for Spellstutter Sprite, Chalice of the Void, and so on. Not perfect, since the counterspell will trigger as a normal spell would, but is something. Maybe if we get a way not to trigger other cards, kind of a ghost-split-second counter (in case of the sprites and chalice).

Re: CounterSpell

PostPosted: 22 Mar 2012, 21:14
by Eglin
sadlyblue wrote:I know it not the ideal but this works.
Code: Select all
<TRIGGERED_ABILITY active_zone="any" auto_skip="1">
<TRIGGER value="COMES_INTO_PLAY" simple_qualifier="self" />
<RESOLUTION_TIME_ACTION>
  local card = MTG():ObtainToken( "LAVA_SPIKE_12340091", Object():GetController() )
  MTG():ObjectDataChest():Set_CardPtr( 1, card )
  Object():RetainDataChest()
  Object():GetPlayer():CopySpellWithNewTargets( card )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
As the creature entered battlefield it played the Lava Spike. And it will play any spell (like counterspell).
Not sure it needs the retaindata and set_cardptr. I was trying for so long this ability had the most comment lines ever :lol:

This is sort of good news for Spellstutter Sprite, Chalice of the Void, and so on. Not perfect, since the counterspell will trigger as a normal spell would, but is something. Maybe if we get a way not to trigger other cards, kind of a ghost-split-second counter (in case of the sprites and chalice).
Great work! This is a fantastic workaround, IMHO.

Re: CounterSpell

PostPosted: 23 Mar 2012, 06:17
by Eglin
nabeshin wrote:There is at me an idea - it is incorrectly caused function, and from a hand it isn't fatal to a call. It is necessary to look than differs playing "spell ability" from "activated ability".
I'm not sure if this is what Nabe was trying to say all along or what, but Spellstutter Sprite can be easily coded by using a <SPELL_ABILTY> instead of a COMES_INTO_PLAY trigger. I've just tested it, and it works flawlessly.

Cheers,
Eglin

Re: CounterSpell

PostPosted: 23 Mar 2012, 09:31
by sadlyblue
But if you use another way to put in play, like Aether Vial it wont trigger.

Re: CounterSpell

PostPosted: 23 Mar 2012, 10:04
by Eglin
sadlyblue wrote:But if you use another way to put in play, like Aether Vial it wont trigger.
Ahhhh. That makes sense. Shucks.

Re: CounterSpell

PostPosted: 23 Mar 2012, 15:58
by nabeshin
The problem is solved, all can have a rest, recently did Counterbalance and found working option.
Code: Select all
<TRIGGERED_ABILITY internal="1" auto_skip="1" >
  <TRIGGER value="ZONECHANGE">
     return ( TriggerObject():GetZone() == ZONE_STACK and
             TriggerObject():GetPlayer() ~= Object():GetPlayer() and
             also not a land)
  </TRIGGER>
  <RESOLUTION_TIME_ACTION>
     local card = Object():GetPlayer():Library_GetTop()      
     if card and card:GetConvertedManaCost() == TriggerObject():GetConvertedManaCost() then
       TriggerObject():CounterSpell()
       card:GuidedReveal(4,4)
     end
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
The problem is solved a roundabout way, the error rises if ability gets to stack without "internal" mode.
P.S. TRIGGER value="ZONECHANGE", if "spell_played" - then you were late.

Re: CounterSpell

PostPosted: 23 Mar 2012, 18:13
by Persee
Great job !!

Re: CounterSpell

PostPosted: 23 Mar 2012, 19:19
by sadlyblue
Nice.
Just one thing, will the spell countered this way count as a spell played?

Re: CounterSpell

PostPosted: 23 Mar 2012, 21:17
by nabeshin
didn't check, I think that isn't counted