HurahItsHerald
Member Title : HeraldIsHereHoney Posts : 15 Join date : 2015-08-25
| Subject: hard counter script , everyone i asked cant make it xD Wed Dec 02, 2015 11:14 pm | |
| heres the effect :[Field Spell] During your End Phase, if any Crystal Counter(s) were removed from this card: Place Crystal Counter(s) on this card equal to the number of Crystal Counter(s) that were removed.heres its script so far : - Code:
-
local ref=c93000 local mana=0x901 [b] [/b] --[wip]refill mana local e31=Effect.CreateEffect(c) e31:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e31:SetRange(LOCATION_SZONE) e31:SetCode(EVENT_REMOVE_COUNTER+mana) e31:SetOperation(ref.refill_mana_regop) c:RegisterEffect(e31) end function ref.refill_mana_regop(e,tp,eg,ep,ev,re,r,rp) --wip local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetCondition(ref.refill_mana_condition) e1:SetOperation(ref.refill_mana_operation) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetLabel(ct) c:RegisterEffect(e1) end function ref.refill_mana_condition(e,tp,eg,ep,ev,re,r,rp) --wip local ct=e:GetHandler():GetCounter(mana) e:SetLabel(ct) return tp==Duel.GetTurnPlayer() and ct>=0 end function ref.refill_mana_operation(e,tp,eg,ep,ev,re,r,rp) --wip local ct=e:GetLabel() if ct>=0 and e:GetHandler():IsCanAddCounter(mana,ct) then e:GetHandler():AddCounter(mana,ct) end end it doesnt work , the symptoms :during the end phase , it does trigger , except it says "0 counters are placed on this card" please note thats its not a "no counters" situation , but actually "0 counters" i think theres a diffrence : if there arent any counters , and u hover over the field spell with ur mouse theres no counter text in the text bubble , just the field spells name but if there are "0 counters" , it actually says " [Crystal]: 0" i understand u need to set a label , then in the operation function u say e:GetLabel() for it to know how many counters to put on cuz that number can vary its a hard effect but maybe someone whose talented enough can help me solve it thanks in advance |
|