Skip to content
TheChatArchiveThe Chat Archive
Googlepalm-2· GoogleHugging Face Arena Human Preference 55K

this code i made for a edopro card script is not working as intended, it was not…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-instant-1’s answer.
  1. User

    this code i made for a edopro card script is not working as intended, it was not supposed to do this "All your monsters currently on the field are immune to opponent card effects until the end of this turn." , my code: --Black ops 3 - In Plain Sight --card effect description: All your monsters currently on the field are immune to opponent card effects until the end of this turn. local s,id = GetID() function s.initial_effect(c) local e1 = Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end -- Make all the player's monsters immune to all opponent card effects until the end of this turn. function s.target(e, tp, eg, ep, ev, re, r, rp, chk) if chk == 0 then return Duel.IsExistingMatchingCard(Card.IsMonster, tp, LOCATION_ONFIELD, 0, 1, nil) and Duel.IsExistingMatchingCard(Card.IsMonster, tp, LOCATION_ONFIELD, 0, 1, nil) end end function s.activate(e, tp, eg, ep, ev, re, r, rp) local c=e:GetHandler() local g = Duel.GetMatchingGroup(Card.IsMonster,tp,LOCATION_ONFIELD,0,nil) -- Loop through all cards in the group g and apply the immune effect using a for loop for tc in aux.Next(g) do local e1 = Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.efilter) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end function s.efilter(e,te) return te:GetOwner()~=e:GetOwner() end

  2. Google Assistant

    The problem with your code is that you are using the for loop to apply the immune effect to all monsters on the field. However, the for loop only iterates over the monsters in the g group, which is the group of monsters that match the condition Card.IsMonster. This means that the immune effect will only be applied to the monsters in the g group, and not to all monsters on the field.

    To fix this, you need to use the for loop to iterate over all monsters on the field, and then apply the immune effect to each monster. You can do this by changing the for loop to the following:

    for tc in aux.Next(Duel.GetMatchingGroup(Card.IsMonster,tp,LOCATION_ONFIELD,0,nil)) do
    

    This will iterate over all monsters on the field, and then you can apply the immune effect to each monster using the following code:

    local e1 = Effect.CreateEffect(c)
    e1:SetType(EFFECT_TYPE_SINGLE)
    e1:SetCode(EFFECT_IMMUNE_EFFECT)
    e1:SetRange(LOCATION_MZONE)
    e1:SetValue(s.efilter)
    e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
    tc:RegisterEffect(e1)
    

    This will create a new effect that makes the monster immune to opponent card effects, and then register it with the monster.

    Once you have made these changes, your code should work as intended.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.