Page 1 of 1

[DotP2013] Lord of the Void

PostPosted: 27 Mar 2013, 17:54
by BETenner
I'm trying to code Lord of the Void, but always get this error:
Code: Select all
[lua] attempt to index a number value
Please help me find the reason..

Code: Select all
  <TRIGGERED_ABILITY active_zone="ZONE_IN_PLAY">
    <TRIGGER value="CREATURE_DEALS_COMBAT_DAMAGE_TO_PLAYER" simple_qualifier="self">
      return TriggerPlayer() ~= nil
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
      local player = TriggerPlayer()
      local browser = EffectDC():Make_Chest(1)
      local j = 0
      if (player ~= nil) then
        if (browser ~= nil) then
          for i=0,6 do
            local card = player:Library_GetNth(0)
            if (card ~= nil) then
              card:RemoveFromGame()
              if (card:GetCardType():Test(CARD_TYPE_CREATURE) ~= 0) then
                browser:Set_CardPtr(j, card)
                j = j + 1
              end
            end
          end
        end
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local browser = EffectDC():Get_Chest(1)
      local player = EffectController()
      if (player ~= nil) then
        if (browser ~= nil) then
          player:SetTargetCount(1)
          player:SetTargetPrompt(0, "CARD_QUERY_CHOOSE_CREATURE_TO_PUT_ONTO_BATTLEFIELD")
          player:ChooseTargetsFromDC(NO_VALIDATION, browser, EffectDC().Make_Targets(2))
        end
      end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
      local target = EffectDC():Get_Targets(2) and EffectDC():Get_Targets(2):Get_CardPtr(0)
      if (target ~= nil) then
        target:PutIntoPlay(EffectController())
      end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>

Re: [DotP2013] Lord of the Void

PostPosted: 27 Mar 2013, 18:57
by thefiremind
In the ChooseTargetsFromDC arguments you wrote
Code: Select all
EffectDC().Make_Targets(2)
instead of
Code: Select all
EffectDC():Make_Targets(2)
.

Re: [DotP2013] Lord of the Void

PostPosted: 28 Mar 2013, 02:56
by BETenner
Ahhh...I'm still can't get used to lua yet...