salvadorc17
2014-08-28T02:04:08Z
This days i have been tried to add ai command to duel puzzles, this is what i have achieved:

Quote:

local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_PHASE+PHASE_DRAW)
e1:SetCountLimit(1)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.Draw(tp,1,REASON_RULE) end)
Duel.RegisterEffect(e1,0)
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_PHASE+PHASE_DRAW)
e2:SetCountLimit(1)
e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.SetLP(0,Duel.GetLP(0)+1000) end)
Duel.RegisterEffect(e2,0)
local e3=Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EVENT_PHASE+PHASE_DRAW)
e3:SetCountLimit(1)
e3:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.SetLP(1,Duel.GetLP(1)-1000) end)
Duel.RegisterEffect(e3,1)



Also i have removed the end duel at turn.
The problem is that when draw command is executed i have always draw the card and not the ai, any idea how to fix it, or something to improve...
Snarky
2014-08-31T17:11:16Z
Quote:

Duel.Draw(tp,1,REASON_RULE) end)



The "tp" is an abbreviation for "turn player", try changing that to 0 or 1