It is currently 16 Apr 2024, 19:21
   
Text Size

Report cards error here

Moderator: CCGHQ Admins

Re: Report cards error here

Postby thefiremind » 02 Oct 2013, 09:18

GrovyleXShinyCelebi wrote:What about a target definition like this?

[...]

and if not that:
[...]
It won't work... if this filter can't let you select cards in the exile zone, then none can: the best you could potentially get from ZONE_ANYWHERE would be selecting cards anywhere except for the exile zone. But what probably happens is that you'll be able to select cards only from the battlefield because there's no automatic query for asking you to select a zone.
I don't think there's a shorter way to do that: you need a query that asks for a zone, as you did.

About your code, you saved the source of the damage for the delayed trigger, but you should save the EffectSource as well: I don't think it carries over to the delayed trigger automatically.
< 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: Report cards error here

Postby RiiakShiNal » 02 Oct 2013, 14:10

Also there is the problem that you are still targetting which would not let you select cards that have Shroud or Hexproof which should be allowed because the card does not state Target. It says a "source of your choice" not "target source".

Besides the second definition is completely wrong because it wouldn't let you select anything ("And" filter), you would need to put the zones in an "Or" sub-filter.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Report cards error here

Postby MC Brodie » 02 Oct 2013, 14:38

Thank you for the responses guys. I never thought of flickering something with an ETB. I'll try adding the exile zone to my code though I know TFM has had problems with something similar before. I might give the data chest method a shot too but depending on how you cycle through the data chest I'll probably stick with what I have.
I wasn't using a target block so I should be good with shroud/hexproof. I tried using a subfilter_or with the various zones but it would only let me select something from the battlefield like TFM said.

The problem I have now is the code doesn't redirect damage from a triggered effect in a graveyard. I can select a card while it is in a graveyard but the damage doesn't redirect. I can't remember but I think the delayed trigger never triggers. I'll have to mess with it some more after work.

One thing I'm unsure about is when you should actually check if a variable is nil. I just do it because I see other people do it and I assume its something you should always do. Before I create the delayed trigger I check if the chosen source is nil. Could this be the problem?

Also, if a card changes zones multiple times, do you have to protect it for each zone?
-----------------------------------------------------------------------
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: Report cards error here

Postby RiiakShiNal » 02 Oct 2013, 16:07

Using the sub-filter to filter multiple zones won't help with selecting items via ChooseItem(), but it can help for evaluating them to then put into a data chest then using ChooseItemFromDC().

If you target a card that is expected to change zones (like something with an ETB trigger) then to make sure that your pointer is good you need to remember to protect it. Yes, you do have to protect it once for each zone change.

Checking for nil variables is a good thing and is something that should be done anywhere where there is the possibility something could be nil. More likely your problem is your pointer became nil due to a zone change rather than the check being the problem.
RiiakShiNal
Programmer
 
Posts: 2185
Joined: 16 May 2011, 21:37
Has thanked: 75 times
Been thanked: 496 times

Re: Report cards error here

Postby MC Brodie » 03 Oct 2013, 08:32

I don't know what the deal is with my Opal-eye code. I don't think it's a card protection issue because I tried selecting the Goblin Arsonist while it was in the graveyard and the Goblin Arsonist trigger is on the stack. The Opal's delayed trigger just doesn't trigger. I think I'll put that one aside now.

Ok on to a different issue. I'm seen some folks say Forecast is now possible. I'm attempting to code Skyscribing but I'm running into problems with the forecast part. I'm still getting a game crash /w dump file when I activate the forecast ability. Has anyone had any luck with this? Btw, your upkeep manager does work thefiremind. Thank you.

Skyscribing Forecast | Open
Code: Select all
  <ACTIVATED_ABILITY active_zone="ZONE_HAND">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Forecast — {2}{U}, Reveal Skyscribing from your hand: Each player draws a card.]]></LOCALISED_TEXT>
   <COST mana_cost="{2}{U}" type="Mana" />
   <COST type="RevealSelf" />
   <AVAILABILITY upkeep="1">
      return EffectController():MyTurn()
    </AVAILABILITY>
   <RESOLUTION_TIME_ACTION>
      for i=0,MTG():GetNumberOfPlayers()-1 do
         local nthPlayer = MTG():GetNthPlayer(i)
         if nthPlayer ~= nil then
            nthPlayer:DrawCards(1)
         end
      end
    </RESOLUTION_TIME_ACTION>
  </ACTIVATED_ABILITY>
-----------------------------------------------------------------------
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: Report cards error here

Postby thefiremind » 03 Oct 2013, 09:33

MC Brodie wrote:I don't know what the deal is with my Opal-eye code. I don't think it's a card protection issue because I tried selecting the Goblin Arsonist while it was in the graveyard and the Goblin Arsonist trigger is on the stack. The Opal's delayed trigger just doesn't trigger.
You probably overlooked my comment, and that's totally fair because I overlooked the fact that the Opal-Eye code I was looking at was yours. :lol:
thefiremind wrote:About your code, you saved the source of the damage for the delayed trigger, but you should save the EffectSource as well: I don't think it carries over to the delayed trigger automatically.
--------------------------
MC Brodie wrote:Ok on to a different issue. I'm seen some folks say Forecast is now possible. I'm attempting to code Skyscribing but I'm running into problems with the forecast part. I'm still getting a game crash /w dump file when I activate the forecast ability. Has anyone had any luck with this?
Forecast is now possible, where "now" means "with the latest version of the game" (actually, the first update should suffice if I remember correctly). Is your game updated?
< 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: Report cards error here

Postby MC Brodie » 03 Oct 2013, 10:41

Sorry.. It's been a long night/early morning...

thefiremind wrote:
MC Brodie wrote:I don't know what the deal is with my Opal-eye code. I don't think it's a card protection issue because I tried selecting the Goblin Arsonist while it was in the graveyard and the Goblin Arsonist trigger is on the stack. The Opal's delayed trigger just doesn't trigger.
You probably overlooked my comment, and that's totally fair because I overlooked the fact that the Opal-Eye code I was looking at was yours. :lol:
thefiremind wrote:About your code, you saved the source of the damage for the delayed trigger, but you should save the EffectSource as well: I don't think it carries over to the delayed trigger automatically.
To be honest, I didn't think this was an issue. The card works correctly for Inferno Titan triggers, Shock, and regular attacking. Nonetheless, I did add a "DisplayMessage" to the delayed trigger so I could see if it Goblin Arsonist set it off and there was no message. Since you've posted this, I've added the EffectSource() to the data chest and I'm getting the same result in my tests.

thefiremind wrote:
MC Brodie wrote:Ok on to a different issue. I'm seen some folks say Forecast is now possible. I'm attempting to code Skyscribing but I'm running into problems with the forecast part. I'm still getting a game crash /w dump file when I activate the forecast ability. Has anyone had any luck with this?
Forecast is now possible, where "now" means "with the latest version of the game" (actually, the first update should suffice if I remember correctly). Is your game updated?
I don't know what I was doing... When the expansion came out I was having problems running my modded version of DotP so I removed the expansion files from that folder. I completely forgot about that. I just put them back in and everything seems to work fine, including Forecast. Although, I thought the forecast bug was fixed in an earlier patch and not the expansion. It doesn't matter. I don't seem to be having problems now. Thank you.

In testing forecast I did notice that the upkeep manager wasn't being put onto the battlefield when your opponent would start off the game. The example triggered ability in the .LOL file you posted has this trigger:
Code: Select all
<TRIGGER value="BEGINNING_OF_PLAYERS_STEP" simple_qualifier="controller">
I removed the simple_qualified="controller" and that seemed to work.
-----------------------------------------------------------------------
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: Report cards error here

Postby GrovyleXShinyCelebi » 08 Oct 2013, 23:28

Hey, I have a quick question.

I'm trying to make Tephraderm, and I'm having trouble specifically with the second ability and what function should I use to get the player whose spell the damage is caused by:

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
  <FILENAME text="TEPHRADERM_9939659" />
  <CARDNAME text="TEPHRADERM" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Tephraderm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Téphraderme]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Tefradermo]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Tephraderm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tefraderma]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Tephraderm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Tephraderm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Tephraderm]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Tefriderma]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="39659" />
  <ARTID value="21243" />
  <ARTIST name="Paolo Parente" />
  <CASTING_COST cost="{4}{R}" />
  <TYPE metaname="Creature" />
  <SUB_TYPE metaname="Beast" />
  <EXPANSION value="ONS" />
  <RARITY metaname="R" />
  <POWER value="4" />
  <TOUGHNESS value="5" />
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a creature deals damage to Tephraderm, Tephraderm deals that much damage to that creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois qu’une créature inflige des blessures au Téphraderme, le Téphraderme inflige ce même nombre de blessures à cette créature.À chaque fois qu’un sort inflige des blessures au Téphraderme, le Téphraderme inflige ce même nombre de blessures ]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que una criatura haga daño al Tefradermo, el Tefradermo hace esa cantidad de daño a esa criatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn eine Kreatur dem Tephraderm Kampfschaden zufügt, fügt das Tephraderm dieser Kreatur ebensoviel Schaden zu.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta una creatura infligge danno al Tefraderma, il Tefraderma infligge un pari danno a quella creatura.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever a creature deals damage to Tephraderm, Tephraderm deals that much damage to that creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever a creature deals damage to Tephraderm, Tephraderm deals that much damage to that creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever a creature deals damage to Tephraderm, Tephraderm deals that much damage to that creature.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que uma criatura causa dano de combate a Tefriderma, Tefriderma causa aquela quantidade de pontos de dano àquela criatura.]]></LOCALISED_TEXT>
   <SFX text="TARGET_CHOP_PLAY" />
  <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" damage_type="all">
    return (SecondaryObject() == EffectSource()) and (TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ))
  </TRIGGER>   
    <RESOLUTION_TIME_ACTION>
    local creature = TriggerObject()
    if creature ~= nil then
       local damage = Damage():GetAmount()
       if damage ~= nil then
          EffectSourceLKI():DealDamageTo( damage, creature  )
       end
    end
    </RESOLUTION_TIME_ACTION> 
  </TRIGGERED_ABILITY>
  <TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever a spell deals damage to Tephraderm, Tephraderm deals that much damage to that spell’s controller.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[au contrôleur de ce sort.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que un hechizo haga daño al Tefradermo, el Tefradermo hace esa cantidad de daño al controlador de ese hechizo.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn ein Zauberspruch dem Tephraderm Schaden zufügt, fügt das Tephraderm dem Beherrscher dieses Zauberspruchs ebensoviel Schaden zu.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta una magia infligge danno al Tefraderma, il Tefraderma infligge un pari danno al controllore di quella magia.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever a spell deals damage to Tephraderm, Tephraderm deals that much damage to that spell’s controller.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever a spell deals damage to Tephraderm, Tephraderm deals that much damage to that spell’s controller.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever a spell deals damage to Tephraderm, Tephraderm deals that much damage to that spell’s controller.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que uma mágica causa dano a Tefriderma, Tefriderma causa aquela quantidade de pontos de dano ao controlador daquela mágica.]]></LOCALISED_TEXT>
   <SFX text="TARGET_CHOP_PLAY" />
  <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" damage_type="all">
    return (SecondaryObject() == EffectSource()) and (TriggerObject():GetCardType():IsPermanent() == false)
  </TRIGGER>   
    <RESOLUTION_TIME_ACTION>
    local player = TriggerObject() and TriggerObject():GetPlayer()
    if player ~= nil then
       local damage = Damage():GetAmount()
       if damage ~= nil then
          EffectSourceLKI():DealDamageTo( damage, player  )
       end
    end
    </RESOLUTION_TIME_ACTION>   
  </TRIGGERED_ABILITY>
  <SFX text="COMBAT_FLAME_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
  <SFX text="COMBAT_FLAME_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
I've tried "TriggerObject():GetPlayer()", "TriggerObject():GetController()", "TriggerObject():GetOwner()", (what are the differences between the first three, anyways?) and "TriggerPlayer()" and none of them seem to be working...

Anyone know which function should I use?
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby MC Brodie » 09 Oct 2013, 00:56

For this case I think you'll need to use TriggerObjectLKI() since the spell will be in the graveyard when the ability is resolving. So try saving the player as:
TriggerObjectLKI():GetPlayer()

I'm not sure of the exact instances where you'd want to use GetPlayer() over GetController() or vice versa. GetOwner would be used for cards like Aetherling or Obzedat, Ghost Council. I remember that the hard way when I decided to exile the Obzedat, Ghost Council that I acquired from my opponent with a Jace.
-----------------------------------------------------------------------
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: Report cards error here

Postby GrovyleXShinyCelebi » 09 Oct 2013, 01:03

I remembered I tried using TriggerObjectLKI() in the trigger check and the trigger didn't activate. I'll try it again tomorrow and see what happens.
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby MC Brodie » 09 Oct 2013, 01:25

GrovyleXShinyCelebi wrote:I remembered I tried using TriggerObjectLKI() in the trigger check and the trigger didn't activate. I'll try it again tomorrow and see what happens.
I meant the Resolution Time Action, not in the trigger. The trigger should be fine. Like this:
Code: Select all
  <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" damage_type="all">
    return (SecondaryObject() == EffectSource()) and (TriggerObject():GetCardType():IsPermanent() == false)
  </TRIGGER>   
    <RESOLUTION_TIME_ACTION>
    local player = TriggerObjectLKI():GetPlayer()
    if player ~= nil then
       local damage = Damage():GetAmount()
       if damage ~= nil then
          EffectSourceLKI():DealDamageTo( damage, player  )
       end
    end
    </RESOLUTION_TIME_ACTION>
-----------------------------------------------------------------------
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: Report cards error here

Postby GrovyleXShinyCelebi » 09 Oct 2013, 02:31

Ah... I'm still not used to last-known-objects and how some of the triggers work. Thanks for correcting me, mate ;)
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 09 Oct 2013, 08:23

There's still something partially wrong in the trigger for the second ability. A spell is any card on the stack: when Artisan of Kozilek reanimates a creature, for example, it's still a spell, despite having the creature type. If there were a creature card that says "When you cast <this>, it deals X damage to target creature", your Tephraderm wouldn't activate. You should try this trigger:
Code: Select all
  <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" damage_type="noncombat">
    return SecondaryObject() == EffectSource() and TriggerObject():GetZone() == ZONE_STACK
  </TRIGGER>
< 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: Report cards error here

Postby GrovyleXShinyCelebi » 09 Oct 2013, 21:56

thefiremind wrote:There's still something partially wrong in the trigger for the second ability. A spell is any card on the stack: when Artisan of Kozilek reanimates a creature, for example, it's still a spell, despite having the creature type. If there were a creature card that says "When you cast <this>, it deals X damage to target creature", your Tephraderm wouldn't activate. You should try this trigger:
Code: Select all
  <TRIGGER value="SOURCE_DEALS_DAMAGE_TO_OBJECT" damage_type="noncombat">
    return SecondaryObject() == EffectSource() and TriggerObject():GetZone() == ZONE_STACK
  </TRIGGER>
I actually originally wrote the trigger exactly like yours, but then after it not activating, I thought that there was something wrong with "TriggerObject():GetZone() == ZONE_STACK", then I saw that Hostility which is an official card that used "TriggerObject():GetCardType():IsPermanent() == false", and so I just copied and pasted it in hopes that the card would work.

Though I still don't get why TriggerObject() is needed in the trigger and TriggerObjectLKI() in the RESOLUTION_TIME_ACTION script.
User avatar
GrovyleXShinyCelebi
 
Posts: 294
Joined: 12 Jun 2013, 18:23
Has thanked: 14 times
Been thanked: 37 times

Re: Report cards error here

Postby thefiremind » 09 Oct 2013, 23:01

GrovyleXShinyCelebi wrote:I actually originally wrote the trigger exactly like yours, but then after it not activating, I thought that there was something wrong with "TriggerObject():GetZone() == ZONE_STACK"
OK, I guess the engine is the one to blame then.

GrovyleXShinyCelebi wrote:Though I still don't get why TriggerObject() is needed in the trigger and TriggerObjectLKI() in the RESOLUTION_TIME_ACTION script.
When the trigger condition is checked, TriggerObject is in the same zone where it was when the pointer had been created: nothing can happen between the trigger and the condition check of the ability that catches the trigger. If the condition is true, the triggered ability goes to the stack. But before the ability resolves, anything can happen: players can respond to the ability, and the card pointed by TriggerObject might even exist no longer (if it was a token that left the battlefield), however you are interested in its conditions when the triggered ability went to the stack, because that's when Tephraderm was dealt damage by it. In other words, you are interested in the "Last Known Information" about the card. If you still use TriggerObject after the card changed zone, the pointer will be nil. If you use TriggerObjectLKI, you'll be pointed to a virtual copy of the card that retains the old conditions.
< 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

PreviousNext

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 16 guests


Who is online

In total there are 16 users online :: 0 registered, 0 hidden and 16 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 16 guests

Login Form