View unanswered posts | View active topics
|
Page 1 of 1
|
[ 12 posts ] |
|
| Author |
Message |
|
Jarsil
|
Post subject: Tailoring Posted: Wed Mar 07, 2007 2:06 am |
|
Joined: Fri Jan 05, 2007 6:43 am Posts: 7 Location: Latina, Italy
|
hello all.
I've been browsing the forum for a long while, but never posted anything (cause i didn't have anything useful to say)...
This is my first try to create a package, is made for 097, and is a tailoring skill package that use the crafting system, new gumps and so.
It works at most, has still something to be fixed but i'd like to have your opinion about it.
You'll find that portions of code have been taken from carpentry package (i needed some "help" to create gumps and see how these gumps are made - functions and so on - ).
It uses both the crafting package and the item/clothing package to work.
This is the tailoring.src
Code: /* New 097 Tailoring system Made to be more similar to new crafting skill 2007, Jarsil for [Enyaw] Shard v 0.1 alpha */
use cfgfile; use util;
include ":attributes:attributeConstants"; include ":attributes:attributes"; include ":attributes:skillCheck"; include ":crafting:crafting"; include ":crafting:craftingRepair"; include ":crafting:toolWear";
const SCISSORS_SOUND := 0x0249;
var item_config := ReadConfigFile(":*:itemdesc"); var craft_config := ReadConfigFile(":tailoring:tailoring");
program use_sewingkit(who, tool)
if ( !ReserveItem(tool) ) SendSysMessage(who, "That is already in use."); return 0; elseif( (!tool.movable) || !ReserveItem(tool) ) SendSysMessage(who, "You cannot use that"); return 0; elseif( !(tool in EnumerateItemsInContainer(who.backpack)) ) SendSysMessage(who, "That item is not in your backpack."); return 0; endif
EraseObjProperty(who, "#IsMeditating"); EraseObjProperty(who, "#HealTimer");
var rinfo := sendCraftGump(who, TAILORING);
// OK was pressed, close it on out if(rinfo == 0) return 0; endif
var the_objtype := rinfo[1]; var amt := rinfo[2]; var repairit := rinfo[3];
if(repairit) repair_this(who, craft_skill); return 0; endif TailoringItems(who, tool, the_objtype, amt); endprogram
function TailoringItems(who, tool, objtype, amt)
var itemchk := MaterialSelection(who, craft_skill, lower(craft_config[objtype].type)); if( !itemchk ) return 0; endif var item1 := itemchk[1]; var item1objtype := itemchk[2]; var ptmod := itemchk[3];
var x := who.x, y := who.y, item2 := 0; var material2obj := craft_config[objtype].material2obj; if( TypeOf(material2obj) == "String" ) var holder := material2obj; // Let's now select the secondary material. Chk is not passed, as currently // ingots do not hold a cprop to know which type they was originally like boards // or cut leather. itemchk := MaterialSelection(who, craft_skill, lower(holder)); if( !itemchk ) return 0; endif item2 := itemchk[1]; ptmod := ptmod + CInt(itemchk[3]); endif var theitem, chk := 0; var itemname := craft_config[objtype].name; var material := Cint(craft_config[objtype].material); var material2 := Cint(craft_config[objtype].material2); var reqd := Cint(craft_config[objtype].skill); var skillid2 := craft_config[objtype].skillID; var skill2 := Cint(craft_config[objtype].skill2); var diff := Cint(craft_config[objtype].difficulty); var pts := Cint(craft_config[objtype].points); pts := CInt(pts + ptmod);
var counter := 0; while(counter < amt) if((who.x != x) || (who.y != y)) SendSysMessage(who, "You stop tailoring."); break; endif if( !tool ) break; endif sleep(2); if( GetAmount(item1) >= material ) if( item2 != 0 && GetAmount(item2) < material2 ) SendSysMessage(who, "You do not have enough materials."); return 0; endif if( CraftCheckSkill(who, craft_skill, diff, pts) > 0 ) if( skillid2 ) if( (skill2 <= AP_GetSkill(who, skillid2)) ) theitem := CreateCraftItem(who, craft_skill, item1, item1objtype, objtype, material, itemname, reqd); else chk := -2; endif else theitem := CreateCraftItem(who, craft_skill, item1, item1objtype, objtype, material, itemname, reqd); if( theitem && theitem != 0 && !theitem.errortext ) if( item2 != 0 ) if( !SubtractAmount(item2, material2) ) DestroyItem(theitem); chk := -1; endif else CheckToolWear (who, tool, craft_skill); chk := 1; endif else chk := 0; endif endif endif endif if( chk == 0 ) SubtractAmount(item1, (material / 2)); if( material2 ) if( !SubtractAmount(item2, CInt(material2 / 2)) ) SendSysMessage(who, "You do not have enough materials."); return 0; endif endif SendSysMessage(who, "You failed to create the item, and some of your materials are lost."); counter := counter + 1; continue; endif if( chk == -1 ) SendSysMessage(who, "You do not have enough materials."); return 0; endif if( chk == -2 ) SendSysMessage(who, "You do not have the required skill."); return 0; endif theitem.movable := 1; counter := counter + 1; endwhile
return 1;
endfunction
As you will notice, i'd introduce a little change in tailoring basic products: Studded Leather now will request the presence of metal ingots in your inventory, otherwise you'll not be able to create studded material. Config files are made on the basis of carpentry.cfg and CarpMenu.cfg (respectively tailoring.cfg and TailMenu.cfg) Just and example of tailoring.cfg (in ./config): Code: tailoring 0x1efd { Name fancy shirt Skill 25.0 Difficulty 10.0 Points 10.0 Material 8 Type cloth Exceptional 1 Mark 1 Retain 1 }
... and a little example of TailMenu.cfg: Code: Craftitem Index { //Index Menus Title <center>Tailoring Selection Menu</center> Skill tailoring SkillID tailoring Group Other Group Cloth Group Leather Group Leather Armor Group Studded Armor Group Shoes }
Waiting for your judgement on this work 
|
|
| Top |
|
 |
|
tekproxy
|
Post subject: Posted: Wed Mar 07, 2007 8:04 am |
|
 |
| Distro Developer |
 |
Joined: Thu Apr 06, 2006 5:11 pm Posts: 350 Location: Nederland, Texas
|
|
Cool! I'm interested in testing this out. Can you upload it to the forums or e-mail it to me? I'll test it today.
A mod should also move this thread to the distro development forum.
|
|
| Top |
|
 |
|
Jarsil
|
Post subject: Posted: Wed Mar 07, 2007 8:54 am |
|
Joined: Fri Jan 05, 2007 6:43 am Posts: 7 Location: Latina, Italy
|
|
If you pm me your email address i'll be happy to send it to you.
I've tried to upload the zip file of the pkg but i couldn't manage to upload...
|
|
| Top |
|
 |
|
Haos
|
Post subject: Posted: Wed Mar 07, 2007 5:27 pm |
|
Joined: Thu Mar 01, 2007 4:50 pm Posts: 25
|
|
Just one thing, what is the objref of the backpack a tailor can produce? Is it the same as the character backpack at the paperdoll?
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Wed Mar 07, 2007 9:33 pm |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 750 Location: Chicago, IL USA
|
|
you mean objtype? Just look in objtypes.txt. You're probably searching for "backpack". Its a very useful text file that is generated by POL on every startup. It gives you the objtype, the name, and the pkg name of the itemdesc that contains it. If no name is specified for pkg name, its in pol/config/itemdesc
|
|
| Top |
|
 |
|
Haos
|
Post subject: Posted: Wed Mar 07, 2007 11:39 pm |
|
Joined: Thu Mar 01, 2007 4:50 pm Posts: 25
|
|
Sorry, you got me wrong. POL 096 distro contained tailoring, but in OLD directory, though they were 095 version. In this pkg, backpack that could be produced by a pc crafter, had the same objtype as a backpack at the pc paperdoll. IMO they should differ. This is why i`m asking how does it look like in your system.
|
|
| Top |
|
 |
|
Jarsil
|
Post subject: Posted: Thu Mar 08, 2007 12:08 am |
|
Joined: Fri Jan 05, 2007 6:43 am Posts: 7 Location: Latina, Italy
|
Haos wrote: Sorry, you got me wrong. POL 096 distro contained tailoring, but in OLD directory, though they were 095 version. In this pkg, backpack that could be produced by a pc crafter, had the same objtype as a backpack at the pc paperdoll. IMO they should differ. This is why i`m asking how does it look like in your system.
Actually backpacks are defined in the pkg/items/containers/config/itemdesc.cfg file.
0xe75 is the main backpack core
0x9b2 is another backpack.
Since the tailoring package search for itemdescs in :*:, it is useful to store different items in their appropriate sections, so cloth & leather items (not raw materials, but finished products) will be stored in clothing/config/itemdesc.cfg, containers (like bags and backpacks) will be in containers/config/itemdesc.cfg and so on.
Thanks to tekproxy help yesterday, i'm now working on new scripts that are part of the tailoring package, for managing all tailoring related stuffs, from working raw materials to creating finished products.
|
|
| Top |
|
 |
|
MuadDib
|
Post subject: Posted: Thu Mar 08, 2007 12:26 am |
|
 |
| POL Developer |
 |
Joined: Sun Feb 12, 2006 9:50 pm Posts: 836 Location: Indiana, USA
|
|
Didn't read the code much honestly, but if you are combining materials, then you might want to look at carp and alchemy a bit more. When multiple materials was used, I simply took advantage of the Parts ability. Now, if you are wanting the ore to affect the end result also, then you will need to customize more based on that of course. AKA, use normal method, then inside the tailoring, check for the ingots, and adjust the item based on those also. Not a big thing to do really with the base package showing how most of that is done.
Hopefully, soon, I will be able to return to core and distro work. I have had promotions at work and have been working all the overtime I can to get ahead some (once i get caught up anyway).
_________________ POL Developer - The Penguin Scripter
|
|
| Top |
|
 |
|
Haos
|
Post subject: Posted: Thu Mar 08, 2007 5:49 am |
|
Joined: Thu Mar 01, 2007 4:50 pm Posts: 25
|
|
Good to have you back MuadDib:)
Jarsil are you going to make that skill pkg public? If so, i would like to use it:) I know about the the pkg/items/containers/config/itemdesc.cfg
Again, i`m reffering to 096 distro... the script was using additional config - leather.cfg i think, with all leater items stored and being used for item creation. A backpack in that cfg file had 0xe75 objtype. That is why i asked about it.
|
|
| Top |
|
 |
|
Jarsil
|
Post subject: Posted: Thu Mar 08, 2007 6:29 am |
|
Joined: Fri Jan 05, 2007 6:43 am Posts: 7 Location: Latina, Italy
|
Haos wrote: Good to have you back MuadDib:)
Jarsil are you going to make that skill pkg public? If so, i would like to use it:) I know about the the pkg/items/containers/config/itemdesc.cfg Again, i`m reffering to 096 distro... the script was using additional config - leather.cfg i think, with all leater items stored and being used for item creation. A backpack in that cfg file had 0xe75 objtype. That is why i asked about it.
In this package there are no more leather.cfg and so.
there is an itemdesc.cfg in config with tools and raw materials, there is a scissors.cfg to cut cloth and make bandages, and there are the 2 files that make the package "like" the new crafting skills of 097 core... new craft gumps and style of menus.
I've just finished compiling the script for create cloths from raw materials (threads to bolts, bolts to cloths), to cut cloths in order to obtain bandages.
I can't upload zip files on the forum, i think... i tried yesterday withouth success.
If i can solve this problem, i'll put the package here, i'm happy to see people interested in 
|
|
| Top |
|
 |
|
tekproxy
|
Post subject: Posted: Thu Mar 08, 2007 6:32 am |
|
 |
| Distro Developer |
 |
Joined: Thu Apr 06, 2006 5:11 pm Posts: 350 Location: Nederland, Texas
|
|
| Top |
|
 |
|
Jarsil
|
Post subject: Posted: Thu Mar 08, 2007 6:42 am |
|
Joined: Fri Jan 05, 2007 6:43 am Posts: 7 Location: Latina, Italy
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 12 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|