Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Renamed :Are you looking for a Godsend? Suggested by gorem2k
Moderator: CCGHQ Admins
Re: Trigger issue - Need Help
by gorem2k » 24 Aug 2014, 13:25
Indeed, a veteran programmer could be helpful here. It's funny because when I code (or stitch) something blatantly wrong it normally takes little time before I get slapped in the face
At least, I've learned something new that it's possible to use Set_Int/Get_Int using LinkedDC():Get_Chest(x):Set_Int(x).
I thought it was only possible like this:
LinkedDC():Set_Int(x)
but I looked for other cards and found another example that use it. Either way, it both works, the game recognize a linked register (with or without putting a specific chest beforehand)
I like that in your version, when I and AI both block using an enchanted creature with Godsend, we both can exile a card. In my version, one has a priority over the other which I really think is wrong now.
At least, I've learned something new that it's possible to use Set_Int/Get_Int using LinkedDC():Get_Chest(x):Set_Int(x).
I thought it was only possible like this:
LinkedDC():Set_Int(x)
but I looked for other cards and found another example that use it. Either way, it both works, the game recognize a linked register (with or without putting a specific chest beforehand)
I like that in your version, when I and AI both block using an enchanted creature with Godsend, we both can exile a card. In my version, one has a priority over the other which I really think is wrong now.
Re: Trigger issue - Need Help
by RiiakShiNal » 24 Aug 2014, 22:01
The problem isn't with the code you put in this post. The problem is that previously you are overwriting your registers. Here you are getting a count from LinkedDC() register 1 and the exiled card chest from register 2, but when a creature blocks or is blocked you put those creatures into a chest which you create in LinkedDC() register 1 (overwriting any count), but you are putting the exiled creatures into LinkedDC() register 100. So I am actually surprised it works at all.gorem2k wrote:I guess we're on our own to figure this out. The problem I have is, with this code, only the last card exiled with Godsend can't be cast. I don't know why it doesn't work for previous exiled cards. I will test the count since it's probably the only thing I haven't tried
- exiled cards can't be played, almost working | Open
- Code: Select all
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
<TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
local exiledcards = LinkedDC():Get_Chest(2)
if exiledcards ~= nil then
local count = LinkedDC():Get_Int(1)
for i = 0, (count) do
local exiledcard = exiledcards:Get_CardPtr(i)
if exiledcard ~= nil and
TriggerObject():GetCardName() == exiledcard:GetCardName() and
TriggerObject():GetOwner():GetTeam() ~= EffectController():GetTeam() then
MTG():OverrideEvent()
return true
end
end
end
</TRIGGER>
</TRIGGERED_ABILITY>
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Trigger issue - Need Help
by gorem2k » 25 Aug 2014, 03:08
Yes, I know now. However, I've never used register 100, Neo did.RiiakShiNal wrote:The problem isn't with the code you put in this post. The problem is that previously you are overwriting your registers. Here you are getting a count from LinkedDC() register 1 and the exiled card chest from register 2, but when a creature blocks or is blocked you put those creatures into a chest which you create in LinkedDC() register 1 (overwriting any count), but you are putting the exiled creatures into LinkedDC() register 100. So I am actually surprised it works at all.
As for the triggers, mine were wrong so I took his example and changed some minor things here and there (use a different chest and indexing). Now it's exactly how I want it. Problem solved
Re: Trigger issue - Need Help
by RiiakShiNal » 25 Aug 2014, 11:47
Too many versions floating around to try and keep track of who used what at this point.
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Trigger issue - Need Help
by NeoAnderson » 25 Aug 2014, 12:22
Ahahahhahaah You're right my friend.RiiakShiNal wrote::oops: Too many versions floating around to try and keep track of who used what at this point.
Here you can find my last one i have tested and it seems to works fine!
- GodSend Neo Rev 1.1 | Open
- Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="JOU_012_NEO_GODSEND_995380426" />
<CARDNAME text="GODSEND" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Godsend]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Don du ciel]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Filo divino]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gottesheil]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Nemesi degli Dei]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[神送り]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[신의 선물]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Божий Дар]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mensageira dos Deuses]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="995380426" />
<ARTID value="995380426" />
<ARTIST name="Daniel Ljunggren" />
<CASTING_COST cost="{1}{W}{W}" />
<SUPERTYPE metaname="Legendary" />
<TYPE metaname="Artifact" />
<SUB_TYPE metaname="Equipment" />
<EXPANSION value="JOU" />
<RARITY metaname="M" />
<STATIC_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equipped creature gets +3/+3.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[La créature équipée gagne +3/+3.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[La criatura equipada obtiene +3/+3.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Die ausgerüstete Kreatur erhält +3/+3.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[La creatura equipaggiata prende +3/+3.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーは+3/+3の修整を受ける。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착된 생물은 +3/+3을 받는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снаряженное существо получает +3/+3.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[A criatura equipada recebe +3/+3.]]></LOCALISED_TEXT>
<CONTINUOUS_ACTION layer="7C">
if EffectSource()~= nil then
local parent = EffectSource():GetParent()
if parent ~= nil then
parent:GetCurrentCharacteristics():Power_Add( 3 )
parent:GetCurrentCharacteristics():Toughness_Add( 3 )
end
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
<TRIGGER value="BLOCKS_A_CREATURE" >
return TriggerObject() == EffectSourceLKI():GetParent() or SecondaryObject() == EffectSourceLKI():GetParent()
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local chest = LinkedDC():Get_Chest(1)
if chest == nil then
chest = LinkedDC():Make_Chest(1)
LinkedDC():Set_Int(0, 0)
end
if TriggerObject() == EffectSourceLKI():GetParent() then
chest:Set_CardPtr( LinkedDC():Get_Int(0), SecondaryObject() )
else
chest:Set_CardPtr( LinkedDC():Get_Int(0), TriggerObject() )
end
LinkedDC():Int_Inc(0)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever equipped creature blocks or becomes blocked by one or more creatures, you may exile one of those creatures.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois que la créature équipée bloque ou devient bloquée par au moins une créature, vous pouvez exiler une de ces créatures.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que la criatura equipada bloquee o sea bloqueada por una o más criaturas, puedes exiliar una de esas criaturas.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn die ausgerüstete Kreatur eine oder mehrere Kreaturen blockt oder von einer oder mehreren Kreaturen geblockt wird, kannst du eine dieser Kreaturen ins Exil schicken.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta la creatura equipaggiata blocca o viene bloccata da una o più creature, puoi esiliare una di quelle creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備しているクリーチャーが、1体以上のクリーチャーをブロックするか1体以上のクリーチャーにブロックされた状態になるたび、あなたはそれらのクリーチャーのうち1体を追放してもよい。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착한 생물이 방어하거나 하나 이상의 생물에게 방어 당할 때마다, 당신은 그 생물 중 하나를 추방할 수 있다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Каждый раз, когда снаряженное существо блокирует или становится заблокировано одним или несколькими существами, вы можете изгнать одно из тех существ.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Toda vez que a criatura equipada bloquear ou for bloqueada por uma ou mais criaturas, você poderá exilar uma daquelas criaturas.]]></LOCALISED_TEXT>
<TRIGGER value="WAS_BLOCKED_BY_A_CREATURE" to_zone="ZONE_ANY" from_zone="ZONE_ANY" >
return TriggerObject() == EffectSourceLKI():GetParent()
</TRIGGER>
<TRIGGER value="BLOCKING">
return TriggerObject() == EffectSourceLKI():GetParent()
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local chest = LinkedDC():Get_Chest(1)
EffectController():SetItemCount(1)
for i = 0, (1 - 1) do
EffectController():SetItemPrompt(i, "CARD_QUERY_CHOOSE_CARD_TO_EXILE" )
end
EffectController():ChooseItemsFromDC( chest, EffectDC():Make_Targets(0), QUERY_FLAG_MAY )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
EffectDC():Get_Targets(0):Protect_CardPtr(0)
target:Exile()
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
local source = EffectSource()
if target ~= nil and source ~= nil then
local chest = LinkedDC():Get_Chest(100)
if chest == nil then
chest = LinkedDC():Make_Chest(100)
end
local index = 1
while chest:Get_CardPtr(index) ~= nil do
index = index + 1
end
chest:Set_CardPtr(index, target)
chest:Protect_CardPtr(index)
chest:Set_Int(0, index)
target:NailOnto(source)
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1" priority="20">
<TRIGGER value="BEGINNING_OF_STEP">
return MTG():GetStep() == STEP_BEGIN_COMBAT or MTG():GetStep() == STEP_END_OF_COMBAT
</TRIGGER>
<RESOLUTION_TIME_ACTION>
local chest = LinkedDC():Get_Chest(1)
if chest ~= nil then
chest:Clear()
end
LinkedDC():Set_Int(0, 0)
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Opponents can’t cast cards with the same name as cards exiled with Godsend.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Les adversaires ne peuvent pas lancer de cartes ayant le même nom que les cartes exilées par le Don du ciel.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Los oponentes no pueden lanzar cartas con el mismo nombre que las cartas exiliadas con el Filo divino.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Gegner können keine Karten mit dem gleichen Namen wie Karten wirken, die mit Gottesheil ins Exil geschickt wurden.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gli avversari non possono lanciare carte con lo stesso nome delle carte esiliate dalla Nemesi degli Dei.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[対戦相手は、神送りによって追放されているカードと同じ名前を持つカードを唱えられない。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[상대들은 신의 선물로 추방한 카드들과 같은 이름을 가진 카드들을 발동할 수 없다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оппоненты не могут разыгрывать карты с такими же именами, как у карт, изгнанных Божьим Даром.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Os oponentes não podem conjurar cards com o mesmo nome de cards exilados por Mensageira dos Deuses.]]></LOCALISED_TEXT>
<TRIGGER value="CONSIDERED_FOR_CAST" pre_trigger="1">
local chest = LinkedDC():Get_Chest(100)
if chest ~= nil then
local count_so_far = chest:Get_Int(0)
if count_so_far > 0 and TriggerPlayer():GetTeam() ~= EffectController():GetTeam() and TriggerObject():GetCardType():Test( CARD_TYPE_LAND ) == false then
for i=1,count_so_far do
if chest:Get_CardPtr(i) ~= nil and TriggerObject():GetCardName() == chest:Get_CardPtr(i):GetCardName() then
MTG():OverrideEvent()
return true
end
end
end
end
return false
</TRIGGER>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY replacement_effect="1" linked_ability_group="1">
<TRIGGER value="ZONECHANGE_BEGIN" simple_qualifier="self" to_zone="ZONE_ANY" from_zone="ZONE_BATTLEFIELD" />
<RESOLUTION_TIME_ACTION>
LinkedDC():Clear()
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {3}.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備 {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {3}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {3}]]></LOCALISED_TEXT>
<COST mana_cost="{3}" type="Mana" />
<AVAILABILITY sorcery_time="1" />
<AI_AVAILABILITY type="restriction" restriction_type="equip" />
<TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, EffectController() )
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
if (target_card ~= nil and EffectSource() ~= nil) then
EffectSource():Attach( target_card )
end
</RESOLUTION_TIME_ACTION>
<AUTO_SKIP>
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
return false
else
return true
end
</AUTO_SKIP>
</ACTIVATED_ABILITY>
<HELP title="MORE_INFO_BADGE_TITLE_1" body="MORE_INFO_BADGE_BODY_1" zone="ZONE_ANY" />
<HELP title="MORE_INFO_BADGE_TITLE_4" body="MORE_INFO_BADGE_BODY_4" zone="ZONE_ANY" />
<AI_BASE_SCORE score="600" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Trigger issue - Need Help
by gorem2k » 25 Aug 2014, 15:17
I guess you could rename this thread with "Are you looking for a Godsend?" hehe
Re: Trigger issue - Need Help
by NeoAnderson » 25 Aug 2014, 16:14
Done!gorem2k wrote:I guess you could rename this thread with "Are you looking for a Godsend?" hehe
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
22 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 41 guests