Latest topics | » test request by Rainbow Sorcer Wed Aug 21, 2013 3:15 pm
» PDA is back by DarkLove Thu Jul 11, 2013 4:22 am
» Lords Of Darkness ~¤The Era Of Destruction begins¤~ by Unees Sun Jun 30, 2013 12:20 am
» Royal Knights archtype by gunsmaker [intro][WIP] by gunsmaker Sat Jun 29, 2013 11:57 pm
» test request ismenne 29/6/13 -- Results Up by Jakester390 Sat Jun 29, 2013 4:47 pm
» Just got here but still real life goes first by Rai-Jinn Sat Jun 29, 2013 1:03 pm
» Infernities Reborn: Lightsworn Vengeance by Unees Sat Jun 29, 2013 4:49 am
» MY FIRST YU-GI-OH DECK: “FEATHER GRID” by Guest Sat Jun 29, 2013 4:46 am
» Big Mess, Big decision by gunsmaker Sat Jun 29, 2013 3:18 am
» Daily Yugioh Related Quiz. by DoomTemplarKnight Fri Jun 28, 2013 10:41 pm
» Slifer Attendance. by Metagamereaper Fri Jun 28, 2013 9:36 pm
» Hello There by Icingsugar Fri Jun 28, 2013 5:40 pm
» PDA Main Shop [V2] by Guest Fri Jun 28, 2013 5:33 am
» No more time by Metagamereaper Fri Jun 28, 2013 2:24 am
» i bad mouthed (69) a member in this academy, please ban meh :'( by gunsmaker Thu Jun 27, 2013 10:28 pm
|
Statistics | We have 883 registered users The newest registered user is crash3011
Our users have posted a total of 8495 messages in 659 subjects
|
Who is online? | In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests None Most users ever online was 156 on Sat Apr 17, 2021 5:42 am |
| | Author | Message |
---|
gunsmakerWar Manager
Posts : 356
Rank : 20
| Subject: Need Help at LUA script Fri May 24, 2013 9:01 am | |
| Please help at LUA script - script b4 edit:
--Grand Chasers - Ronan the Spell Knight function c909009015.initial_effect(c) c:SetUniqueOnField(1,0,909009015) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c909009015.spcon) e1:SetOperation(c909009015.spop) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(909009015,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(c909009015.thcost) e2:SetTarget(c909009015.thtg) e2:SetOperation(c909009015.thop) c:RegisterEffect(e2) end function c909009015.spfilter(c) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() end function c909009015.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c909009015.spfilter,tp,LOCATION_GRAVE,0,1,nil) end function c909009015.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.spfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.costfilter(c) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() end function c909009015.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c90642597.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c90642597.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.rmfilter(c,tp) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(c909009015.filter,tp,LOCATION_GRAVE,0,1,nil) end function c909009015.thfilter(c) return c:IsSetCard(0x258) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c909009015.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c909009015.rmfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_DECK) and c909009015.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,c909009015.filter,tp,LOCATION_DECK,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c909009015.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
has no errors, but the eff become too OP, it can add any card from deck to hand, so i fix the filter and it has the error. - script after fix:
--Grand Chasers - Ronan the Spell Knight function c909009015.initial_effect(c) c:SetUniqueOnField(1,0,909009015) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c909009015.spcon) e1:SetOperation(c909009015.spop) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(909009015,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(c909009015.thcost) e2:SetTarget(c909009015.thtg) e2:SetOperation(c909009015.thop) c:RegisterEffect(e2) end function c909009015.spfilter(c) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() end function c909009015.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c909009015.spfilter,tp,LOCATION_GRAVE,0,1,nil) end function c909009015.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.spfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.costfilter(c) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() end function c909009015.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c90642597.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c90642597.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.rmfilter(c,tp) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(c909009015.filter,tp,LOCATION_GRAVE,0,1,nil) end function c909009015.thfilter(c) return c:IsSetCard(0x258) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c909009015.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c909009015.rmfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_DECK) and c909009015.thfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,c909009015.thfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c909009015.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
it has error msg like i got confused since i just change filter to thfilter and got error like that, if i change thfilter to filter, the eff cant activate. |
| | | Jakester390Mod/Teacher
Posts : 258
Age : 30
Rank : 0
| Subject: Re: Need Help at LUA script Fri May 24, 2013 10:28 am | |
| I believe I would be correct in assuming that you made the set code in the database 258? The lua scripts use HEX rather than base 10, so in the filter rather than being 0x258, it should be 0x102. Here is a fixed script, which I also did some cleaning up and compression on. - Spoiler:
--Grand Chasers - Ronan the Spell Knight function c909009015.initial_effect(c) c:SetUniqueOnField(1,0,909009015) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c909009015.spcon) e1:SetOperation(c909009015.spop) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(909009015,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(c909009015.thcost) e2:SetTarget(c909009015.thtg) e2:SetOperation(c909009015.thop) c:RegisterEffect(e2) end function c909009015.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c909009015.costfilter,tp,LOCATION_GRAVE,0,1,nil) end function c909009015.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.costfilter(c) return c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost() end function c909009015.thfilter(c) return c:IsSetCard(0x102) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c909009015.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c909009015.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c909009015.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c909009015.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c909009015.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,c909009015.thfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end
(You had 3 filters doing the same thing, and one function that wasn't doing anything. The error was probably occurring because you wouldn't be able to select a search target, causing tc=Duel.GetFirstTarget() to pull a null value. I've also revised your script to be more accurate to Yugioh rules, as it no longer targets the card in the deck.) |
| | | gunsmakerWar Manager
Posts : 356
Rank : 20
| Subject: Re: Need Help at LUA script Fri May 24, 2013 5:01 pm | |
| firstly, thanks for helping the 258 is the hex number of the archtype, that i put in #600, i thought that one condition must have one filter, XD and i've tried on your revised script, it has no errors, but it can banish anything to add "Grand Chasers" monster from deck, it must be banish only a spell, or maybe i should add another filter? |
| | | gunsmakerWar Manager
Posts : 356
Rank : 20
| Subject: Re: Need Help at LUA script Fri May 24, 2013 5:14 pm | |
| nvm, i fixed it, - before fix:
function c909009015.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c909009015.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end
found that rmfilter is no longer exist, so i try to change it to costfilter and works fine without errors, - after fix:
function c909009015.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c909009015.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c909009015.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end
and thanks for helping, maybe i'll ask again about the script, coz i still beginner at this, XD |
| | | Jakester390Mod/Teacher
Posts : 258
Age : 30
Rank : 0
| Subject: Re: Need Help at LUA script Fri May 24, 2013 5:23 pm | |
| Not a problem, I enjoy debugging, and I'd be happy to help. Learning to code this is mostly trial-and-error and copy-and-paste to begin with, but you gradually develop an internal dictionary for it. You seem to be doing fairly good though. |
| | | Sponsored content
| Subject: Re: Need Help at LUA script | |
| |
| | | |
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Menu |
Battle Arena Rules
Shadow Arena Rules
Unlimited Arena Rules
Hunting Arena
|
|