Jump to content

Need help for a kinda hard YGOpro card script


LordSPX

Recommended Posts

Hey, Im trying to script the following effect in YGOpro but i'm having issues: Picture here

Zorc Necrophades, level 12 Dark Fiend.

'Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by Banishing 3 level 10 Dark type monsters you control and cannot be Special Summoned by other ways. Unaffected by other card effects. Once per turn, it cannot be destroyed by battle. If this card destroys a monster, inflict damage to your opponent equal to its ATK. Your opponent cannot win the duel with a Win Condition except by Horakhty, The Creator of Light.'

 

Zorc Necrophades
function c95825399.initial_effect©
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect©
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c95825399.spcon)
e1:SetOperation(c95825399.spop)
c:RegisterEffect(e1)
        --immune
        local e2=Effect.CreateEffect©
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(c95825399.efilter)
c:RegisterEffect(e2)
        --damage
local e3=Effect.CreateEffect©
e3:SetDescription(aux.Stringid(95825399,0))
e3:SetCategory(CATEGORY_DAMAGE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EVENT_BATTLE_DESTROYING)
e3:SetCondition(c95825399.damcon)
e3:SetTarget(c95825399.damtg)
e3:SetOperation(c95825399.damop)
c:RegisterEffect(e3)
 
end
function c95825399.gfilter©
c:IsAttribute(ATTRIBUTE_DARK) and c:GetLevel()==10 and c:IsAbleToRemoveAsCost()
 
end
function c95825399.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3
and Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,3,nil)
 
end
function c95825399.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,3,3,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g3=Duel.
 
end
function c95825399.efilter(e,te)
return te:GetOwner()~=e:GetOwner()
 
end
function c95825399.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
 
end
function c95825399.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local dam=e:GetHandler():GetBattleTarget():GetAttack()
if dam<0 then dam=0 end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(dam)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
 
end
function c95825399.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
 
 
I started as you see but since its my first attempt at scripting, i have no idea how to make it work....
Link to comment
Share on other sites

Ya sorry I wasn't clear:

When I try it against the ai, 2 messages come up:

"syntax error near necrophades" and "CallCardFunction initial effect attempt to call an error function"

I'm guessing that the code is not consistent at the beginning but no clue where.

Furthermore, is it even possible to have an effect that won't let an opponent win by a win condition?

Link to comment
Share on other sites

Something I learned from doing Java / regular C coding (and a bit of my own card scripts); have you tried testing the effects out individually and seeing where the bugs are? It's easier to find the problems in small parts, as opposed to a larger one (well, in the absence of a program that checks it for you). 

 

If you copied off of actual cards, it should be fine. Effects e2 and e3 look fine. 

 

-----

You can probably have an effect that restricts alt. win conditions, but that would likely require more complicated coding that either needs to be ripped from anime cards (if it exists) or something you'll have to try coding on your own. For now, I'd take that one out. 

Link to comment
Share on other sites

never do the coding in my life but since there a bit involvement with me earlier....

 

how about the Boss Duel (http://yugioh.wikia.com/wiki/Boss_Duel)? would  YGOPRO has a script for 1 of that format rule which mention:

 

when your opponent would win by condition written on their card take 8000 damage instead...well more so that line

 

obviously not that helpful but its the closest i can think from the official ruling for the format. maybe with magic of coding you take 0 damage instead...idk

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...