Xander9009 wrote:The problem is that once you've sacrificed it, it no longer has a parent because it's no longer attached to anything. You'll need to store that information somehow. Try something like this:
- Code: Select all
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Sacrifica il Carapace: Rigenera la creatura incantata.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Sacrifice Carapace: Regenerate enchanted creature.]]></LOCALISED_TEXT>
<COST type="Generic">
<PREREQUISITE>
return EffectSource() ~= nil and EffectSource():GetParent() ~= nil
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil and EffectSource():GetParent() ~= nil
EffectDC():Set_CardPtr(0, EffectSource():GetParent())
EffectController():Sacrifice(EffectSource())
end
</RESOLUTION_TIME_ACTION>
</COST>
<RESOLUTION_TIME_ACTION>
local Parent = EffectSource():Get_CardPtr(0)
if Parent ~= nil then
Parent:GiveRegeneration()
end
</RESOLUTION_TIME_ACTION>
<AI_AVAILABILITY window_step="declare_blockers" type="window" window_in_combat="1" />
<AI_AVAILABILITY type="in_response" response_source="1" />
<AI_AVAILABILITY type="restriction" restriction_type="no_regeneration_shield" />
<AI_MODIFIERS combat_immunity="1" />
</ACTIVATED_ABILITY>
I understand what generic does, I think, but in this case the generic code is preventing the sacrifice of the card and probably is why it's still not working. As I'm guessing the card has to be actually sacrificed before it'll grant the regenerate ability. I tried to add an additonal cost of SacrificeSelf before that, that sacrificed it but didn't give the card it was attached to regenerate. (I doubted it would, but was worth a try). Just to be clear what I meant by that is the following:
- | Open
- Code: Select all
<COST type="SacrificeSelf" />
<COST type="Generic">
<PREREQUISITE>
return EffectSource() ~= nil and EffectSource():GetParent() ~= nil
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil and EffectSource():GetParent() ~= nil
EffectDC():Set_CardPtr(0, EffectSource():GetParent())
EffectController():Sacrifice(EffectSource())
end
</RESOLUTION_TIME_ACTION>
</COST>
I've seen LinkedDC used before, perhaps that would work, though I'm not sure how and it seems it doesn't tend to work in cost fields either.
It's still outputing the same script error upon exit, so I'm guessing it's still related somehow (at least it does when I use the selfsacrifice code).
As an aside, I use different game folders for testing vs general playing. Usually, I test with an almost unmodded version with the exception of Data_DLC_8192_Characteristics.wad, Data_DLC_8192_ObjectDC.wad, the card to be tested, a test deck wad (I only use Manual Mana if it seems needed). Is that the right kind of setup for testing in general? I realise different cards are going to need different files depending on their requirments, I'm mostly trying to get a standard default setup.