It is currently 05 Sep 2025, 19:02
   
Text Size

Formal Request Thread

Moderator: CCGHQ Admins

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 08:31

gorem2k wrote:How to code activated ability with {X} {X} in its cost?
Exactly as the code you posted. If you encountered a problem with that code, it might be an engine limitation. What doesn't work?

Master Necro wrote:But it just made logic to replace CREATURE WITH ENCHANTMENT. :mrgreen:
But CREATURE isn't a constant, either... it should be CARD_TYPE_CREATURE. :mrgreen:

Master Necro wrote:And now I have a problem with Prahv, Spires of Order , it won't let me activate the second ability.
First, remove all the mode="3", this isn't a modal spell.
I think that the problem is how the target is coded: I was about to start coding Prahv for my Azorius deck, too, but I changed my mind because I didn't know how to code the target so that it allows the player to choose a card anywhere. Most of the times the damage will come from the battlefield or from the stack, but there are exceptions (Gempalm Incinerator for example). You would need a query that makes you choose a zone before you declare a target, but I have no idea about how to do that.
< 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: 722 times

Re: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 08:37

thefiremind wrote:
gorem2k wrote:How to code activated ability with {X} {X} in its cost?
Exactly as the code you posted. If you encountered a problem with that code, it might be an engine limitation. What doesn't work?

Master Necro wrote:But it just made logic to replace CREATURE WITH ENCHANTMENT. :mrgreen:
But CREATURE isn't a constant, either... it should be CARD_TYPE_CREATURE. :mrgreen:

Master Necro wrote:And now I have a problem with Prahv, Spires of Order , it won't let me activate the second ability.
First, remove all the mode="3", this isn't a modal spell.
I think that the problem is how the target is coded: I was about to start coding Prahv for my Azorius deck, too, but I changed my mind because I didn't know how to code the target so that it allows the player to choose a card anywhere. Most of the times the damage will come from the battlefield or from the stack, but there are exceptions (Gempalm Incinerator for example). You would need a query that makes you choose a zone before you declare a target, but I have no idea about how to do that.
Sincerely I just copied the third option from Rith's Charm but it looks I was to dumb to remove the mode="3". :oops:
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 08:43

Master Necro wrote:Sincerely I just copied the third option from Rith's Charm but it looks I was to dumb to remove the mode="3". :oops:
Who made Rith's Charm? If it works, then it's a big step ahead... and I just noticed that your code has the delayed triggered ability nested inside the activated ability, which could be another reason why it doesn't work.
< 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: 722 times

Re: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 08:50

thefiremind wrote:
Master Necro wrote:Sincerely I just copied the third option from Rith's Charm but it looks I was to dumb to remove the mode="3". :oops:
Who made Rith's Charm? If it works, then it's a big step ahead... and I just noticed that your code has the delayed triggered ability nested inside the activated ability, which could be another reason why it doesn't work.
Bugger me if I know it's from DATA_CORE_972.wad , and I have removed the mode="3" and it still doesn't let me activate it...

Code: Select all
 <ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
   <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
   <COST mana_cost="{4}{W}{U}" type="Mana" />
   <COST type="TapSelf" />
    <TARGET tag="CARD_QUERY_CHOOSE_SOURCE_PREVENT_DAMAGE" definition="1" compartment="0" count="1" />
    <TARGET_DEFINITION id="1">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_CARDS )
      filter:Add( FE_ZONE, OP_IS, ZONE_ANY)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION layer="6">
      local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
      if target ~= nil then
       local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, target)
       MTG():CreateDelayedTrigger(2, delayDC)
      end
    </RESOLUTION_TIME_ACTION>
    <DURATION simple_duration="UntilEOT" />
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="SOURCE_DEALS_DAMAGE" pre_trigger="1">
      return TriggerObject() == EffectDC():Get_CardPtr(1)   
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if EffectController() ~= nil then
     EffectController(): Damage():PreventAll() )
      end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
  </ACTIVATED_ABILITY>
P.S. What should I put instead of the delayedtrigger or should I delete the whole MTG():CreateDelayedTrigger(2, delayDC) altogether?
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 08:54

Master Necro wrote:P.S. What should I put instead of the delayedtrigger or should I delete the whole MTG():CreateDelayedTrigger(2, delayDC) altogether?
None of that, you need to move this
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="SOURCE_DEALS_DAMAGE" pre_trigger="1">
      return TriggerObject() == EffectDC():Get_CardPtr(1)   
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if EffectController() ~= nil then
     EffectController(): Damage():PreventAll() )
      end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
out of the ACTIVATED_ABILITY: have you ever seen an ability inside another ability? :lol:
Last edited by thefiremind on 24 Jul 2013, 08:57, edited 2 times in total.
< 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: 722 times

Re: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 08:56

thefiremind wrote:
Master Necro wrote:P.S. What should I put instead of the delayedtrigger or should I delete the whole MTG():CreateDelayedTrigger(2, delayDC) altogether?
None of that, you need to move this
Code: Select all
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="SOURCE_DEALS_DAMAGE" pre_trigger="1">
      return TriggerObject() == EffectDC():Get_CardPtr(1)   
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if EffectController() ~= nil then
     EffectController(): Damage():PreventAll() )
      end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
out of the ACTIVATED_ABILITY: have you ever seen an ability inside another ability? :lol:
Image
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 08:57

I was about to forget another important thing:
Master Necro wrote:I've already copied all of your functions in my function folder.
This will make our mods incompatible as soon as I update mine... let the usual "hey your card X doesn't work" "it's working fine for me" begin... #-o
< 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: 722 times

Re: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 09:07

thefiremind wrote:I was about to forget another important thing:
Master Necro wrote:I've already copied all of your functions in my function folder.
This will make our mods incompatible as soon as I update mine... let the usual "hey your card X doesn't work" "it's working fine for me" begin... #-o
Don't worry as soon as you update I will update mine. ;)

On a sadder note I still can't activate Prahv ability.

Code: Select all
<ACTIVATED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
   <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{4}{W}{U} , {T}: Prevent all damage a source of your choice would deal this turn.]]></LOCALISED_TEXT>
   <COST mana_cost="{4}{W}{U}" type="Mana" />
   <COST type="TapSelf" />
    <TARGET tag="CARD_QUERY_CHOOSE_SOURCE_PREVENT_DAMAGE" definition="1" compartment="0" count="1" />
    <TARGET_DEFINITION id="1">
      local filter = ClearFilter()
      filter:SetFilterType( FILTER_TYPE_CARDS )
      filter:Add( FE_ZONE, OP_IS, ZONE_ANY)
    </TARGET_DEFINITION>
    <RESOLUTION_TIME_ACTION layer="6">
      local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
      if target ~= nil then
       local delayDC = EffectDC():Make_Chest(1)
       delayDC:Set_CardPtr(0, target)
       MTG():CreateDelayedTrigger(2, delayDC)
      end
    </RESOLUTION_TIME_ACTION>
    <DURATION simple_duration="UntilEOT" />
   </ACTIVATED_ABILITY>
  <TRIGGERED_ABILITY replacement_effect="1" resource_id="2">
    <TRIGGER value="SOURCE_DEALS_DAMAGE" pre_trigger="1">
      return TriggerObject() == EffectDC():Get_CardPtr(1)   
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      if EffectController() ~= nil then
     EffectController(): Damage():PreventAll() )
      end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 09:17

This means that Rith's Charm doesn't work, either... I think that it can't be coded if someone doesn't find an idea to make a query that precedes target selection.

I just noticed that you are using register #1 both for the target and for the delayed chest, but this has nothing to do with being able to activate the ability.
< 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: 722 times

Re: Formal Request Thread

Postby Master Necro » 24 Jul 2013, 09:20

thefiremind wrote:This means that Rith's Charm doesn't work, either... I think that it can't be coded if someone doesn't find an idea to make a query that precedes target selection.

I just noticed that you are using register #1 both for the target and for the delayed chest, but this has nothing to do with being able to activate the ability.
Than I am truly sad that I will not have Prahv in my deck...
User avatar
Master Necro
 
Posts: 259
Joined: 24 Apr 2013, 18:25
Has thanked: 83 times
Been thanked: 21 times

Re: Formal Request Thread

Postby MC Brodie » 24 Jul 2013, 10:15

I think I have successfully coded Sigarda, Host of Herons (by coded I mean convert thefiremind's 2013 card to a 2014 card) but I don't know why it does anything.

Sigarda, Host of Herons | Open
Code: Select all
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" active_zone="ZONE_BATTLEFIELD" >
    <TRIGGER value="SACRIFICE" simple_qualifier="objectyoucontrol" pre_trigger="1" />
    local last_caster = LinkedDC():Get_PlayerPtr(0)
    if last_caster ~= nil and last_caster:GetTeam() ~= EffectController():GetTeam() then
       return true
    end
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <TRIGGER value="ABILITY_PLAYED" >
    LinkedDC():Set_PlayerPtr(0, TriggerPlayer() )
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <TRIGGER value="SPELL_PLAYED" >
    LinkedDC():Set_PlayerPtr(0, TriggerPlayer() )
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <TRIGGER value="ABILITY_RESOLVED" >
    LinkedDC():Set_PlayerPtr(0, nil )
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY linked_ability_group="1">
    <TRIGGER value="SPELL_RESOLVED" >
    LinkedDC():Set_PlayerPtr(0, nil )
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
I understand how the 2nd - 5th triggers work with the first one, but what I don't understand is how the first trigger does anything without a Resolution TIme Action block?

And to make sure I understand the rules correctly, an opponent could still cast a card like Diabolic Edict on you, you would have to choose a creature and edict would resolve but nothing would happen.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
MC Brodie
 
Posts: 310
Joined: 01 Jun 2013, 00:10
Has thanked: 44 times
Been thanked: 34 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 11:17

The first trigger is wrong: you closed the TRIGGER block without including the code that follows, and in that code there's no "return false" for when the condition isn't verified. It should be:
Code: Select all
  <TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
    <TRIGGER value="SACRIFICE" simple_qualifier="objectyoucontrol" pre_trigger="1">
    local last_caster = LinkedDC():Get_PlayerPtr(0)
    if last_caster ~= nil and last_caster:GetTeam() ~= EffectController():GetTeam() then
       return true
    end
    return false
    </TRIGGER>
  </TRIGGERED_ABILITY>
MC Brodie wrote:I understand how the 2nd - 5th triggers work with the first one, but what I don't understand is how the first trigger does anything without a Resolution TIme Action block?
When a TRIGGERED_ABILITY has replacement_effect="1" (or internal="1" in the previous DotP games) and pre_trigger="1" and no resolution, its trigger implicitly overrides the event that caused the trigger. This particular trigger, for example, overrides the sacrifice.

MC Brodie wrote:And to make sure I understand the rules correctly, an opponent could still cast a card like Diabolic Edict on you, you would have to choose a creature and edict would resolve but nothing would happen.
That's right, anyway there are some scenarios that this implementation doesn't take into account (look at the rulings on the Gatherer page), so be aware that the card will have some wrong interactions with other cards.
< 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: 722 times

Re: Formal Request Thread

Postby RiiakShiNal » 24 Jul 2013, 12:00

thefiremind wrote:When a TRIGGERED_ABILITY has replacement_effect="1" (or internal="1" in the previous DotP games) and pre_trigger="1" and no resolution, its trigger implicitly overrides the event that caused the trigger. This particular trigger, for example, overrides the sacrifice.
Though in DotP 2014 we need to explicitly override the event with:
Code: Select all
MTG():OverrideEvent()
This can be seen on official cards that have replacement_effect="1" and pre_trigger="1" like AEther Storm, Blightsteel Colossus, Diluvian Primordial, Obstinate Baloth, and Sulfuric Vortex.
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

Re: Formal Request Thread

Postby thefiremind » 24 Jul 2013, 12:04

I'm almost sure that MTG():OverrideEvent() is mandatory only if there's a RESOLUTION_TIME_ACTION: without that, and under the conditions I wrote, the override happens anyway.
< 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: 722 times

Re: Formal Request Thread

Postby RiiakShiNal » 24 Jul 2013, 12:58

thefiremind wrote:I'm almost sure that MTG():OverrideEvent() is mandatory only if there's a RESOLUTION_TIME_ACTION: without that, and under the conditions I wrote, the override happens anyway.
So you're saying that AEther Storm and Sulfuric Vortex have it even though it is unnecessary in those circumstances?
RiiakShiNal
Programmer
 
Posts: 2188
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 497 times

PreviousNext

Return to 2014

Who is online

Users browsing this forum: No registered users and 10 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 10 guests

Login Form