Crispoz
  • Crispoz
  • Advanced Member Topic Starter
2014-06-14T23:48:04Z
I tried to script this card:

Quote:

2 "Umbral Horror" Monsters
When this card is Xyz Summoned: Add 1 card from your deck to your hand. Once per turn, during either player's turn, you can detach 1 Xyz Material from this card to look at your opponent's hand, select 1 monster and add it to your hand.



The first effect works, I can summon him and add 1 card from my deck to the hand.

The problem comes when I try to activate the quick effect: at the start of the duel the Chat Log says "[Script error:] [string "./script/119.lua"]:25: Parameter 2 should be "Function"."

This isn't the first time I encounter this kind of error and it always comes when I try to script monsters, so it must be something that I don't know.. If someone could fix the script it would be awesome [:laugh:]

Here's the script:

Quote:

--Umbral Horror Phantom Disaster
function c119.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.XyzFilterFunctionF(c,aux.FilterBoolFunction(Card.IsSetCard,0x87),4),2)
c:EnableReviveLimit()
--summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(119,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c119.con)
e1:SetTarget(c119.target)
e1:SetOperation(c119.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(119,0))
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,0x1e0)
e2:SetCost(c119.thcost)
e2:SetTarget(c119.thtg)
e2:SetOperation(c119.thop)
c:RegisterEffect(e2)
end
function c119.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ
end
function c119.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(c119.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c119.filter(c)
return c:IsAbleToHand()
end
function c119.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c119.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
function c119.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c119.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if g:GetCount()>0 then
Duel.ConfirmCards(tp,g)
local tg=g:Filter(Card.IsType,nil,TYPE_MONSTER)
if tg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=tg:Select(tp,1,1,nil)
Duel.SendtoHand(sg,tp,REASON_EFFECT)
end
Duel.ShuffleHand(1-tp)
end
end
end



Thanks in advance [:laugh:]

UserPostedImage
UserPostedImage
UnknownGuest
2014-06-15T02:08:13Z
here it is [:laugh:] :



What is Changed?

- You have 2 operation functions. Renamed the other 1 to thop.
- Added thtg (the Target).
2M+ ATK:
UserPostedImage
Crispoz
  • Crispoz
  • Advanced Member Topic Starter
2014-06-15T12:58:30Z
Your script doesn't work..

The Chat log says:

"[Script error:] [string "./script/119.lua"]:72: "end" expected (to close 'function' at line 41) near <eof>"

To solve this error I put another "end" at the end of the script, and now the chat log says this:

"[Script error:] [string "./script/119.lua"]:25: Parameter 2 should be "Function"."

In other words, nothing has changed [:sad:]

Can you fix this please? Thanks in advance!
UserPostedImage
UserPostedImage
YuGiOhMoDDeR
2014-06-15T13:23:44Z
try this:
--Umbral Horror Phantom Disaster
function c119.initial_effect(c)
    --xyz summon
    aux.AddXyzProcedure(c,aux.XyzFilterFunctionF(c,aux.FilterBoolFunction(Card.IsSetCard,0x87),4),2)
    c:EnableReviveLimit()
    --summon
    local e1=Effect.CreateEffect(c)
    e1:SetDescription(aux.Stringid(119,0))
    e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
    e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
    e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
    e1:SetCode(EVENT_SPSUMMON_SUCCESS)
    e1:SetCondition(c119.sumcon)
    e1:SetTarget(c119.sumtg)
    e1:SetOperation(c119.sumop)
    c:RegisterEffect(e1)
    local e2=Effect.CreateEffect(c)
    e2:SetDescription(aux.Stringid(119,1))
    e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
    e2:SetType(EFFECT_TYPE_QUICK_O)
    e2:SetRange(LOCATION_MZONE)
    e2:SetCountLimit(1)
    e2:SetCode(EVENT_FREE_CHAIN)
    e2:SetHintTiming(0,0x1e0)
    e2:SetCost(c119.thcost)
    e2:SetTarget(c119.thtg)
    e2:SetOperation(c119.thop)
    c:RegisterEffect(e2)
end
function c119.sumcon(e,tp,eg,ep,ev,re,r,rp)
    return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ
end
function c119.sumtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
    if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,LOCATION_DECK,0,1,nil) end
    Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c119.sumop(e,tp,eg,ep,ev,re,r,rp)
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
    local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_DECK,0,1,1,nil)
    if g:GetCount()>0 then
		Duel.SendtoHand(g,nil,REASON_EFFECT)
		Duel.ConfirmCards(1-tp,g)
	end
end
function c119.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
    e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c119.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return true end
    Duel.SetTargetPlayer(tp)
end
function c119.thop(e,tp,eg,ep,ev,re,r,rp)
    local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
	if g:GetCount()>0 then
		Duel.ConfirmCards(tp,g)
		local tg=g:Filter(Card.IsType,nil,TYPE_MONSTER)
		if tg:GetCount()>0 then
			Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
			local sg=tg:Select(tp,1,1,nil)
			Duel.SendtoHand(sg,tp,REASON_EFFECT)
		end
		Duel.ShuffleHand(1-tp)
	end
end
Crispoz
  • Crispoz
  • Advanced Member Topic Starter
2014-06-16T13:12:18Z
It works, thanks for your help! [:laugh:]
UserPostedImage
UserPostedImage