MuadDib POL Developer
Joined: 13 Feb 2006 Posts: 830 Location: Indiana, USA
|
Posted: Sat Jul 01, 2006 10:07 pm Post subject: Custom Hides 095 Distro |
|
|
Introduction
After seeing this asked about over and over on the POLServer.com forums, I have decided to make a guide based on the Distro scripts about customizing Tailoring.
In this guide I hope to explain how to add new custom hides to the carving of NPCs, add their objtypes to the file /scripts/includes/objtypes.inc, add the hides to Tailoring's itemdesc.cfg file, make hides cuttable to the lighter "cut hides" style, and finally make them useable with the Tailoring. After this tutorial you will have 4 hides you can use. Plain Leather, Spined Leather, Horned Leather, and Barbed Leather. Each hide will give the items it's own color, it's own AR differences, and it's own durability rating. Hopefully this guide will solve some of the problems people are having with this specific issue.
Adding hides to itemdesc.cfg
First, let's find the file "/pkg/skills/tailoring/itemdesc.cfg". Open it with whatever editor you prefer, such as notebook, scripter, textpad, or whatever. Go to the very end of the file. Add the following items to the end of the file:
| Code: |
Item 0x107A
{
Name spinedhides
desc spined hide%s%
Graphic 0x1078
VendorSellsFor 7
VendorBuysFor 3
}
Item 0x1068
{
Name cutspinedhides
desc piece%s% of cut spined leather
Graphic 0x1067
weight 1
movable 1
VendorSellsFor 7
VendorBuysFor 3
}
Item 0x107B
{
Name barbedhides
desc barbed hide%s%
Graphic 0x1078
VendorSellsFor 8
VendorBuysFor 4
}
Item 0x1069
{
Name cutbarbedhides
desc piece%s% of cut barbed leather
Graphic 0x1067
weight 1
movable 1
VendorSellsFor 8
VendorBuysFor 4
}
Item 0x107C
{
Name hornedhides
desc horned hide%s%
Graphic 0x1078
VendorSellsFor 10
VendorBuysFor 6
}
Item 0x106A
{
Name cuthornedhides
desc piece%s% of cut horned leather
Graphic 0x1067
weight 1
movable 1
VendorSellsFor 10
VendorBuysFor 6
}
|
Now let's find the original types of hides, so we can do a simple edit to them so all the names are similar. Find the file "/config/itemdesc.cfg" and open it. Find the entries for the leather. If you search for the string "0x1078" you will find all 3 right there. Change them to match the following:
| Code: |
Item 0x1078
{
Name hides
desc hide%s%
VendorSellsFor 4
VendorBuysFor 2
}
Item 0x1079
{
Name hides2
desc hide%s%
VendorSellsFor 4
VendorBuysFor 2
}
Item 0x1067
{
Name cutleather
desc piece%s% of cut leather
VendorSellsFor 4
VendorBuysFor 2
weight 1
movable 1
}
|
Adding New Hides to Objtype.inc
In this part we will add the hides for future referencing to the file "/scripts/include/objtype.inc". Open the file with whatever editor you prefer, such as notebook, scripter, textpad, or whatever. Go to the very end of the file. Add the following items to the end of the file:
| Code: |
//////////////////////////////////////////
// Tailoring Related - Hides & cut leather
//////////////////////////////////////////
CONST HIDE_START := 0x1078;
CONST HIDE_STOP := 0x107C;
CONST LEATHER_START := 0x1067;
CONST LEATHER_STOP := 0x106A;
CONST UOBJ_LEATHER := 0x1067;
CONST UOBJ_SPINED_LEATHER := 0x1068;
CONST UOBJ_BARBED_LEATHER := 0x1069;
CONST UOBJ_HORNED_LEATHER := 0x106A;
CONST UOBJ_HIDES_1 := 0x1078;
CONST UOBJ_HIDES_2 := 0x1079;
CONST UOBJ_SPINED_HIDES := 0x107A;
CONST UOBJ_BARBED_HIDES := 0x107B;
CONST UOBJ_HORNED_HIDES := 0x107C;
|
Now that those are added, we will be able to simplify our code when we change the makeclothitems.src and the scissors scripts for cutting the hides too. With the above settings, not only can we check the individual hide types, but with the ones for START and END, we can do a FAST check to make sure it is the correct leather types. This is important when seeing if the targeted item is leather or not, without having to check every single leather type.
Normally I would not have different cut leather types, if you are familiar with my style of crafting, but this is a beginner's guide after all. So we will keep this simple, and fully functional for the beginners out there.
Making hides cuttable
Now we will add the new hides to the scissors.cfg file in "/pkg/skills/tailoring/scissors.cfg". This will be very simple. Just need to add each item, with the "newitem" entry being the "cut hide" version we made in the itemdesc.cfg of the tailoring package.
Below is the list you will be making to the scissors.cfg file:
| Code: |
scissors 0x107A
{
Name spined hide
material 1
newitem 0x1068
}
Item 0x107B
{
Name barbed hide
material 1
newitem 0x1069
}
scissors 0x107C
{
Name horned hide
material 1
newitem 0x106A
}
|
Now with these added, we can now cut the piles of hides into useable, lighter, cut leather.
Making Hides And Leather Obtainable
In this chapter we will see how to add our new hides and leathers to the actual npcs! So get your favorite script editor and find the "/config/npcdesc.cfg" file. Cuz there be lizardmen needin killed!
Allrighty then! Now, let's use the lizardmen as our example on how to add our new hides to npcs. Remember, this is based off the 095 Distro, which is different for carving corpses than previous versions. So, on to the npc template!
| Code: |
NpcTemplate lizardman1
{
Name
script killPCs
ObjType 0x21
Color 0
TrueColor 0
Gender 0
STR 120
INT 60
DEX 105
HITS 450
MANA 60
STAM 95
Tactics 80
Wrestling 70
MagicResistance 60
AttackSpeed 30
AttackDamage 4d4
AttackAttribute Wrestling
AttackHitSound 0x1A4
AttackMissSound 0x239
deathsound 0x1a6
damagedsound 0x1a5
idlesound1 0x1a2
idlesound2 0x1a3
AR 14
lootgroup 3
alignment neutral
provoke 50
dstart 10
corpseitm rawribs hides eyeofnewt
corpseamt 1 12 1
CProp Karma i-7
CProp Fame i7
CProp Equipt sbackpack
AttackHitScript :combat:wrestlingHitScript
OpensDoors 1
}
|
Ok, look near the bottom of the template. You will see 2 properties.corpseitm & corpseamt. That is what we need to edit in order to add our own new hides. The corpseitm is a space delimited string of objtype names. Find the one that says hides and change it to say the new hide you want them to have. For the sake of the example, let's make it serpent hides. Now, the corpsamt property is a space delimted string of numbers. Each number is the amount of the items from corpseitm to give when the corpse is carved with a knife. In order to ensure to give the correct amount of hides, we must know which one to change. Each number, is for the corpseitm in the same order. In otherwords, the first number is for the first item. The second number is for the second item, and so on.
Once you have made your adjustments, the 2 lines should look like this:
| Code: |
corpseitm rawribs spinedhides eyeofnewt
corpseamt 1 12 1
|
There, now our lizardman1 npc template, will give us spined hides when their corpse is cut with a knife! One step closer to having our customized tailoring!
Making Hides And Leather Useable
In this chapter we will do what it is you are reading this for. Next we will change our Tailoring package to be able to use these new hides! Since different shards want different things, we will only concentrate on a couple things in this chapter. We will see how make them targetable for tailoring and how to make them require different skill levels for each hide type. We will wait till the next chapter to discuss color changes, name changes, and armor rating changes.
First thing's first. This will require editing only 1 file at this point. Let's open "/pkg/skills/tailoring/makeClothItems.src" in our script editor. Now let's go to about line 68. The code you are looking for is below:
| Code: |
elseif((obj_type == 0x1078) || (obj_type == 0x1079) || (obj_type == 0x1067))
MakeLeatherItems(who, use_on, sewing_kit);
|
See how it checks for 3 different obj types? Let's do away with that. What we want, is to see if the obj_type is between our new CONST's we added in the objtype.inc earlier. Remember, we have hides, and cut hides, we can check for. So, to keep it simple we want to check for the objtype by seeing if it greater than the "start" and lesser than the "end" of our ranges. Once you make the change, it should look something like this:
| Code: |
elseif(((obj_type >= HIDE_START) && (obj_type <= HIDE_STOP)) || ((obj_type >= LEATHER_START) && (obj_type <= LEATHER_STOP)))
MakeLeatherItems(who, use_on, sewing_kit);
|
If you look a couple lines above that, you will see where it checks the Bolts of Cloth for cloth items. If you pay attention, you will see our new code looks identical to how it checks bolts of cloth and cloth types, except using our new CONST for leather and hides. It's that simple! Your new hides are now useable!
Now, let's get down to the business of making them require some skill to be useable. This is just as easy, even for a beginner. First we will make a new function just for this. Inside this function, we will use a case() on the objtype of the leathers. Each objtype listed in the case will set a variable. This variable, will be what the minimum required skill to use the hide is. Then we can just check the player's skill against that variable, to decide if they can use it. Let's return 0 for not able to use it, and 1, if they are able. That way we can do a simple check in the main leather crafting function. Once you are done with the new function, it should look something like this:
| Code: |
function CheckSkillForLeather(who, objtype)
var reqSkill := 0;
var mySkill := GetAttribute(who, ATTRIBUTEID_TAILORING);
print("My Skill: "+mySkill);
case(objtype)
UOBJ_LEATHER: mySkill := 0;
UOBJ_SPINED_LEATHER: mySkill := 30;
UOBJ_HORNED_LEATHER: mySkill := 60;
UOBJ_BARBED_LEATHER: mySkill := 90;
UOBJ_HIDES_1: mySkill := 0;
UOBJ_HIDES_2: mySkill := 0;
UOBJ_SPINED_HIDES: mySkill := 30;
UOBJ_HORNED_HIDES: mySkill := 60;
UOBJ_BARBED_HIDES: mySkill := 90;
default: return 0;
endcase
if(mySkill >= reqSkill)
return 1;
else
return 0;
endif
endfunction
|
With the function made, let's put it to use shall we? Go to the MakeLeatherItems function. Find the line below:
| Code: | | SetObjProperty(who, "LastTailorItem", objtype); |
After that line, add the following if check. This will now ensure they have the skill required in order to use the new leathers. Based on the setting you gave the "mySkill" variable throughout the Case statement!
| Code: |
if(!CheckSkillForLeather(who, cloth.objtype))
SendSysMessage(who, "You are not skilled enough to use that kind of leather!");
return;
endif
|
Giving Armor custom names, color, and AR
We will do the nitty gritty in this chapter. Giving your new items the same color as your hides, the name as part of their own, and even custom AR rating based on the hide they used to make it!
Ok, here we go again. Open up your makeClothItems.src file again in your editor. This part will be fun, becuase it makes your new stuff so much more appealing to the players. The first thing we will do, is create a Case() to handle the hides. In it, we will set certain things, like color, a name string, and ar rating, based on the hides. The case will look similar to your one to check the skills. Each type will be listed. Ok, go back to your leather function, like in the last chapter. Once you get to it, find the line "var itemname := leather_cfg[objtype]."name";". After that, add the following code:
| Code: |
var hideColor := cloth.color;
var hideARMod := 0;
case(cloth.objtype)
UOBJ_LEATHER: itemname := itemname; hideARMod := 0;
UOBJ_HIDES_1: itemname := itemname; hideARMod := 0;
UOBJ_HIDES_2: itemname := itemname; hideARMod := 0;
UOBJ_SPINED_LEATHER: itemname := "spined " + itemname; hideARMod := 2;
UOBJ_SPINED_HIDES: itemname := "spined " + itemname; hideARMod := 2;
UOBJ_HORNED_LEATHER: itemname := "horned " + itemname; hideARMod := 3;
UOBJ_HORNED_HIDES: itemname := "horned " + itemname; hideARMod := 3;
UOBJ_BARBED_LEATHER: itemname := "barbed " + itemname; hideARMod := 5;
UOBJ_BARBED_HIDES: itemname := "barbed " + itemname; hideARMod := 5;
endcase
|
We save the color before any material is used, so we don't have to worry about running out of material before the check inside the loop. We also set the AR mod each hide type will give us on our new armor. By appending the hide's name with a space, to the beginning of the itemname, it will give it custom names when made also. Example: "spined leather gorget".
Next, find the 2 lines below.
| Code: |
rint := RandomInt(100);
if(modpts >= rint)
|
After the "rint" line, and before the if statement, add the following code:
| Code: |
theitem.color := hideColor;
|
That will set the new crafted item to have the same color as your hides! When the item's name is set, it will already have the new custom hide's name appended to it because of our case statement earlier. So the next step will give us new AR for our armor. Let's make it a bit random, more like OSI's methods. We can use RandomInt() on the mod we set above, so that there is a bit of differences in the crafted armor. Let's go a few lines down, and find the line "theitem.hp := theitem.maxhp;". After that line, add the following code:
| Code: |
theitem.ar_mod := CInt((hideARMod)+(RandomInt(4)));
|
That will give your item the AR Mod, plus a random value of 0 through 4 added to it! That is all it takes. Since Distro already modifies the .quality of items, that will even further adjust the AR to the way we want it.
I suggest playing around with the hideARMod settings, till you find values you like. Hopefully this helps you in adding even more hides to your system. Good luck, and have fun! |
|