Page 1 of 1

Creature comes into play -> untap up to X lands problem

PostPosted: 13 Dec 2010, 09:38
by IceManOnline
Since this is my first post,

I'd like to say hi and thank you for this place to get new cards and the knowledge to create them yourself.

I tried it yesterday and got my first problem (but expected it ^^).

I tried to create the card "peregrine drake" (flying and untap of 5 lands).
The creation itself is no problem, nor is the flying.
But I got a problem with the untap-part...

I tried to use "buried alive" as a template and just alter it for the drake but it didn't work.
I also read the trigger for the "orcish settlers" but I don't get, what the Object():Register_Set( 3, 0 ) is for...
I'm no programming newbie but it's been some years till my last lines of code.

I attached the code for the drake, maybe you find my error (or can push me to the right direction).
Code: Select all
<TRIGGERED_ABILITY tag="PEREGRINE_DRAKE_RULE_2" layer="0" internal="1" pre_trigger="1" >    
     <TRIGGER value="COMES_INTO_PLAY">
          return SelfTriggered()
      </TRIGGER>
   <TARGET_DETERMINATION>
        Object():GetFilter():Clear()
        Object():GetFilter():SetPlayer( Object():GetPlayer() )
        Object():GetFilter():SetZone( ZONE_IN_PLAY )
        Object():GetFilter():AddCardType( CARD_TYPE_LAND )
        Object():GetPlayer():SetTargetCount( 5 )
        local LNG_INDEX = 1
        while LNG_INDEX &lt; 6 do
        Object():GetPlayer():ChooseTargetLand()
        LNG_INDEX = LNG_INDEX + 1
        end
        Object():GetPlayer():ChooseTargets()
      </TARGET_DETERMINATION>
     <EFFECT>
      if Object():GetNthTargetCard( 0 ) ~= nil then
          Object():GetNthTargetCard( 0 ):Untap()
        end
       
        if Object():GetNthTargetCard( 1 ) ~= nil then
          Object():GetNthTargetCard( 1 ):Untap()
        end

        if Object():GetNthTargetCard( 2 ) ~= nil then
          Object():GetNthTargetCard( 2 ):Untap()
        end
      
      if Object():GetNthTargetCard( 3 ) ~= nil then
          Object():GetNthTargetCard( 3 ):Untap()
        end
      
      if Object():GetNthTargetCard( 4 ) ~= nil then
          Object():GetNthTargetCard( 4 ):Untap()
        end
     </EFFECT>    
   </TRIGGERED_ABILITY>
Maybe any of you could push me to the right direction and/or explain what "Object():Register_Set( 3, 0 )" does, so I don't have to start my newly stared coding experience with a failure.

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 13 Dec 2010, 11:51
by kevlahnota
hi :D
example:

Object() -> the "card itself"
Register -> it's like a "container"
Register_Object_Get(3) -> get the "object" inside "register object #3"
Register_Set(3,0) -> Set the value of "register #3" to 0
Register_Object_Set(1, Object():GetTargetCard()) -> Register the "Target Object" value of "register object #1"

Peregrine Drake code:
Code: Select all
<TRIGGERED_ABILITY tag="PEREGRINE_DRAKE_RULE_2" layer="0">   
     <TRIGGER value="COMES_INTO_PLAY">
          return SelfTriggered()
      </TRIGGER>
   <TARGET_DETERMINATION>
        Object():GetFilter():Clear()
        Object():GetFilter():SetPlayer( Object():GetPlayer() )
        Object():GetFilter():SetZone( ZONE_IN_PLAY )
        Object():GetFilter():AddCardType( CARD_TYPE_LAND )
        Object():GetPlayer():SetTargetCount( 5 )
        return TargetGoodF()
      </TARGET_DETERMINATION>
     <PRE_EFFECT>
        for i=0,4 do
         Object():GetPlayer():SetTargetPrompt( i, "ChooseLand" )
        end
        Object():GetPlayer():ChooseTargets()
     </PRE_EFFECT>
     <EFFECT>
      for i=0,4 do
         if Object():GetNthTargetCard( i ) ~= nil then
             Object():GetNthTargetCard( i ):Untap()
         end
      end
     </EFFECT>   
   </TRIGGERED_ABILITY>

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 13 Dec 2010, 12:23
by IceManOnline
Okay, a "container".

Does the program save this container data? For example if I want to code "living death", I would put all graveyard cards into and pull them out later?

And another question to this: The number I define for it, is it relevant if it's 3 or for example 99?

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 13 Dec 2010, 15:44
by kevlahnota
the current engine support up to eight slots only (0-7), if you want to manage more than eight, you can reverse register the object. look at the example of necropotence made by yanna. he register the main card (necropotence) to all affected cards (removed cards but with registered object -> necropotence). Yes, it will save the object "contained" until end of the game unless you clear it. example: Object():Register_Object_Clear(1) -> back to default value which is 0 or nil.

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 13 Dec 2010, 17:39
by IceManOnline
Okay.
Untapping works now, but I can't tap basiclands for mana again in the same turn...
I tried with Island and Underground Sea but I could only use Underground Sea after summoning the drake.

Do you have an idea why?

--Edit---
Found another bug... I just want to target tapped lands, but as of now, I have to target a land, even if it isn't tapped.
And I can't use these untapped lands afterwards...
So every land, I have to target (tapped and untapped) is useless for the rest of the turn...

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 17 Dec 2010, 07:10
by IceManOnline
Seems like I can't use the basiclands for untapping.
I can untap them, but afterwards they're out of play for that round (even if they were untapped).

If I use custom made basiclands like ISLAND_PB etc it works just fine.

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 17 Dec 2010, 07:57
by kevlahnota
you can untap any land, but the game doesn't support manual tapping of lands for the basic land types unless you modify them like the lands in prosbloom deck that have activated ability(mana tokens).

Re: Creature comes into play -> untap up to X lands problem

PostPosted: 17 Dec 2010, 08:11
by IceManOnline
Because of that I'll use custom lands for my Living Death Deck. Of I can Het the card to work...