Szyu's Crafting System

Discussion in 'JS Plugin Releases (RMMV)' started by Szyu, Nov 4, 2015.

    Tags:
  1. Szyu

    Szyu Villager Member

    Messages:
    29
    Likes Received:
    50
    First Language:
    German
    Here is an example how to set up the notes for a Blacksmithing recipe and book:

    [​IMG]

    To call the menu, just call a plugin command "CraftingSystem open 0"
     
    #21
    ARKS STUDIO likes this.
  2. Iliketea

    Iliketea Tea lover Veteran

    Messages:
    848
    Likes Received:
    910
    Location:
    Germany
    First Language:
    German
    For the recipe book you need tp make a key item and then write in the note : 

     
    #22
  3. Szyu

    Szyu Villager Member

    Messages:
    29
    Likes Received:
    50
    First Language:
    German
    Since I got some question about how to switch between the status display and the ingredients display, here is the answer:

    While in the crafting menu, press "W" to switch to the status display and press "Q" to switch back to the ingredients display.
     
    #23
    Iliketea likes this.
  4. Iliketea

    Iliketea Tea lover Veteran

    Messages:
    848
    Likes Received:
    910
    Location:
    Germany
    First Language:
    German
    Oh nice!

    BTW, do you plan to make the recipe book usable? I mean like that you can look up all recipes you currently have in it and what indigents they need?

    That would be totally awesome.
     
    #24
    Anime_Fusion likes this.
  5. sarugaki339

    sarugaki339 Villager Member

    Messages:
    28
    Likes Received:
    3
    First Language:
    English
    Quick question; I tried pressing Q and W in the crafting menu and it does switch between ingredients and status, however in status the only thing I can see is price, I can't see weapon type equip stats, ect.
     
    #25
  6. winkr7

    winkr7 Veteran Veteran

    Messages:
    39
    Likes Received:
    7
    First Language:
    english
    Primarily Uses:
    N/A
    Hello;

    Does this plugin include crafting animations?  Like a hammer pounding metal, or a bubbling cauldron for potions?

    thanks lots.
     
    #26
  7. cropots

    cropots Veteran Veteran

    Messages:
    172
    Likes Received:
    26
    First Language:
    Portugues
    It did not work for me. The category number is what?
     
    #27
  8. Szyu

    Szyu Villager Member

    Messages:
    29
    Likes Received:
    50
    First Language:
    German
    I didn't intend to.. but perhaps I'll consider it for a newer version.

    I tried it out, but can't seem to reproduce this problem... everything will be displayed just finde.

    Nope, until now, now crafting animations.. I tried to keep it as simple as possible.

    What doesn't work for you in detail?

    The category number indicates the index of the category you define in the pluginmanager:

    "Blacksmithing, Alchemy, Cooking, Tailoring"

    Blacksmithing would be index 0

    Alchemy -> 1

    Cooking -> 2

    Tailoring -> 3
     
    #28
  9. cropots

    cropots Veteran Veteran

    Messages:
    172
    Likes Received:
    26
    First Language:
    Portugues
    I did several tests and always goes blank as shown.[​IMG]

    EDIT: I did! Thank you.
     
    Last edited by a moderator: Nov 7, 2015
    #29
  10. Szyu

    Szyu Villager Member

    Messages:
    29
    Likes Received:
    50
    First Language:
    German
    So could you tell what the problem was for reference for others please? I can't seem to reproduce how you all get these problems, so this could be helpful for the future
     
    #30
  11. Dr Anthrax

    Dr Anthrax Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    English
    Dear Szyu, I Will Be Using This Plugin in the Development of A Game Title with your permission. if you Would like to inquire about anything involving this Project Please Get Ahold of me. i just hope Both RMMV and This Plugin can handle the Intense Strain i will be putting it through.

    EDIT: i learned this doesnt work with Yanfly's Item Core and thus i will no longer be using this as it wont work with the game im making. im sorry to give up a crafting plugin, but i do say that otherwise this is still a great plugin. keep it up.
     
    Last edited by a moderator: Nov 9, 2015
    #31
  12. DBDragoner

    DBDragoner Veteran Veteran

    Messages:
    123
    Likes Received:
    89
    Location:
    USA
    Double check your recipe book spelling. It's <recipe_book>. My cousin forgot the _ and we sent several minutes racking our brains trying to figure it out.
     
    #32
  13. cropots

    cropots Veteran Veteran

    Messages:
    172
    Likes Received:
    26
    First Language:
    Portugues
    I thought it was all automatic or that the item should be consumable, but found that simply create the recipe book and once you are with him kept in inventory, revenue is enabled in NPC. Works 100% for me now, endless possibilities. Very grateful for the work.

     

    Sorry for the English, I am Brazilian.
     
    #33
  14. Jeffrey Torres

    Jeffrey Torres Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
    Just FYI, I was able to get my issue resolved. I was doing everything right but... well... It turns out there's a difference between "thinking" you've updated your plugins and "actually" updating your plugins. Go figure.

    Also, I made a modification to the layout that I'm really fond of, hope you don't mind. I'm Javascript illiterate so I feel like this took WAY longer than it should have, but, hey... I trimmed some infor off the status menu and made it permanent. The ingredients list only allows for 4 ingredients now, but that's fine for my needs.

     [​IMG]
     
    Last edited by a moderator: Nov 8, 2015
    #34
    Shinma and Iliketea like this.
  15. Addictator

    Addictator Villager Member

    Messages:
    12
    Likes Received:
    0
    First Language:
    Français
    Hi Szyu,

    I've got a big issue with your plugin.

    Everything works fine for recipes and books BUT when I save, quit then reload the game, the script is considering I got no items needed for crafting.

    I can gather these items and craft immediately, that works fine but as soon as I quit game and be back, the script is unable to read my items.

    Have you got any idea ?

    Thx a lot,

    Addictator.
     
    #35
  16. Jeffrey Torres

    Jeffrey Torres Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
    Confirmed, I'm having the exact same issue.
     
    #36
  17. sarugaki339

    sarugaki339 Villager Member

    Messages:
    28
    Likes Received:
    3
    First Language:
    English
    Saw the last post and decided to check. Mine is a bit different however. Mine just doesn't recognize my items no matter what. It says I have 0 of whatever item I need no matter how many I have, no matter if it's immediately after receiving the item or if I save and restart. No matter what, the plug in doesn't recognize those items in my inventory.
     
    #37
  18. cropots

    cropots Veteran Veteran

    Messages:
    172
    Likes Received:
    26
    First Language:
    Portugues
    I like that style could make the file available?
     
    #38
    Chaos17 likes this.
  19. Jeffrey Torres

    Jeffrey Torres Villager Member

    Messages:
    7
    Likes Received:
    2
    First Language:
    English
     I noticed it wont recognize items affected by Yanfly's scripts that add variance. Like the equipemtn scripts adds -5 to +5 to a weapons stats by default at random, and that throws things off. Not sure if it's the same with you but I'd try turning of Equipment Core and Item Core and whatever extensions and see if it works.

    My resolution is set to 960x540, and I modified the code with that resolution in mind. Like I said, I'm really not very good with Javascript...

    Code:
    //=============================================================================// CraftingSystem.js//=============================================================================/*: * @plugindesc Craft items, weapons and armors based on categorized recipe books. * @author Julian "Szyu" Heinen * * @param Categories * @desc The names of the categories. * @default Blacksmith, Alchemy *  * @param Price Text * @desc Text used for item's price in status display  * @default Price *  * @param Equip Text * @desc Text used for item's equipment type in status display  * @default Equip *  * @param Type Text * @desc Text used for item's equipment type in status display  * @default Type *  * @param Ingredients Text * @desc Text used for indicating an item's crafting ingredients * @default Ingredients: *  * @param Currency Text * @desc Text used for currency ingredients * @default Currency *  * @param Item Crafted Text * @desc Text used after crafting an item * @default Item crafted: *  * * @help *   * Plugin Command: *   CraftingSystem open 0    		# Opens the crafting scene for category #0 *   CraftingSystem add_recipe 5: w3		# Adds the recipe of weapon #3 to recipe book #5 *   CraftingSystem remove_recipe 5: a1	# Removes the recipe of armor #1 from recipe book #5 * * Defining recipes for items, weapons and armors in their notes: *    <recipe> *    i: 1, 5	# requires 5 of item #1 *    w: 3, 2	# requires 2 of weapon #3 *    a: 2, 5	# requires 5 of armor #2 *    c: 1000	# requires 1000 of currency *    </recipe> * * Defining recipe books (only items) in their notes: *    <recipe_book> *    category: x	# recipe book is of category #x *    i: 1, 3, 4	# recipe book contains the recipes of items #1, #3 and #4 *    w: 3 		# recipe book contains the recipes of weapon #3 *    a: 2, 1 		# recipe book contains the recipes of armors #1 and #2 *    </recipe_book> * */ (function(){	var parameters = PluginManager.parameters('CraftingSystem');	var categories = parameters['Categories'].replace(/^\s+|\s+$/gm,'').split(',') || ['Blacksmithing', 'Alchemy'];	var priceText = String(parameters['Price Text'] || 'Price');    var equipText = String(parameters['Equip Text'] || 'Equip');    var typeText = String(parameters['Type Text'] || 'Type');    var ingredientsText = String(parameters['Ingredients Text'] || 'Ingredients:');	var currencyText = String(parameters['Currency Text'] || 'Currency');	var itemCraftedText = String(parameters['Item Crafted Text'] || 'Item crafted:');	/*----------------------------------------------	* Game_Interpreter	*---------------------------------------------*/	var _szcrsy_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;	Game_Interpreter.prototype.pluginCommand = function(command, args){		_szcrsy_Game_Interpreter_pluginCommand.call(this, command, args);		console.log(categories);		console.log(priceText);		console.log(equipText);		console.log(typeText);		console.log(ingredientsText);		console.log(currencyText);		console.log(itemCraftedText);		if (command == 'CraftingSystem'){			switch (args[0]){				case 'open':					SceneManager.push(Scene_CraftingMenu)					SceneManager.prepareNextScene(args[1])					break;				case 'add_recipe':					this.addRecipes(args.splice(1,args.length-1));					break;				case 'remove_recipe':					this.removeRecipes(args.splice(1,args.length-1));					break;			}		}	};		Game_Interpreter.prototype.addRecipes = function(args){		var book = $dataItems[parseInt(args[0])];		var item;		var regex;		if (book._recipe_book == null) return;		for (var i=1;i<args.length;i++){			regex = args[i].match(/([iwa])(\d+)/i);			switch (regex[1]){				case 'i': item = $dataItems[parseInt(regex[2])]; break;				case 'w': item = $dataWeapons[parseInt(regex[2])]; break;				case 'a': item = $dataArmors[parseInt(regex[2])]; break;			}			if (item._ingredients == null) continue;			if (book._recipe_book['recipes'].filter(function(obj){return obj == item;}).length > 0) continue;			book._recipe_book['recipes'].push(item)		}	}	Game_Interpreter.prototype.removeRecipes = function(args){		var book = $dataItems[parseInt(args[0])];		var item;		var regex;		if (book._recipe_book == null) return;		for (var i=1;i<args.length;i++){			regex = args[i].match(/([iwa])(\d+)/i);			switch (regex[1]){				case 'i': item = $dataItems[parseInt(regex[2])]; break;				case 'w': item = $dataWeapons[parseInt(regex[2])]; break;				case 'a': item = $dataArmors[parseInt(regex[2])]; break;			}			if (item._ingredients == null) continue;			if (book._recipe_book['recipes'].filter(function(obj){return obj == item;}).length == 0) continue;			book._recipe_book['recipes'].splice(book._recipe_book['recipes'].indexOf(item), 1);		}	}	/*----------------------------------------------	* DataManager	*---------------------------------------------*/	var _szcrsy_DataManager_createGameObjects = DataManager.createGameObjects;	DataManager.createGameObjects = function() {		_szcrsy_DataManager_createGameObjects.call(this);		// Create recipe book object		this.load_recipeBooks();		this.load_ingredientLists();	}	DataManager.load_recipeBooks = function() {		$dataItems.forEach(function(item){			if (item == null) {return;}			item._recipe_book = null;			if (item.note.match(/<recipe_book>[\s\S]*<\/recipe_book>/m)){				item._recipe_book = {'recipes':[]};				var cat;				// check if category is correct				if ((cat = item.note.match(/category:\s*(\d+)/m))){					item._recipe_book['category'] = parseInt(cat[1]);					//now item is sure to be a recipe book with correct category					var rec;					var db;					item.note.match(/([iwa]:\s*[\d+,\s]*)/gim).forEach(function(recipe_line){						rec = recipe_line.match(/([iwa]):\s*([\d+,\s]*)/i);						switch (rec[1]){							case 'w': db = $dataWeapons; break;							case 'a': db = $dataArmors; break;							case 'i': db = $dataItems; break;						}						rec[2].split(',').forEach(function(id){							item._recipe_book['recipes'].push(db[parseInt(id)]);						}, this);					}, this);				}			}		}, this);	}	DataManager.load_ingredientLists = function(){		var dbs = [$dataItems, $dataWeapons, $dataArmors];		dbs.forEach(function(db){			db.filter(function(obj){return obj != null;}).forEach(function(item){				item._ingredients = null;				if (item.note.match(/<recipe>[\s\S]*<\/recipe>/gim)){					item._ingredients = [];					item.note.match(/([iwa]:\s*\d+,\s*\d+|[c]:\s*\d+)/gim).forEach(function(ing_line){						var ing = ing_line.match(/([iwa]):\s*(\d+),\s*(\d+)|([c]):\s*(\d+)/i);						var ing_db;						var needed;						if (ing[1] != null){							switch (ing[1]){								case 'w': ing_db = $dataWeapons[parseInt(ing[2])]; break;								case 'a': ing_db = $dataArmors[parseInt(ing[2])]; break;								case 'i': ing_db = $dataItems[parseInt(ing[2])]; break;							}						} else {							if (ing[4] == 'c'){								ing_db = currencyText;							}						}						if (ing_db == currencyText){							needed = parseInt(ing[5]);						} else {							needed = parseInt(ing[3]);						}						item._ingredients.push({'item': ing_db, 'amount':needed});					},this);				}			},this);		},this);	}	var _szcrsy_DataManager_makeSaveContents = DataManager.makeSaveContents;	DataManager.makeSaveContents = function() {	    // A save data does not contain $gameTemp, $gameMessage, and $gameTroop.	    var contents = _szcrsy_DataManager_makeSaveContents.call(this);	    var recipe_books = {};	    $dataItems.filter(function(item){return item != null && item._recipe_book != null;}).forEach(function(item){	    	recipe_books[item.id] = item._recipe_book;	    },this);	    contents.recipe_books       = recipe_books;	    return contents;	};	var _szcrsy_DataManager_extractSaveContents = DataManager.extractSaveContents;	DataManager.extractSaveContents = function(contents) {		_szcrsy_DataManager_extractSaveContents.call(this, contents);		var recipe_books = contents.recipe_books;		for (var key in recipe_books){			$dataItems[key]._recipe_book = recipe_books[key];		}	};	/*----------------------------------------------	* Scene_CraftingMenu	*---------------------------------------------*/	function Scene_CraftingMenu() {		this.initialize.apply(this, arguments);	}		Scene_CraftingMenu.prototype = Object.create(Scene_MenuBase.prototype);	Scene_CraftingMenu.prototype.constructor = Scene_CraftingMenu;		Scene_CraftingMenu.prototype.initialize = function(){		Scene_MenuBase.prototype.initialize.call(this);	};		Scene_CraftingMenu.prototype.prepare = function(category) {		this._category = category;	};		Scene_CraftingMenu.prototype.create = function(){		Scene_MenuBase.prototype.create.call(this);		// Create category window		this._categoryWindow = new Window_CraftingCategory(this._category);		this.addWindow(this._categoryWindow);		// Create item window		this._indexWindow = new Window_CraftingItems(0, this._categoryWindow.height, this._category);		this._indexWindow.setHandler('cancel', this.popScene.bind(this));		this._indexWindow.setHandler('ok', this.onCraft.bind(this));		this.addWindow(this._indexWindow);		// Create Item Status Window		var swy = this._indexWindow.y+this._indexWindow.height;		this._statusWindow = new Window_CraftingItemStatus(320,this._categoryWindow.height, 640, 234);		this.addWindow(this._statusWindow);		this._indexWindow.setStatusWindow(this._statusWindow);		// Create Item Ingredients window		this._ingredientsWindow = new Window_CraftingIngredients(320,this._categoryWindow.height+234, 640, 234);		this.addWindow(this._ingredientsWindow);		this._indexWindow.setIngredientsWindow(this._ingredientsWindow);		//this._indexWindow.setHandler('pagedown', this.showStatus.bind(this)); // W				this._messageWindow = new Window_Message();		this.addWindow(this._messageWindow);	    this._messageWindow.subWindows().forEach(function(window) {	        this.addWindow(window);	    }, this);		this._activeWindow = 0;	};	Scene_CraftingMenu.prototype.onCraft = function(){		$gameParty.gainItem(this._indexWindow.item(), 1);		this.loseIngredients();		// Show gain item Message		$gameMessage.setBackground(0);        $gameMessage.setPositionType(1);		$gameMessage.add(itemCraftedText+'\n' + this._indexWindow.item().name);	};/*	Scene_CraftingMenu.prototype.showStatus = function(){		if (this._activeWindow !== 1){			var sw = this._statusWindow;			var iw = this._ingredientsWindow;			iw.move(Graphics.boxWidth,iw.y, iw.width, iw.height);			sw.move(0, sw.y, sw.width, sw.height);			this._activeWindow = 1;			this._indexWindow.setHandler('pageup', this.showIngredients.bind(this)); // Q			delete this._indexWindow._handlers['pagedown'];		}		this._indexWindow.activate();	};	Scene_CraftingMenu.prototype.showIngredients = function(){		if (this._activeWindow !== 0){			var sw = this._statusWindow;			var iw = this._ingredientsWindow;			sw.move(-Graphics.boxWidth, sw.y, sw.width, sw.height);			iw.move(0,iw.y, iw.width, iw.height);			this._activeWindow = 0;			this._indexWindow.setHandler('pagedown', this.showStatus.bind(this)); // W			delete this._indexWindow._handlers['pageup'];		}		this._indexWindow.activate();	};*/	Scene_CraftingMenu.prototype.loseIngredients = function(){		var item = this._indexWindow.item();       	var ing;       	var db;       	var needed;       	item._ingredients.forEach(function(ing){       		needed = ing['amount'];       		if (ing['item'] == currencyText){       			$gameParty.loseGold(needed);       		} else {       			$gameParty.loseItem(ing['item'], needed);       		}       	}, this);		this._ingredientsWindow.refresh();	};		/*----------------------------------------------	* Window_CraftingCategory	*---------------------------------------------*/	function Window_CraftingCategory(){		this.initialize.apply(this, arguments);	}	Window_CraftingCategory.prototype = Object.create(Window_Base.prototype);	Window_CraftingCategory.prototype.constructor = Window_CraftingCategory;	Window_CraftingCategory.prototype.initialize = function(category) {		this._category = category;		Window_Base.prototype.initialize.call(this, 0,0,Graphics.boxWidth, this.fittingHeight(1));		this.refresh();	};	Window_CraftingCategory.prototype.refresh = function(){		this.drawText(categories[this._category], 0,0,this.contents.width, this.lineHeight(), 'center');	};		/*----------------------------------------------	* Window_CraftingItems	*---------------------------------------------*/	function Window_CraftingItems(){		this.initialize.apply(this, arguments);	}		Window_CraftingItems.prototype = Object.create(Window_Selectable.prototype);	Window_CraftingItems.prototype.constructor = Window_CraftingItems;		Window_CraftingItems.lastTopRow = 0;    Window_CraftingItems.lastIndex  = 0;		Window_CraftingItems.prototype.initialize = function(x,y, category) {		var width = 320;		var height = 468; //this.fittingHeight(4);		this._category = parseInt(category);		Window_Selectable.prototype.initialize.call(this, x,y,width, height);		this.refresh();		this.setTopRow(Window_CraftingItems.lastTopRow);        this.select(Window_CraftingItems.lastIndex);        this.activate();	};		Window_CraftingItems.prototype.maxCols = function(){		return 1;	};		Window_CraftingItems.prototype.maxItems = function(){		return this._list ? this._list.length : 0;	};		Window_CraftingItems.prototype.setStatusWindow = function(statusWindow) {        this._statusWindow = statusWindow;        this.updateStatus();    };		Window_CraftingItems.prototype.setIngredientsWindow = function(ingredientsWindow) {        this._ingredientsWindow = ingredientsWindow;        this.updateIngredients();    };		Window_CraftingItems.prototype.update = function(){		if (!$gameMessage.isBusy()){			Window_Selectable.prototype.update.call(this);			this.updateStatus();			this.updateIngredients();		}	};	Window_CraftingItems.prototype.updateStatus = function() {        if (this._statusWindow) {            var item = this._list[this.index()];            this._statusWindow.setItem(item);        }    };    Window_CraftingItems.prototype.updateIngredients = function() {        if (this._ingredientsWindow) {            var item = this._list[this.index()];            this._ingredientsWindow.setItem(item);        }    };		Window_CraftingItems.prototype.refresh = function(){		var i, item;		var cat, c2;		this._list = [];		cat = parseInt(this._category);		$gameParty.allItems().filter(function(item){			return item._recipe_book != null && cat === parseInt(item._recipe_book['category']);		}).forEach(function(item){			item._recipe_book.recipes.forEach(function(rec_item){				this._list.push(rec_item);			},this);		}, this);;				this.createContents();		this.drawAllItems();	};		Window_CraftingItems.prototype.drawItem = function(index){		var item = this._list[index];		var rect = this.itemRect(index);		var width = rect.width - this.textPadding();		this.drawItemName(item, rect.x, rect.y, width);	};		Window_CraftingItems.prototype.processCancel = function(){		Window_Selectable.prototype.processCancel.call(this);		Window_CraftingItems.lastTopRow = this.topRow();        Window_CraftingItems.lastIndex = this.index();	};	Window_CraftingItems.prototype.processOk = function() {	    if (this.itemIngredientsMet()) {	        this.playOkSound();	        this.updateInputData();	        this.callOkHandler();	    } else {	        this.playBuzzerSound();	    }	};	Window_CraftingItems.prototype.item = function() {    	var index = this.index();    	return this._list && index >= 0 ? this._list[index] : null;     };		Window_CraftingItems.prototype.itemIngredientsMet = function(){		var item = this.item();		var met = true;		if (item == null) return false;		var existingCount = 0, needed = 0;		item._ingredients.forEach(function(ing){			needed = ing['amount'];			if (ing['item'] == currencyText){				existingCount = $gameParty.gold();			}			else{				existingCount = $gameParty.numItems(ing['item']);			}			//console.log('ex: ' + existingCount + '; needed: ' + needed + '; RESULT: ' + (existingCount < needed));			if (existingCount < needed){				met = false;			}		}, this);		return met;	};	/*----------------------------------------------	* Window_CraftingItemStatus	*---------------------------------------------*/	function Window_CraftingItemStatus() {        this.initialize.apply(this, arguments);    }    Window_CraftingItemStatus.prototype = Object.create(Window_Base.prototype);    Window_CraftingItemStatus.prototype.constructor = Window_CraftingItemStatus;    Window_CraftingItemStatus.prototype.initialize = function(x, y, width, height) {        Window_Base.prototype.initialize.call(this, x, y, width, height);    };    Window_CraftingItemStatus.prototype.setItem = function(item) {        if (this._item !== item) {            this._item = item;            this.refresh();        }    };    Window_CraftingItemStatus.prototype.refresh = function() {    	var item = this._item;        var x = 0;        var y = 0;        var lineHeight = this.lineHeight();        this.contents.clear();        this.drawItemName(item, x, y);        x = this.textPadding();        y = lineHeight + this.textPadding();        var price = item.price > 0 ? item.price : '-';        this.changeTextColor(this.systemColor());        this.drawText(priceText, x, y, 120);        this.resetTextColor();        this.drawText(price, x + 120, y, 120, 'right');        y += lineHeight;        if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {            var etype = $dataSystem.equipTypes[item.etypeId];            this.changeTextColor(this.systemColor());            this.drawText(equipText, x, y, 120);            this.resetTextColor();            this.drawText(etype, x + 120, y, 120, 'right');            y += lineHeight;            var type;            if (DataManager.isWeapon(item)) {                type = $dataSystem.weaponTypes[item.wtypeId];            } else {                type = $dataSystem.armorTypes[item.atypeId];            }            this.changeTextColor(this.systemColor());            this.drawText(typeText, x, y, 120);            this.resetTextColor();            this.drawText(type, x + 120, y, 120, 'right');            x = this.textPadding() + 300;            y = lineHeight + this.textPadding();            for (var i = 2; i < 6; i++) {                this.changeTextColor(this.systemColor());                this.drawText(TextManager.param(i), x, y, 160);                this.resetTextColor();                this.drawText(item.params[i], x + 160, y, 60, 'right');                y += lineHeight;            }        }        /*x = 0;        y = this.textPadding() * 2 + lineHeight * 7;        this.drawTextEx(item.description, x, y);        /*var item = this._item;        var x = 0;        var y = 0;        var lineHeight = this.lineHeight();        this.contents.clear();        this.drawItemName(item, x, y);        x = this.textPadding();        y = lineHeight + this.textPadding();        var price = item.price > 0 ? item.price : '-';        this.changeTextColor(this.systemColor());        this.drawText(priceText, x, y, 120);        this.resetTextColor();        this.drawText(price, x + 120, y, 120, 'right');        y += lineHeight;        if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {            var etype = $dataSystem.equipTypes[item.etypeId];            this.changeTextColor(this.systemColor());            this.drawText(equipText, x, y, 120);            this.resetTextColor();            this.drawText(etype, x + 120, y, 120, 'right');            y += lineHeight;            var type;            if (DataManager.isWeapon(item)) {                type = $dataSystem.weaponTypes[item.wtypeId];            } else {                type = $dataSystem.armorTypes[item.atypeId];            }            this.changeTextColor(this.systemColor());            this.drawText(typeText, x, y, 120);            this.resetTextColor();            this.drawText(type, x + 120, y, 120, 'right');            x = this.textPadding() + 300;            y = lineHeight + this.textPadding();            for (var i = 2; i < 8; i++) {                this.changeTextColor(this.systemColor());                this.drawText(TextManager.param(i), x, y, 160);                this.resetTextColor();                this.drawText(item.params[i], x + 160, y, 60, 'right');                y += lineHeight;            }        }        x = 0;        y = this.textPadding() * 2 + lineHeight * 7;        this.drawTextEx(item.description, x, y);*/    };    /*----------------------------------------------	* Window_CraftingIngredients	*---------------------------------------------*/	function Window_CraftingIngredients() {        this.initialize.apply(this, arguments);    }    Window_CraftingIngredients.prototype = Object.create(Window_Base.prototype);    Window_CraftingIngredients.prototype.constructor = Window_CraftingIngredients;    Window_CraftingIngredients.prototype.initialize = function(x,y,width, height){    	Window_Base.prototype.initialize.call(this, x,y,width, height);    }    Window_CraftingIngredients.prototype.setItem = function(item) {        if (this._item !== item) {            this._item = item;            this.refresh();        }    };    Window_CraftingIngredients.prototype.refresh = function(){    	this.contents.clear();    	var x=0;    	var y=0;    	var lineHeight = this.lineHeight();    	var width = this.contents.width - this.textPadding() * 2;    	var existingCount = 0, needed = 0;    	this.changeTextColor(this.systemColor());		this.drawText(ingredientsText, x, y, width);		this.resetTextColor();		this._item._ingredients.forEach(function(ing){			y += lineHeight;			needed = ing['amount'];			if (ing['item'] == currencyText){				existingCount = $gameParty.gold();				this.drawText(ing['item'], x, y, width);			}			else{				existingCount = $gameParty.numItems(ing['item']);				this.drawItemName(ing['item'], x, y, width);			}			this.drawText('/' + needed, x, y, width, 'right');			if (existingCount < needed) 				this.changeTextColor(this.crisisColor());			else 				this.changeTextColor(this.powerUpColor());			this.drawText(existingCount, x, y, width-this.textWidth('/' + needed), 'right');			this.resetTextColor();		}, this);    }})();
     
    #39
  20. Addictator

    Addictator Villager Member

    Messages:
    12
    Likes Received:
    0
    First Language:
    Français
    Hi guys,

    I made a few tests, I can reproduce your error sarugaki339. Nothing works if you don't start a new game with script ON (on a load game it won't works).

    Try to give your main actor book and items needed for recipes on a new game common event and try crafting, it should works.

    It works too if you give books later but crafting items disappear after disconnecting.

    I'm actually trying to remove ALL scripts but Szyu's one but I think it's coding problem, probably Data recording problem.

    I'll try to add new recipe books to see how the script reacts.

    Have a nice rpg making ;)
     
    Last edited by a moderator: Nov 8, 2015
    #40

Share This Page