It is currently 26 Apr 2024, 22:31
   
Text Size

Choosing a target. -_-

Moderator: CCGHQ Admins

Choosing a target. -_-

Postby Jspapp » 01 Sep 2012, 15:20

I don't know if I've been staring at this for too long or what, but I just can't get this to work at all. I'm trying to code Nyxathid, and as it comes into the battlefield you choose an opponent.

Code: Select all
<TRIGGERED_ABILITY>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <RESOLUTION_TIME_ACTION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetFilterType( FILTER_TYPE_OPPONENTS )
    EffectController():ChooseTarget( NO_VALIDATION, "CARD_QUERY_CHOOSE_OPPONENT", EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
However, the ability will trigger but I don't get a targetting prompt. I know there's a really simple mistake in here somewhere but I can't get it figured out.
Jspapp
 
Posts: 8
Joined: 03 Jul 2012, 00:17
Has thanked: 2 times
Been thanked: 0 time

Re: Choosing a target. -_-

Postby BlindWillow » 01 Sep 2012, 17:35

The filter for opponents is actually set like this:

Code: Select all
local filter = Object():GetFilter()
filter:Clear()
filter:SetFilterType( FILTER_TYPE_PLAYERS + FILTER_TYPE_OPPONENTS)
filter:SetOwner( EffectController() )
filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Choosing a target. -_-

Postby BlindWillow » 01 Sep 2012, 17:39

I see Kevlahnota has already coded Nyxathid for the Community DLC mod.

Here's the code from that:

Code: Select all
 <TRIGGERED_ABILITY pre_trigger="1" replacement_query="1" active_zone="ZONE_TRANSITION">
     <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[As Nyxathid enters the battlefield, choose an opponent.]]></LOCALISED_TEXT>
   <TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
   <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetFilterType( FILTER_TYPE_PLAYERS + FILTER_TYPE_OPPONENTS)
    filter:SetOwner( EffectController() )
    filter:SetHint( HINT_ENEMY_ONLY, EffectController() )
   filter:NotTargetted()
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_OPPONENT", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
   <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)   
    local delayDC = EffectDC():Make_Chest(1)
    delayDC:Set_PlayerPtr(0, player)
           
    MTG():CreateDelayedTrigger(1, delayDC)
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    EffectDC():Protect_CardPtr( COMPARTMENT_ID_EFFECT_SOURCE )
    </RESOLUTION_TIME_ACTION>
    <CONTINUOUS_ACTION layer="0">
    local player = ObjectDC():Get_PlayerPtr(0)
    if player ~= nil then
       player:AddBadge(PLAYER_BADGE_ICON_CHOSEN_PLAYER, "PLAYER_CHOSEN_ICON")
    end
    </CONTINUOUS_ACTION>
    <DURATION>
    return (EffectSource() == nil)
    </DURATION>
  </TRIGGERED_ABILITY>
  <STATIC_ABILITY>
     <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
     <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Nyxathid gets -1/-1 for each card in the chosen player’s hand.]]></LOCALISED_TEXT>
   <CONTINUOUS_ACTION layer="7C">
    local chosen_opponent = ObjectDC():Get_PlayerPtr(0)
   if chosen_opponent ~= nil then
      local total = CountCardsInHand( chosen_opponent )
      local characteristics = Object():GetCurrentCharacteristics() 
      characteristics:Power_Add( -total )
      characteristics:Toughness_Add( -total )
   end
    </CONTINUOUS_ACTION>
  </STATIC_ABILITY>
  <TRIGGERED_ABILITY internal="1" resource_id="1" active_zone="ZONE_IN_PLAY">
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <CLEANUP fire_once="1" />
    <RESOLUTION_TIME_ACTION>
    ObjectDC():Set_PlayerPtr(0, EffectDC():Get_PlayerPtr(0))
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Choosing a target. -_-

Postby Jspapp » 01 Sep 2012, 19:51

Ah, thanks a ton!
Jspapp
 
Posts: 8
Joined: 03 Jul 2012, 00:17
Has thanked: 2 times
Been thanked: 0 time


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 35 guests


Who is online

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

Login Form