Jump to content
  • 0

Help in downrefineitem system


Question

Posted (edited)

A little help here ..

this downrefitem decreases by 1, what i want is if the refine rate was 10 -13 and when it fails the refine will downgrade to +10.

Refine=Decrease

10 - 13= 10

14 -17= 14

18 -19= 18

Thank you .. :)

BUILDIN_FUNC(downrefitem)
{
int i = -1,num,ep;
TBL_PC *sd;

num = script_getnum(st,2);
sd = script_rid2sd(st);
if( sd == NULL )
return 0;

if (num > 0 && num <= ARRAYLENGTH(equip))
i = pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
ep = sd->status.inventory[i].equip;

//Logs items, got from (N)PC scripts [Lupus]
log_pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i]);

sd->status.inventory[i].refine++;
pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below

clif_refine(sd->fd,2,i,sd->status.inventory[i].refine = sd->status.inventory[i].refine - 2);
clif_delitem(sd,i,1,3);

//Logs items, got from (N)PC scripts [Lupus]
log_pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i]);

clif_additem(sd,i,1,0);
pc_equipitem(sd,i,ep);
clif_misceffect(&sd->bl,2);
}

return 0;
}

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.

10 answers to this question

Recommended Posts

Posted

But what i want is a continues refining and i do have the unbound and bound script for the equips that's why there is a chance for equip2 to equip unbound to bound or bound to unbound of the same kind..

Posted

But what i want is a continues refining and i do have the unbound and bound script for the equips that's why there is a chance for equip2 to equip unbound to bound or bound to unbound of the same kind..

what?

Posted

you can also do it like this..

when failed in refine.....

change your

downrefitem <equipment slot>;

into

while( getequiprefinerycnt( <equipment slot> ) > 10 )
   downrefitem <equipment slot>;

  • Upvote 1
Posted (edited)

Thanks for the replies i just did follow your suggestions ..

---------------------------------

This what i just did.

if (getequiprefinerycnt(.@part) > 9 && getequiprefinerycnt(.@part) < 14 && getequiprefinerycnt(.@part) != 10) {

do {

downrefitem .@part;

}while (getequiprefinerycnt(.@part) != 10);

}else if (getequiprefinerycnt(.@part) > 13 && getequiprefinerycnt(.@part) < 18 && getequiprefinerycnt(.@part) != 14) {

do {

downrefitem .@part;

}while (getequiprefinerycnt(.@part) != 14);

}else if (getequiprefinerycnt(.@part) > 17 && getequiprefinerycnt(.@part) < 20 && getequiprefinerycnt(.@part) != 18) {

do {

downrefitem .@part;

}while (getequiprefinerycnt(.@part) != 18);

}

Edited by paolokupal
Posted
i do have the unbound and bound script for the equips ...

there is a chance for equip2 to equip unbound to bound or bound to unbound of the same kind..

can you explain what is this equipment bounding system ?

seems like new to me

or maybe I'm just outdated ?

me and goddameit doesn't understand what is this equipment bounding system

Posted (edited)

while ( <true> ) { <loop indefinitely> }

@paolokupal

I'm pretty sure your code there doesn't work because your while (<condition>) is started with false

and it will break outside the loop immediately

should be more like

.@ref_cnt = getequiprefinerycnt(.@part); // do you know some script commands are very messy if you read script.c ... this runs pc_checkequip function everytime in pc.c
if ( .@ref_cnt == 10 || .@ref_cnt == 14 || .@ref_cnt == 18 ) {
   specialeffect2 eff_refinefail;
} else if ( .@ref_cnt >= 11 && .@ref_cnt <= 13 ) { // well more understandable
   while ( getequiprefinerycnt(.@part) > 10 )
       downrefitem .@part;
} else if ( .@ref_cnt >= 15 ...

seems like emistry really improve a lot @_@ same code with him

rep_up.png up his post <3

Edited by AnnieRuru
Posted (edited)
seems like emistry really improve a lot @_@

really ? xD hope so ~

( happy-ing......( ~^ o ^ ~ ) )

erm..i would do like this..xD

if( getequiprefinerycnt(.@part) > 18 ) set .@Reduce,18;
else if( getequiprefinerycnt(.@part) > 14 ) set .@Reduce,14;
else if( getequiprefinerycnt(.@part) > 10 ) set .@Reduce,10;
else set .@Reduce,0;

if( .@Reduce )
while( getequiprefinerycnt(.@part) > .@Reduce )
 downrefitem .@part;

Edited by Emistry

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...