Page 1 of 2

receipt based crafting system (Idea + Script)

Posted: 04 Jan 2007, 19:06
by Peacemaker
I've been thinking of a creation system without skills using a NPC. I believe there are a lot of thinks which are more important than a real skill based creation system. - And a possible temporary solution might be a receipt based system using a NPC.

Here is a list of possible materials and actions.
- add metal (1)
- add wood (2)
- add stone (3)
- add feathers (4)
- add leather (5)
- add woll (6)
- (heat up) (7)
- (cool down) (8 )
- (hammer it) (9)
- (carve it) (10)
- (sharp it) (11)
- I'm finished!


Receipt 1: Creation of a knife (1)
- (heat up)
- add metal
- (hammer it)
- (cool down)

Receipt 2: Creation of a dagger (1)
- (heat up)
- add metal
- (hammer it)
- (cool down)
- (sharp it)

Receipt 3: Creation of basic arrows (100)
- add wood
- (carve it)
- add feathers

Receipt 4: Creation of better arrows (100)
- add stone
- (hammer it)
- add wood
- (carve it)
- add feathers


Info
If the player is using items in a wrong order or is using the false material all the used materials get lost. Action like "heat up" requires SP Points... So the players have to recover a bit. The creation of better items requires more materials and more steps.


NPC Example:
- Hello, what would you like to do?
- - Sword
- - - Step 1
- - - - (heat up)
- - - Step 2
- - - - add metal
- - - Step 3
- - - - (hammer it)
- - - Step 4
- - - - (cool down)
- - - Step 5
- - - - I'm finished!
- - - - You got a knife...
- - Arrows
- - Armor


How the player can get materials?
Currently I've been thinking of two possibilities:
1. "<Materialname> NPC". That's could a NPC with NO human graphic (-> a tree, a stone, ...). It should be just talk able to get (free!) materials if you own a saw/pickaxe/... Getting material decrease SP a bit...
2. Drop of monsters... of course, rare materials should be just dropped by monsters.

To prevent the usage of macros to get a lot of crafting materials we can increase the material weight of "one unit of metal" to 5000 or something heavy. wood=2000,... that must be balanced and I've not been thinking about that.

Why increasing the weight to a high number? - Because the player should not be able to get 100 units of material to craft 100 daggers... That also prevents the crafting of super strong weapons... because the total of weight is more than the player can carry to the crafting NPC.


Scripting
First of all I though it would be impossible to do that in the tmw scripting language because it would be very complex... multiple goto's for every receipt, step and material... Fortunately I managed to get it very short. As you will see, the list of possible materials and actions includes Numbers.

Every material and action symbolise a digit from 0 to 99.

Code: Select all

// Init
UNIQUENUMER = 0;
MULTIPLICATOR = 1;

// every time you do something
UNIQUENUMER = UNIQUENUMER + MULTIPLICATOR * ITEMNUMBER;		// add the Itemnumber with an offset to the Number
MULTIPLICATOR = MULTIPLICATOR * 100;		// increse the multiplicator for the next digits
As you will see the crafting system is theoretical working (in my offline tests)...
Possible problem: I don't know how big the number in the script can be???

Receipt 1: Creation of a knife -> 08090107
Receipt 2: Creation of a dagger -> 1108090107
Receipt 3: Creation of basic arrows -> 100204
Receipt 4: Creation of better arrows -> 1002040903


Script
I have never done a script for tmw before and its only tested on a piece of paper ;).

Info: heal 0, -10; should decrease SP but I don't know if its allowed to put a negative number in that function... I even don't know if the calculations are working THAT way.

Feel free to modify and use the script

EDIT: see topic below...

Scripts are more or less finished!

Posted: 06 Jan 2007, 17:19
by Peacemaker
Today I set up a private server and try to get everything working!

... And its working! ;) I've been working the whole day, the result is nearly a complete working forging system. Only the material items, NPC graphics and farming items (saw, pickaxe, lumberjack axe,...) are missing (these items just supposed to be in the inventory! -> one graphic).

To make everything more interesting I'm made a dynamic menu. Example: "ADD metal" -> "HEAT the raw metal" -> "HAMMER the glowing metal" -> "COOL down the hammered metal" -> "SHARP the cooled metal" -> "put everything together" -> you forged a DAGGER ...

btw. Any action decrease the health (HP) of the player. I thought that would make sense because its hard work... of course the value is currently to low because my testing character is just lvl0 :D

Unfortunately the crafting system only works with receipts of 5 steps... thats because the script is using signed int for numbers...
My workaround with a number or char array doesnt work the way I like... so I kept the 5-step solution...

And finally, sorry about my bad english ;)

Blacksmith
Contains everything to forge weapon... the some commands are commented because the material items are not in game ;). That NPC can be easily rewritten to an alchemist or something else...
http://www.rainbowsix.org/temp/tmw/scri ... ksmith.txt

Blacksmith Trainee
Thats the forging help... He tells the basics.
http://www.rainbowsix.org/temp/tmw/scri ... rainee.txt

Material NPC's
These NPCs supposed to have other graphic (no human because they are just crafting materials). Maybe its possible to add an NPC without graphic at all or a fully transparent one? That would make it possible to add the NPC to existing stones, trees, mines,...
http://www.rainbowsix.org/temp/tmw/scri ... _metal.txt
http://www.rainbowsix.org/temp/tmw/scri ... l_wood.txt
http://www.rainbowsix.org/temp/tmw/scri ... _stone.txt

Posted: 06 Jan 2007, 18:44
by Dr Wahl
i would love to see some kind of forging system in the mainstream version of TMW. Do you have any interesting screenshots to share with us? or is it mostly just a working scripts without any graphics?

Posted: 06 Jan 2007, 19:31
by Peacemaker
Dr Wahl wrote:i would love to see some kind of forging system in the mainstream version of TMW. Do you have any interesting screenshots to share with us? or is it mostly just a working scripts without any graphics?
I updated the scripts and updated the graphics of the npc's...

EDIT: Links deleted...

As you will see the material NPC "Stone", "Metal" and "Wood" has transparent graphics so I can put it over other objects in the world... for example on a wall in the mine or at a tree in the woodland...

Whats missing?
  • inventory graphics for the material
  • inventory graphics for the "quest items" you need to get materials... at least a saw, a pickaxe, and a lumberjack axe (they might be already done -> wiki)
  • materials and "quest items" must be added as items to the game
  • fill in the item_ids of the materials and "quest items" into the scripts
  • put the script to nice places in the world

Posted: 07 Jan 2007, 11:56
by Crush
We could place the new npc's in the new woodland village that is going to be released, soon.

I also think that we should have new weapons that are created by crafting.

Posted: 07 Jan 2007, 13:08
by ElvenProgrammer
You could use the raw wood log as wood. It should be already included in TMW graphics.

Posted: 07 Jan 2007, 13:39
by Crush
New weapon icons:
Image Image
more "rough" versions of the sharp knive and the dagger that look more like they are made by an amateur.

materials:
Image Image Image
The log is an old graphic, the iron ore and stones are new.

tools:
Image Image Image


Anything I forgot?

Posted: 07 Jan 2007, 14:15
by Peacemaker
Crush wrote:We could place the new npc's in the new woodland village that is going to be released, soon.

I also think that we should have new weapons that are created by crafting.
that sounds interesting :)

I really like the new items :)

After brainstorming about the system yesterday evening I was dissatisfied with it...

Problem#1: First of all I'm of the opinion that the "ADD <material>" and "DO <action>" list would be much to long. The current system allows 99!!! materials/actions at only one NPC... That limits the max. crafting steps to 5 because the script is working with signed int (-2.147.483.647 to +2.147.483.647) variables.

Solution#1.1?: Sure for longer receipts I can also put a second variable into the script or an array... but that makes the script too complex. -> bad

Solution#1.2?: So, I'm currently thinking of dividing the crafting system into 4+ independent NPCs (Blacksmith, Tailor, Huntsmen and Alchemist). That make more sense because the current blacksmith will never work with wool and he will never sew something...
To increase the crafting step I'm thinking of limiting the list of materials and actions to 10 (which means they need just one digit and that means I can include receipt using 9 steps).

Here is the short list of materials and actions... First of all I made a list of many additional items like a chain, sword grip, wool filament, iron filament, iron plate, ... To make it a bit more easy I "invented" a wooden/iron/sewing... kits which should include all the small things at once (like filament, plates, chains, sword grips, bow string, ... )...

I also thinking that the stone material is not good... ok you can use it as the head of an arrow and maybe for an axe... but thats all...

Code: Select all

Blacksmith
	ADD:		iron, silver, gold, platin, wooden kit
	ACTIONS:	heat, cool, hammer, sharp, form
	->			knife, dagger, small sword, iron plate, iron filament, chain, heavy armor, ...

Tailor (unfinished)
	ADD:		wool, textile, leather kit, iron kit, ???
	ACTIONS:	wash, cut, weave, sew, color (just one color!!!)
	->			textile, shirts, jeans, reinforced armor, ...

Huntsmen
	ADD:		wood, leather, skin, iron kit, sewing kit
	ACTIONS:	hammer, slice, sharp, carve, sew
	->			leather, bow, wooden arrow, iron arrow, light armor, ...

Alchemist (unfinished)
	ADD:		meat, herbs, fruits, powder, substances
	ACTIONS:	heat, oxidize, stir, shake, mesh
	->			powder, potions, bottle, ...
Especially the alchemist has materials which are very general... In that case I can put a submenu in it to select one of different alternatives. For example: powder is equal to: 5*powder1 or 3*powder2 or 1*powder3 ...

In the next days I'll concentrate on the Blacksmith and the Huntsmen.



Problem#2:
It's illogical that the player only has the ability to get wood from predefined "NPC" trees because the woodland maps are full of trees... That only work for rare iron, herbs or something else...

Solution#2.1?:
So those kinds of material make more sense to buy directly at a lumberjack... That kind of human NPC would fit perfectly into the woodland village.



Problem#3:
Currently the material NPC gives you only one material at once. But the player may drop it and get another one, and so on... at the end the player is able to have more materials than planned...

Solution#3.1?:
As already told we could make the material very heavy so a player can just carry one or two at once...

Solution#3.2?:
Thats just an idea for the future... NPCs should sell them too... At least rare material should be just buyable. Another idea would be a donation system. The player can donate money to the "living tree/stone/wall/..." and the being allows the player to get material. The amount is depending of the donation with a bit of random. (remembers me to Zelda3)

Posted: 07 Jan 2007, 14:56
by Crush
You shouldn't rush things. I would suggest you to start small, try it out in the field, see how well it works, and add more posibilities later.

Also you shouldn't invest too much time and energy into this. When the new server is finished we can't use the old scripts anymore because we will use a different scripting language.

Posted: 07 Jan 2007, 17:08
by Peacemaker
Crush wrote:You shouldn't rush things. I would suggest you to start small, try it out in the field, see how well it works, and add more posibilities later.

Also you shouldn't invest too much time and energy into this. When the new server is finished we can't use the old scripts any more because we will use a different scripting language.
ok, I'll stop now ;)

Update possible crafting steps increased to 9. -> that means the player can use 5 materials (0-4) and do 5 actions (5-9)

Blacksmith
-> allows to craft the "sharp knife" and the "dagger"
http://www.rainbowsix.org/temp/tmw/scri ... ksmith.txt

Blacksmith Trainee
http://www.rainbowsix.org/temp/tmw/scri ... rainee.txt

Huntsmen
-> allows to craft the "150 standard arrows"
http://www.rainbowsix.org/temp/tmw/scri ... ntsmen.txt

Material NPC's
http://www.rainbowsix.org/temp/tmw/scri ... l_iron.txt
http://www.rainbowsix.org/temp/tmw/scri ... l_wood.txt
http://www.rainbowsix.org/temp/tmw/scri ... _stone.txt

for testing...
that npc just gives the player all three tools... just for testing ;)
http://www.rainbowsix.org/temp/tmw/scri ... l_tool.txt

item data:
http://www.rainbowsix.org/temp/tmw/scri ... tem_db.txt
http://www.rainbowsix.org/temp/tmw/scri ... /items.xml

Info
1. You can get the receipt for the sharp knife from the trainee... No one tells the receipt for the dagger and the arrows in-game... We can hide two simple pieces of paper somewhere on the ground (->"Receipt NPCs") which tells the receipts...
2. stones are not used yet...
3. the shopkeeper should sell the tools...
4. "new" knife and dagger graphics are not included yet... I don't know how strong they are supposed to be...

Posted: 07 Jan 2007, 17:10
by Crush
Could you please post a list of all necessary item graphics?

Posted: 07 Jan 2007, 17:50
by Peacemaker
Blacksmith and Huntsmen:
  • raw log (done)
  • raw stone (done)
  • raw iron (done)
  • raw leather
  • raw skin/fur
  • Iron-Kit
  • Sewing-Kit
  • Leather-Kit
  • feathers (I'm not clear about the feathers because it can be also stored in a kit...)
I'm using the kits to describe many small things like strings, filaments, grips, plates, feathers... made out of the material... that's easier to script and just needs one graphic (maybe a different colored bag or box?) ;)

The Tailor needs the following (but thats NOT important because the NPC isn't done yet):
  • raw wool
  • textile
silver, gold, platin is included in the blacksmith script but I have no plans for that, because we have currently nothing to make out of it... I might exchange them to "raw log" (to heat the fire), "Sewing-Kit" and "Leather-Kit" ...

Posted: 08 Jan 2007, 14:36
by ElvenProgrammer
You should already have snake skin and white fur if they're of any interest

Posted: 08 Jan 2007, 14:39
by Crush
Could you please describe a bit more precise how the iron kit, leather kit and sewing kit should look?

Would a hammer for iron, a special scissor for leather and a sewing needle with thread be sufficient?

Posted: 08 Jan 2007, 15:34
by Peacemaker
I've found the fur but it looks more like wool, so I used it as wool ;)
Crush wrote:Would a hammer for iron, a special scissor for leather and a sewing needle with thread be sufficient?
Iron-Kit: an arrow head (triangle), a plate (square or rectangle), chain, nail or something. A hammer doent fit because there is nothing in that kit which needs to be rebuild.

Leather-Kit: a piece of leather, leather filaments, leather cord,... I believe a piece of leather and small piece of cord would be enough...

Sewing-Kit: a "sewing needle with thread" would fit perfectly.

here is a chart i made for showing the processes. I think thats better than text...
Image