Jump to content

Scroll of SProtect ported to Ragnarok (from Flyff)


clydelion

Recommended Posts


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Made from the latest rAthena release.

This is my own implementation of the item "Scroll of SProtect" of Flyff to Ragnarok. I don't know if you'll find this useful, but I'll release it anyway.

Scroll of SProtect

ScrollofSprotect.png

item image : Spro.gif

Description: Sprotects are used to prevent items from breaking during an upgrade for an item over +4. They are useful for Armor and Weapon Upgrades.

You have to use this item script to activate sprotect.

sc_start SC_SPROTECT,10000000,0;

This is an initial release, there are probably bugs lying around there somewhere.

Download v2sprotect2.diff

V1 - Initial release

V2 - Added the diff for refine npc.

Edited by clydelion
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  70
  • Topics Per Day:  0.02
  • Content Count:  1245
  • Reputation:   392
  • Joined:  11/19/11
  • Last Seen:  

I would like to know more about your item script =). Can you please answer these questions?

  • The set duration of protection is set to 166.67 min. Does this mean you will have upgrade protection for that time period creating as many +10 items (armor/weap) as you want?
  • Does the protection scroll limit you to a single successful upgrade on your armor/weapon?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

1.) No, I wanted it to be there until the user tries to upgrade something.

2.) Yes, after 1 attempt ( either successful or failure).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  70
  • Topics Per Day:  0.02
  • Content Count:  1245
  • Reputation:   392
  • Joined:  11/19/11
  • Last Seen:  

Ah so the user has roughly almost 3 hrs to apply an upgrade to any item (armor or weapon) making it successful. Makes sense.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Well upon re-checking, once the SC_SPROTECT starts(regardless of time limit), it won't end until the user try to upgrade.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

i dont want to be rude or something, but i just want to share that i have a similar src mod with that (i tried to code last year for 3ceam. since +20 refine came out, so i need to find a way to somewhat prevent players hearts from breaking when they fail upgrade +19 to +20 lol, but it is not working pretty well). it also has support for custom status icon previously, but somewhat clients 2011-11- and later cant be hacked to display custom status icons.

im a src mod noob and i really appreciate your work. it saved me a lot. :D

and oh right, you might want to add it also to the new function..

BUILDIN_FUNC(downrefitem)

3c8f5c05.jpg

Edited by Jhedzkie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

Woah that's cool. I'm not into client-side modifications though. Yes that can easily be done but what's 'downrefitem' for anyway?

I really wanted this mod to work exactly like that of Flyff's mechanics.

Edited by clydelion
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

Woah that's cool. I'm not into client-side modifications though. Yes that can easily be done but what's 'downrefitem' for anyway?

I really wanted this mod to work exactly like that of Flyff's mechanics.

try to check your script.c again, (if you have an updated src that is) it is just the next function to failedrefitem..

that's for failed upgrades not to break item (vanish item) but just to downgrade it. like from +17 down to +16.

as for the client-side modification, as ive said, you need to incorporate a new status icon to the client, the icon is a 16x16 targa, that needs to be put on the effects folder, after that, you need to add some entries to the lua files as well. ( data\lua files\stateicon\efstids.lua;stateiconinfo.lua) but, then again, its not working anymore for clients 2011-11+

Edited by Jhedzkie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

I added support for 'downrefitem'. I didn't know it until now. Also included the new refine.txt to match up with the new src. Sorry for the shitty dialog though. HAHAHAHA!

Updated first post.

Edited by clydelion
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

wow. that's a lot of work tho.

mine goes like this...

//this part is inside the BUILDIN_FUNC(failedrefitem)
if (num > 0 && num <= ARRAYLENGTH(equip))
i=pc_checkequip(sd,equip[num-1]);
if(i >= 0) {
+  if(sc->data[sC_UPGRADE_PROTECTION]) // mine's called SC_UPGRADE_PROTECTION anyway. 
+  {
+   status_change_end(bl, SC_UPGRADE_PROTECTION, INVALID_TIMER);
+   clif_displaymessage(sd->fd, msg_txt(720)); // conf/msg_athena.conf   | 720: Scroll of Upgrade Protection has been used.
+  }
+  else
+  {
 /* here goes the script that
	 is originally after
	 the if statement.
 the one that breaks the item and logs it afterwards.
 */
+}

and you dont even have to modify the refiner anymore. :P

it is supposed to be triggered right after a failed attempt, cancels the SC effect, (as well as the status icon, that doesnt work anymore)

and displays the message at the bottom of the screen telling, the scroll has been used etc.

btw, my script is more than a year ago, when im really a noob in C language, (since i only know java) i just tried to edit it error by error, and i really dont know if i made leaks,

overflows whatsoever. im still a noob in C since i dont really read about it, plus, i dont really know what the variables in rAthena are, and what are they for, such as bl, sd, fd and the likes. i did it just by copy pasting and a little trial and error.

Edited by Jhedzkie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

You don't have to edit the refiner to make this work. It is for the players to have a correct dialog. Without modifying the dialog, the npc will tell the players that the equipment was broken, but in reality it is not, instead the SProtect was used . :P

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

You don't have to edit the refiner to make this work. It is for the players to have a correct dialog. Without modifying the dialog, the npc will tell the players that the equipment was broken, but in reality it is not, instead the SProtect was used . :P

oh. :D

hm. that's quite really a lot of work. :P

great job anyway. /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  210
  • Reputation:   10
  • Joined:  11/20/11
  • Last Seen:  

Good Release but ill stick to the script that works exactly like this. :D

good job. /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

Good Release but ill stick to the script that works exactly like this. :D

good job. /no1

you might want to share yours if you had the better src mod. :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  60
  • Reputation:   0
  • Joined:  01/04/12
  • Last Seen:  

how can i put custom icon on SProtect status?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  222
  • Reputation:   34
  • Joined:  12/13/11
  • Last Seen:  

so yeah i applied this patch, and nothings happening i put the itemscript inside of an item that is useable as healing, and useable as other and still not working :C. maybe i missed something?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

how can i put custom icon on SProtect status?

you need to create the icon, and add the icon itself to the client that you are using. i just asked somebody from eAthena to mod the client for me but its a long time ago and i forgot the my account already. =/

so yeah i applied this patch, and nothings happening i put the itemscript inside of an item that is useable as healing, and useable as other and still not working :C. maybe i missed something?

it should work for you. i used the same thing and it worked for me. you just really might missout something.

EDIT: change

sc_start SC_SPROTECT,10000000,0;

to

sc_start SC_SPROTECT,1,0;

10000000 kinda makes no sense for me.

my whole item script goes like this.

22007,Scroll_of_Upgrade_Protection,Scroll of Upgrade Protection,2,2,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_UPGRADE_PROTECTION,1,0; },{},{}

and is working as intended.

Edited by Jhedzkie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  222
  • Reputation:   34
  • Joined:  12/13/11
  • Last Seen:  

so yeah i got this working, lol now my next problem is, what do i need to put on this

    per = status_get_refine_chance(ditem->wlv, (int)item->refine);
           per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [skotlex]

           pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
           if (per > rnd() % 100) { 

for it to check if SC_SPROTECT is my current status. lol yeah this is the skill.c file for weaponrefine, but when i activate sprotect, the item still breaks so i'm guessing it needs to go right before pc_delitem(sd...etc, an if( sc_sprotect = 1){ yada yada yada} i'm kind of new to sourceing so yeah if any of u can help it would be great :)

Edited by lilcooldude69
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

where's that part lol? are you sure you are using the latest revision of rAthena?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

just a quick solution..

skill.c

   pc_addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
   break;
  case 3:
   pc_addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
   break;
 }
}
  } else {
+ if(sd->sc.data[sC_SPROTECT])
+ {
+  status_change_end(&sd->bl, SC_SPROTECT, INVALID_TIMER);
+  clif_refine(sd->fd,1,idx,item->refine);
+  clif_displaymessage(sd->fd,"[ SProtect is no longer in effect ]");
+
+ } else {
item->refine = 0;
if(item->equip)
 pc_unequipitem(sd,idx,3);
clif_refine(sd->fd,1,idx,item->refine);
pc_delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
clif_misceffect(&sd->bl,2);
clif_emotion(&sd->bl, E_OMG);
+	}
  }
 }
}

please tell if it works. :)

Edited by clydelion
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  222
  • Reputation:   34
  • Joined:  12/13/11
  • Last Seen:  

omg ty for quick reply :D, i'll tell u if it does, and @jhedzkie yes lol its hard to find it but its on line 13kish of skill.c i'll edit this post with an update if it works

Update: yay it works, one more thing if its not too much trouble, where would i edit to make the skill weapon refine refine past +10 xD?

Edited by lilcooldude69
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

um, i dont really get this part

if(sd->sc.data[sC_SPROTECT])
{
 status_change_end(&sd->bl, SC_SPROTECT, INVALID_TIMER);
 clif_refine(sd->fd,1,i,sd->status.inventory[i].refine); // what's this line for?
 clif_displaymessage(sd->fd,"[ SProtect is no longer in effect ]");
}

omg ty for quick reply :D, i'll tell u if it does, and @jhedzkie yes lol its hard to find it but its on line 13kish of skill.c i'll edit this post with an update if it works

Update: yay it works, one more thing if its not too much trouble, where would i edit to make the skill weapon refine refine past +10 xD?

maybe this part? not sure tho.

||  item->refine >= 10 // if it's no longer refineable

change 10 to 20.

Edited by Jhedzkie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

yay it works, one more thing if its not too much trouble, where would i edit to make the skill weapon refine refine past +10 xD?

remove this line or change it to 20

||  item->refine >= 10  // if it's no longer refineable

add this too so the status is removed even if it is a success.

  pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
  if (per > rnd() % 100) {
+	if(sd->sc.data[sC_SPROTECT])
+	{
+	 status_change_end(&sd->bl, SC_SPROTECT, INVALID_TIMER);
+	 clif_displaymessage(sd->fd,"[ SProtect is no longer in effect ]");
+	}
log_pick_pc(sd, LOG_TYPE_OTHER, -1, item);
item->refine++;

um, i dont really get this part

if(sd->sc.data[sC_SPROTECT])
{
 status_change_end(&sd->bl, SC_SPROTECT, INVALID_TIMER);
 clif_refine(sd->fd,1,i,sd->status.inventory[i].refine); // what's this line for?
 clif_displaymessage(sd->fd,"[ SProtect is no longer in effect ]");
}

not really necessary, but it is to tell the client that the refine had failed.

Edited by clydelion
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  222
  • Reputation:   34
  • Joined:  12/13/11
  • Last Seen:  

hmm i removed that line, and it uhh still doesnt bring it into the menu, i think its probably located in clif.c since thats where it brings up the menu for weapon refine right? after it hits +10 the menu doesnt have it selectable.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  297
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

i thought the whole function is the one that tells the client that the upgrade has failed. ;p

i really am a noob. XD

anyway, mine's w/o the said line, yet works cool. however, dont you guys think that its a bit like cheating because its already WS_WEAPONREFINE?

i mean isn't WS_WEAPONREFINE meant to upgrade weaps a little bit easier perhaps? opinions varies tho. :D

hmm i removed that line, and it uhh still doesnt bring it into the menu, i think its probably located in clif.c since thats where it brings up the menu for weapon refine right? after it hits +10 the menu doesnt have it selectable.

yeah, i think its in clif.c right around this part.

 if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].refine < skilllv &&
  sd->status.inventory[i].identify && (wlv=itemdb_wlv(sd->status.inventory[i].nameid)) >=1 &&

checks if refine < skilllv

where ur skilllv probably is max possible lv. 10.

i guess multiply it by 2? so that if its max lv 10, x2, it will check if item refinery is less than 20. (i might be wrong tho)

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.

×
×
  • Create New...