It is currently 14 Aug 2018, 13:49
   
Text Size

Ulamog, the Ceaseless Hunger

Moderators: Xander9009, CCGHQ Admins

Ulamog, the Ceaseless Hunger

Postby Chakan » 31 Aug 2015, 01:42

Been trying to come up with a working code for this thing all day, but everything I've tried so far ended in failure. Could someone let me know if this code is at least half way right? There's really no other cards, that I could think of anyway, that have an ability such as this. I've already done 11 of the cards that have been spoiled for Battle for Zendikar, hope to have the rest of the spoiled cards done by Friday.

Code: Select all
   <TRIGGERED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <TRIGGER value="ATTACKING" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
   if TriggerPlayer()  ~= nil then
        local secondaryPlayer = SecondaryPlayer()
        local effectController = EffectController()
        for i = 0,(20-1) do
              local card = secondaryPlayer:Library_GetNth( i )
            if card ~= nil then
              card:Exile()
            end
        end
     end
    </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
User avatar
Chakan
 
Posts: 163
Joined: 07 Jun 2014, 23:08
Has thanked: 11 times
Been thanked: 8 times

Re: Ulamog, the Ceaseless Hunger

Postby Xander9009 » 31 Aug 2015, 01:48

Try this:
Code: Select all
   <TRIGGERED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <TRIGGER value="ATTACKING" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
         local oDefending = RSN_GetDefendingPlayer(EffectSourceLKI())
         if oDefending  ~= nil then
            for i=0,19 do
               local card = oDefending:Library_GetTop()
               if card ~= nil then
                  card:Exile()
               end
            end
         end
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
Note that this requires RiiakShiNal's DefendingPlayer functions. They're in the CW, so if you have that installed, you don't need to do anything.

Riiak, are you aware your site is messed up? Or is it just me? I moved to Windows 10, so it's possible that's why (but I seriously doubt it).
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2818
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 101 times
Been thanked: 420 times

Re: Ulamog, the Ceaseless Hunger

Postby Chakan » 31 Aug 2015, 02:10

Where'd you get those functions, Xander? I didn't even know such a code existed. Also, if you're talking about the Wiki, yeah, it's messed up I think, the pages exist, but they're blank, right? (Also, that code didn't work.)
User avatar
Chakan
 
Posts: 163
Joined: 07 Jun 2014, 23:08
Has thanked: 11 times
Been thanked: 8 times

Re: Ulamog, the Ceaseless Hunger

Postby Xander9009 » 31 Aug 2015, 04:18

Chakan wrote:Where'd you get those functions, Xander? I didn't even know such a code existed. Also, if you're talking about the Wiki, yeah, it's messed up I think, the pages exist, but they're blank, right? (Also, that code didn't work.)
You can see the function used in Dimir Cutpurse's code. As for how I know it exists, it's just because I've been here awhile lol. If I recall correctly, the game doesn't have a proper ability to determine the defending player when you're in a 2HG game, and this function is supposed to fix that.

Either way, since it didn't work, try this.
Code: Select all
   <TRIGGERED_ABILITY>
      <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Whenever Ulamog attacks, defending player exiles the top twenty cards of his or her library.]]></LOCALISED_TEXT>
      <TRIGGER value="ATTACKING" simple_qualifier="self" />
      <RESOLUTION_TIME_ACTION>
         MTG():MessageAllPlayers("RTA is firing.")
         local oDefending = TriggerPlayer()
         if oDefending  ~= nil then
            MTG():MessageAllPlayers("Defending Player is valid. His or her life total is currently "..oDefending:GetLifeTotal())
            for i=0,2 do
               MTG():MessageAllPlayers("i: "..i)
               local card = oDefending:Library_GetTop()
               if card ~= nil then
                  MTG():MessageAllPlayers("i: "..i.." is valid.")
                  card:Exile()
               end
            end
         end
         MTG():MessageAllPlayers("RTA is finished.")
      </RESOLUTION_TIME_ACTION>
   </TRIGGERED_ABILITY>
It should show a number of messages. If it fails, you'll know which step failed. If not, increase the 2 to 19 and remove the messages.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2818
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 101 times
Been thanked: 420 times

Re: Ulamog, the Ceaseless Hunger

Postby thefiremind » 31 Aug 2015, 07:49

Is TriggerPlayer() set to the attacked player in an ATTACKING trigger? Maybe it does and I didn't know, but it's the first time I see it. I would have used EffectSourceLKI():GetPlayerAttacked(), or maybe even better, save that information inside the TRIGGER condition and use the saved one inside the action so you're sure that nothing strange happens:
Code: Select all
    <TRIGGER value="ATTACKING" simple_qualifier="self">
    EffectDC():Set_PlayerPtr( 1, EffectSource():GetPlayerAttacked() )
    return true
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    ...
    local oDefending = EffectDC():Get_PlayerPtr(1)
    ...
< Former DotP 2012/2013/2014 modder >
Currently busy with life. Don't expect answers to PMs.
User avatar
thefiremind
Programmer
 
Posts: 3513
Joined: 07 Nov 2011, 10:55
Has thanked: 117 times
Been thanked: 715 times

Re: Ulamog, the Ceaseless Hunger

Postby RiiakShiNal » 31 Aug 2015, 11:01

Xander9009 wrote:Riiak, are you aware your site is messed up? Or is it just me? I moved to Windows 10, so it's possible that's why (but I seriously doubt it).
Actually, I was not aware that the Wiki was messed up. I have, however, confirmed that it is screwed up, though I don't yet know how long it will take to fix it or why it got screwed up in the first place.
Problems with base game cards: DotP 2014 Core Fixes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
RiiakShiNal
Programmer
 
Posts: 2098
Joined: 16 May 2011, 21:37
Has thanked: 73 times
Been thanked: 462 times

Re: Ulamog, the Ceaseless Hunger

Postby Chakan » 31 Aug 2015, 15:29

Ah ha, thanks for the code Xander. It works perfectly now. I'll make sure to study this code if another such ability comes up. A big thanks to everyone who posted, I really appreciate it.
User avatar
Chakan
 
Posts: 163
Joined: 07 Jun 2014, 23:08
Has thanked: 11 times
Been thanked: 8 times

Re: Ulamog, the Ceaseless Hunger

Postby Xander9009 » 31 Aug 2015, 16:42

thefiremind wrote:Is TriggerPlayer() set to the attacked player in an ATTACKING trigger? Maybe it does and I didn't know, but it's the first time I see it. I would have used EffectSourceLKI():GetPlayerAttacked(), or maybe even better, save that information inside the TRIGGER condition and use the saved one inside the action so you're sure that nothing strange happens:
Code: Select all
    <TRIGGER value="ATTACKING" simple_qualifier="self">
    EffectDC():Set_PlayerPtr( 1, EffectSource():GetPlayerAttacked() )
    return true
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    ...
    local oDefending = EffectDC():Get_PlayerPtr(1)
    ...
I wasn't sure. I was just going by the code that I found in another card. I don't recall what it was, but apparently whoever made it knew it would work (or got lucky haha).
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2818
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 101 times
Been thanked: 420 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 2 guests

Login Form