| 赞 | 16  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 6 | 
 
| 经验 | 0 | 
 
| 最后登录 | 2024-7-10 | 
 
| 在线时间 | 73 小时 | 
 
 
 
 
 
Lv2.观梦者 
	- 梦石
 - 0 
 
        - 星屑
 - 553 
 
        - 在线时间
 - 73 小时
 
        - 注册时间
 - 2017-12-22
 
        - 帖子
 - 42
 
 
 
 | 
	
 本帖最后由 无终 于 2020-4-26 10:19 编辑  
 
找到合成的方法函数-->Scene_Synthesis.prototype.doBuy 
这个方法有一个number参数,是合成的数量. 
 
下面的语句: 
var price = number * this._item.synthCost;//price是合成所消耗的金钱,这里计算金钱消耗 
$gameParty.loseGold(price);//消耗金钱 
 
下面的for语句,统计了材料并计算了材料数量. 
$gameParty.loseItem(ingredient, quantity, false);//这一句进行了材料消耗,如果想要知道消耗了什么,需要去查看loseItem方法. 
$gameParty.gainItem(this._item, number);//这句的意思是合成成功给了玩家number数量的物品. 
 
按照楼主的需求,应该只知道number就可以了 
可以在$gameParty.gainItem(this._item, number);这句后面加两句: 
 
var itemCost = $gameVariables.value(34) + number ; //声明itemCost变量,值为34号变量的值加上number. 
$gameVariables.setValue(34, itemCost );//将34号变量设置为itemCost的值 
 
然后在游戏中提取判断34号变量的值,应该就能实现了. |   
 
 
 
 |