Jump to content
  • 0
SlashGeeGee

Custom Enchantment System

Question

Hi Hercules !

I've had a copy of Kenedo's Custom Enchantment System which I got from rA. Everything works fine. but there are quite a few mistakes I have seen.

 

Well , here it is :

 

1.When I choose 2nd Slot the display on the Slot Number before confirmation is 3rd Slot.
2.When I choose 1st Slot the display is correct but when I go to my equipment it is enchanted in the 3rd Slot.
3. Vice Versa of Bug No. 2
 
Here's the script I'm using : http://upaste.me/31905933c4a6bebe

Since rA is down. Can someone help me from Hercules ?
 
Thanks in Advance !  :meow: 


SlashGeeGee

Share this post


Link to post
Share on other sites

19 answers to this question

Recommended Posts

  • 0

Here you go: http://upaste.me/8bfd59863044c49a

 

This leaves me with a feeling of having broken something but I can't find nothing, so please tell me if I really did. I have no console for testing right now. Tell me if it works properly

 

Please, edit yourself all references to the rest of armors this NPC supposedly enchanted. I've left it up to you since I have other things to do and time is tight on me.

 

Edit: if this is correct, which post do I mark as solved? This one or the other NPC modification?

Share this post


Link to post
Share on other sites
  • 0

This script is enormous and it kinda confused me first time I tried to review it, but after looking through it for quite a lot of time, it seems that Kenedos counted the slots backwards, don't know what made him decide this. This confirms what you stated in your first post.

 

See these pieces of code:

		// Selecting Slots		L_SelectSlot:		set .@slot_num, 0;		set .@slot_num, select("1st Slot:2nd Slot:3rd Slot");		if ((.@slot_num <= 0) || (.@slot_num > 3)) {			mes "["+strnpcinfo(1)+"]";			mes "Sorry but you must select a valid slot number.";			close;		}

 

set .@equip_cardid, getequipcardid(.@part,(4 - .@slot_num)); // 4 - number of slot selected

 

mes "^0000FFSlot Number^000000 = "+( (.@slot_num == 1) ? "1st Slot" : (.@slotnum == 2 ? "2nd Slot" : "3rd Slot") );

WHAT? He first counts backwards then he changes to count forward? 1st slot is the last one for him.
 

				if (.@slot_num == 1)					getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@cardid[2], .@rand_bonus;				else if (.@slot_num == 2)					getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@rand_bonus, .@cardid[3];				else if (.@slot_num == 3)					getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@rand_bonus, .@cardid[2], .@cardid[3];

Note: .@rand_bonus is the bonus you previously selected.
 
Hey, beware of the other enchantment method just after this one, fixing it is identical but you have to edit some more lines. And those comments are mine, don't try to find them
 
I'll try to fix it if you want, but if you know a bit of scripting you have what you need in order to fix it yourself in these code boxes. This could be an interesting exercise for you if you want to learn/apply a bit of scripting knowledge.
 
If not, I don't mind to fix this myself. Well, in fact this wouldn't be a fix but a partial amendment.

Share this post


Link to post
Share on other sites
  • 0

This script is enormous and it kinda confused me first time I tried to review it, but after looking through it for quite a lot of time, it seems that Kenedos counted the slots backwards, don't know what made him decide this. This confirms what you stated in your first post.

 

See these pieces of code:

		// Selecting Slots		L_SelectSlot:		set .@slot_num, 0;		set .@slot_num, select("1st Slot:2nd Slot:3rd Slot");		if ((.@slot_num <= 0) || (.@slot_num > 3)) {			mes "["+strnpcinfo(1)+"]";			mes "Sorry but you must select a valid slot number.";			close;		}

 

set .@equip_cardid, getequipcardid(.@part,(4 - .@slot_num)); // 4 - number of slot selected

 

mes "^0000FFSlot Number^000000 = "+( (.@slot_num == 1) ? "1st Slot" : (.@slotnum == 2 ? "2nd Slot" : "3rd Slot") );

WHAT? He first counts backwards then he changes to count forward? 1st slot is the last one for him.

 

				if (.@slot_num == 1)					getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@cardid[2], .@rand_bonus;				else if (.@slot_num == 2)					getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@cardid[1], .@rand_bonus, .@cardid[3];				else if (.@slot_num == 3)					getitem2 .@itemid, 1, 1, .@refine, 0, .@cardid[0], .@rand_bonus, .@cardid[2], .@cardid[3];

Note: .@rand_bonus is the bonus you previously selected.

 

Hey, beware of the other enchantment method just after this one, fixing it is identical but you have to edit some more lines. And those comments are mine, don't try to find them

 

I'll try to fix it if you want, but if you know a bit of scripting you have what you need in order to fix it yourself in these code boxes. This could be an interesting exercise for you if you want to learn/apply a bit of scripting knowledge.

 

If not, I don't mind to fix this myself. Well, in fact this wouldn't be a fix but a partial amendment.

 

Thanks for reviewing the script. I don't understand what you mean I only have a bit of scripting knowledge. Can you fix it ?

 

thank you in advance :D

 

SlashGeeGee

Share this post


Link to post
Share on other sites
  • 0

My previous explanation didn't really explain why when you select 2nd slot it got third one, but I've just found the little mistake on Kenedos script and fixed it. A misspelt variable: he was using .@slotnum instead of .@slot_num (see my third codebox: it was there and I didn't even notice it!).

 

Menu now makes the user select whether they want 2nd, 3rd or 4th slot of the armor. This way it's easier for them to understand what slot to compound. Note I've also reversed the order of the zeny cost of the enchantments and its chance, so prices and chances for 2nd slot are now those the enchanter asked for 3rd slot; same with 3rd now slot to 2nd old slot and 4th to now 1st.

 

Here you go:


Armor craftsman2.txt

 

 

It may be enlightening for your scripting abilities to compare them side-by-side and check what modifications I made, they're very basic ones.

 

Please, test this thoroughly in your home server before using elsewhere as I may be mistaken too. Also, tell me if it works too.

Share this post


Link to post
Share on other sites
  • 0

My previous explanation didn't really explain why when you select 2nd slot it got third one, but I've just found the little mistake on Kenedos script and fixed it. A misspelt variable: he was using .@slotnum instead of .@slot_num (see my third codebox: it was there and I didn't even notice it!).

 

Menu now makes the user select whether they want 2nd, 3rd or 4th slot of the armor. This way it's easier for them to understand what slot to compound. Note I've also reversed the order of the zeny cost of the enchantments and its chance, so prices and chances for 2nd slot are now those the enchanter asked for 3rd slot; same with 3rd now slot to 2nd old slot and 4th to now 1st.

 

Here you go:

 

attachicon.gifArmor craftsman2.txt

 

 

It may be enlightening for your scripting abilities to compare them side-by-side and check what modifications I made, they're very basic ones.

 

Please, test this thoroughly in your home server before using elsewhere as I may be mistaken too. Also, tell me if it works too.

 

thank you very much sir. I jus tested in my home server right now and it's working fine now. If I want the enchantment to be limited toheadgear's only. i'll change this

 

setarray .@position$[1], "Headgear","Armor","Shield","Invalid","Garment","Footgear";

 

to this right ?

 

setarray .@position$[1], "Headgear","Invalid";

 

and what does this "Invalid" mean ? I tested the whole script but I got nothing about this "Invalid" stuff.

 

 

SlashGeeGee

Share this post


Link to post
Share on other sites
  • 0

Hey guys, i have a question,.. or maybe a sugestion hhaha

is there a way to make the equips not be destroyed when it failed? 

just simply make it fail or maybe remove the previous enchant on that slot...

Share this post


Link to post
Share on other sites
  • 0

@@SlashGeeGee: No, that's the name of the equip position you're looking into (see 'getequipisequiped' script command and reference for script positions to 'getequipid'). Actual equipment is taken on the loop. Since position 4 is for weapons and this script doesn't do anything to weapons, they're skipped. You'll never see that Invalid in your NPC at execution.

 

Modifications are quite different if you make this enchanter work only on upper headgear or work on upper, mid and low headgears independently. What do you exactly want? If you only want Upper headgear I can take the loop out.

 

@@Critica: Yes, you could simply comment (place a // in front of the respective code lines) the 'delitem' script command at lines 673, 764 (763 too if you don't want the material removed), and 852 (and 851 if you want same as before. Just remember this script uses an item with an ID# 30000, which is a custom one.

 

P.S.: It seems I'm starting to expertise in this script :D

Share this post


Link to post
Share on other sites
  • 0

@@SlashGeeGee: No, that's the name of the equip position you're looking into (see 'getequipisequiped' script command and reference for script positions to 'getequipid'). Actual equipment is taken on the loop. Since position 4 is for weapons and this script doesn't do anything to weapons, they're skipped. You'll never see that Invalid in your NPC at execution.

 

Modifications are quite different if you make this enchanter work only on upper headgear or work on upper, mid and low headgears independently. What do you exactly want? If you only want Upper headgear I can take the loop out.

 

 

P.S.: It seems I'm starting to expertise in this script :D

 

Please take out the loop that is my final request that only upper headgear can be enchanted. thanks :D

 

 

SlashGeeGee

Share this post


Link to post
Share on other sites
  • 0

Here you go: http://upaste.me/8bfd59863044c49a

 

This leaves me with a feeling of having broken something but I can't find nothing, so please tell me if I really did. I have no console for testing right now. Tell me if it works properly

 

Please, edit yourself all references to the rest of armors this NPC supposedly enchanted. I've left it up to you since I have other things to do and time is tight on me.

 

Edit: if this is correct, which post do I mark as solved? This one or the other NPC modification?

 

Thanks ! I'll test it right now. and later i'll mark the better one. :D

 

SlashGeeGee

Share this post


Link to post
Share on other sites
  • 0

Thanks a lot jaBote :D I tested the script and I runs smoothly , one error in line 335 though.

just change this :

 

		if(!getequipisequiped(EQI_HEAD_TOP){


in to this :

 

		if(!getequipisequiped(EQI_HEAD_TOP)){



SlashGeeGee

Share this post


Link to post
Share on other sites
  • 0

si jaBote, question.

is there a way to change it to enchant costume items instead??

ive try to change it myself, but i failed xD

 

Edited by Critica

Share this post


Link to post
Share on other sites
  • 0

I haven't messed with costume equipment on scripts yet, but I can't see any reason that prevents this script to work on them. Just see 'getequipid' to get their slot numbers and (using the version with loops) simply check them. You would only have to edit the loop for making it read only the costume items.

 

Since I'm not familiar with costume items, I don't know if enchanting them would have any actual effect other than cosmetic.

Share this post


Link to post
Share on other sites
  • 0

hmm.. im not sure if its gona work too, but i wana try..

right now all i know is i gotta put this right?
 

EQI_COSTUME_HEAD_LOW 11
EQI_COSTUME_HEAD_MID 12
EQI_COSTUME_HEAD_TOP 13
EQI_COSTUME_GARMENT 14

somewhere here

		L_EnchantLoc:		mes "["+strnpcinfo(1)+"]";		mes "Select an equipment first, then I'll ask you the ^FF0000Enchantment Type^000000, ^FF0000Class Type^000000 (If necessary), ^0000FFSlot Number^000000, and give you the final ^009900Zeny Cost^000000 for my services.";		next;		setarray .@position$[1], "Headgear","Armor","Shield","Invalid","Garment","Footgear";		set .@menu$,"";		deletearray .@arr;		set .@j, 1;		for( set .@i,1; .@i <= 6; set .@i,.@i+1 )		{			if ((.@i == 3) && (getiteminfo(getequipid(3),5) == 32) && (getequipisequiped(.@i))) { // Only catch shields				set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";				set .@arr[.@j], .@i;				set .@j, .@j + 1;				set .@menu$, .@menu$ + ":";			}			if(getequipisequiped(.@i) && (.@i != 4) && (.@i != 3)) {				set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";				set .@arr[.@j], .@i;				set .@j, .@j + 1;				set .@menu$, .@menu$ + ":";			}					}

 


but i couldnt understand it, im not sure which one to change...

do you think you can help me? 

==

o yeah, if your wondering why,,, i saw a topic and theres a diff makes you actually use/slot the costumes*
and since enchantments acts like a card too.. would it be possible to work too right??

correct me if im wrong...

its in the other site. im not sure if its ok to post it here...

Edited by Critica

Share this post


Link to post
Share on other sites
  • 0

You can try this cheap trick:

   	 L_EnchantLoc:        mes "["+strnpcinfo(1)+"]";        mes "Select an equipment first, then I'll ask you the ^FF0000Enchantment Type^000000, ^FF0000Class Type^000000 (If necessary), ^0000FFSlot Number^000000, and give you the final ^009900Zeny Cost^000000 for my services.";        next;        setarray .@position$[11], "Costume Low","Costume Mid","Costume Top","Costume Garment";        set .@menu$,"";        deletearray .@arr;        set .@j, 1;        for( set .@i,11; .@i <= 14; set .@i,.@i+1 )        {            if(getequipisequiped(.@i) && (.@i != 4) && (.@i != 3)) {                set .@menu$, .@menu$ + .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";                set .@arr[.@j], .@i;                set .@j, .@j + 1;                set .@menu$, .@menu$ + ":";            }            }

I just changed starting equip position to check (11, EQI_COSTUME_HEAD_LOW) and the condition of the loop for checking from EQI_COSTUME_HEAD_LOW to EQI_COSTUME_GARMENT. I also deleted the condition for catching shields since there'll be no shields while getting these equips.

Share this post


Link to post
Share on other sites
  • 0

EXCELLENT!

ive tested it today, and everything is working according to my plan, huehuehue! >:)

now, if you dont my, i have a last request..

could you add slot 1 on the selection for slotting? 

chances are like this..
 

"1st Slot - 80% Success
"2nd Slot - 70% Success
"3rd Slot - 60% Success
"4th Slot - 50% Success

i know its a lot of scripting... but if you have free time can you do it please?  :D 
im trying hard to script this by myself, but i only know basic stuff here so it might not work anyways...



thanks in advance! 
 

Share this post


Link to post
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
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.