YGOPRO Forum

Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
ChaosdragoonZero  
#1 Posted : Sunday, February 24, 2019 1:01:09 PM(UTC)
ChaosdragoonZero

Rank: Newbie

Joined: 2/24/2019(UTC)
Posts: 4

Thanks: 1 times
Hello Everyone, im gonna say this now, I have little experience with card scripting so please be gentle. My ygopro hasn't updated for a really long time, therefore whenever new cards are released ygopro won't have them. So I decided to add some of the cards myself. It works fine at first, I can search the cards, i can use them and everything but when I activate their effects I get the following script error:

[Script error:] [string ". /script/c20654247. lua"] : 76: attempt to perform arithmetic on global 'RESETS_STANDARD' (a nil value)

Once this happens their effects don't work.

Please help I want to try and fix this. Thank you in advance.

Here is the script of the first card.

--青眼の混沌龍
function c20654247.initial_effect(c)
c:EnableReviveLimit()
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.ritlimit)
c:RegisterEffect(e1)
--cannot target
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetValue(aux.indoval)
c:RegisterEffect(e3)
--position
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(20654247,0))
e4:SetCategory(CATEGORY_POSITION)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_ATTACK_ANNOUNCE)
e4:SetCondition(c20654247.poscon)
e4:SetTarget(c20654247.postg)
e4:SetOperation(c20654247.posop)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_MATERIAL_CHECK)
e5:SetValue(c20654247.valcheck)
e5:SetLabelObject(e4)
c:RegisterEffect(e5)
--pierce
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_PIERCE)
c:RegisterEffect(e6)
end
function c20654247.valcheck(e,c)
local mg=c:GetMaterial()
if mg:IsExists(Card.IsCode,1,nil,89631139) then
e:GetLabelObject():SetLabel(1)
else
e:GetLabelObject():SetLabel(0)
end
end
function c20654247.poscon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetSummonType()==SUMMON_TYPE_RITUAL and e:GetLabel()==1
end
function c20654247.postg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsCanChangePosition,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsCanChangePosition,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c20654247.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tg=Duel.GetMatchingGroup(Card.IsCanChangePosition,tp,0,LOCATION_MZONE,nil)
local tc=tg:GetFirst()
while tc do
if Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
e2:SetValue(0)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
end
tc=tg:GetNext()
end
if c:IsRelateToEffect(e) then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_PIERCE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e3)
end
end
Hippocampus1901  
#2 Posted : Sunday, February 24, 2019 9:03:00 PM(UTC)
Hippocampus1901

Rank: Advanced Member

Joined: 12/29/2015(UTC)
Posts: 170

Thanks: 11 times
Was thanked: 39 time(s) in 39 post(s)
Hi ChaosdragoonZero,

It appears you're using an older version of YGOpro, hence why there aren't any automatic updates anymore. "RESETS_STANDARD" is a constant that was added to the Links beta version but wasn't present in older versions. Try replacing every instance of "RESETS_STANDARD" with the number "0x1fe0000" (which is what it is defined as in the constants file of the Links beta).

So for instance, the line "e1:SetReset(RESET_EVENT+RESETS_STANDARD)" should become "e1:SetReset(RESET_EVENT+0x1fe0000)".

Hope this helps!
ChaosdragoonZero  
#3 Posted : Monday, February 25, 2019 10:34:18 AM(UTC)
ChaosdragoonZero

Rank: Newbie

Joined: 2/24/2019(UTC)
Posts: 4

Thanks: 1 times
Hi Hippocampus1901. I tried what you asked me to do, and it WORKS!! Thank you so much, I really, really appreciate it. I owe ya one man. Though one of the cards gave me another error, its not a big deal because the card still works regardless of that error but I don't know. The card is a trap which you can use it twice, by summoning a specific monster you can return it from the graveyard and set it but it will be banished if it leaves the field. The error occurs when I return it from the graveyard but when I activate it its fine, the effects are still valid.

Anyway here is the error:

[Script error:] [string ". /script/c56920308. lua"] : 93: attempt to perform arithmetic on global 'RESETS_REDIRECT' (a nil value)

And here is the script for the card:

--強靭!無敵!最強!
function c56920308.initial_effect(c)
--effect gain
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c56920308.target)
e1:SetOperation(c56920308.activate)
c:RegisterEffect(e1)
--set
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(56920308,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,56920308)
e2:SetCondition(c56920308.setcon)
e2:SetTarget(c56920308.settg)
e2:SetOperation(c56920308.setop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
c56920308.card_code_list={89631139}
function c56920308.filter(c)
return c:IsFaceup() and c:IsSetCard(0xdd)
end
function c56920308.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c56920308.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c56920308.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c56920308.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c56920308.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c56920308.efilter)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(1)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_DAMAGE_STEP_END)
e3:SetCondition(c56920308.descon)
e3:SetOperation(c56920308.desop)
e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3)
end
end
function c56920308.efilter(e,re)
return e:GetHandler()~=re:GetOwner()
end
function c56920308.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetBattleTarget()
return tc and tc:IsRelateToBattle()
end
function c56920308.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetBattleTarget()
Duel.Hint(HINT_CARD,0,56920308)
Duel.Destroy(tc,REASON_EFFECT)
end
function c56920308.cfilter(c,tp)
return c:IsCode(89631139) and c:GetSummonPlayer()==tp
end
function c56920308.setcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c56920308.cfilter,1,nil,tp)
end
function c56920308.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsSSetable() end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function c56920308.setop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsSSetable() then
Duel.SSet(tp,c)
Duel.ConfirmCards(1-tp,c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_REDIRECT)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1)
end
end

Again its not a big deal since everything is working fine. But yeah if it will cause trouble later then I should fix this just in case. Sorry to dump another one on ya, but thank you so much for this. You have my eternal gratitude.
ChaosdragoonZero  
#4 Posted : Monday, February 25, 2019 2:11:46 PM(UTC)
ChaosdragoonZero

Rank: Newbie

Joined: 2/24/2019(UTC)
Posts: 4

Thanks: 1 times
Also I seem to have encountered yet another problem. The first card I posted isn't supposed to be destroyed by a card effect and yet it did. I looked at the script and it seemed fine. I don't understand.:S
Hippocampus1901  
#5 Posted : Sunday, March 03, 2019 11:11:43 PM(UTC)
Hippocampus1901

Rank: Advanced Member

Joined: 12/29/2015(UTC)
Posts: 170

Thanks: 11 times
Was thanked: 39 time(s) in 39 post(s)
For the trap card, you can do the same thing as I suggested above, only replace the instance of "RESETS_REDIRECT" with the number "0x47e0000". I believe these are the only two constants you have to worry about.

As for Blue-Eyes Chaos Dragon, find the word "indoval" in its script and replace it with "tgoval". Let me know if that doesn't fix it.
thanks 1 user thanked Hippocampus1901 for this useful post.
ChaosdragoonZero  
#6 Posted : Friday, March 08, 2019 6:17:21 AM(UTC)
ChaosdragoonZero

Rank: Newbie

Joined: 2/24/2019(UTC)
Posts: 4

Thanks: 1 times
Thank you thank you thank you, everything's fixed and works fine. I am really grateful for your help. Thank you so much.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error