赞 | 0 |
VIP | 19 |
好人卡 | 4 |
积分 | 1 |
经验 | 13972 |
最后登录 | 2017-7-16 |
在线时间 | 192 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 192 小时
- 注册时间
- 2010-8-23
- 帖子
- 161
|
3楼
楼主 |
发表于 2013-6-8 15:37:51
|
只看该作者
本帖最后由 512195574 于 2013-6-9 14:51 编辑
存档不能 发表于 2013-6-8 15:12
不知道这个脚本是否适用于物品上限不同的情况?
这样就应该可以了,其实还可以加入参数确定下限,这样可以只记录或者得到一部分的物品……不管那样参数就要有8个了,还不如分成三条指令= =- =begin
- ===============================================================================
- 多个背包函数脚本……v1.01(请原谅我的语文水平)
- 作者:512195574
- 调用方法:
- @shanxian = n(n表示物品数量的上限)
- get_allthing(c1,c2,c3,j,d)
- give_allthing(c1,c2,c3,j)
- c:数参,取得物品ID的上限,如果全部取得的话取数据库里的最大值就好了(1,2,3分别代表物品、武器、防具的上限)
- j:数参,背包名称,因为是第一版所以只做了三个,适用范围1~3
- d:布尔参,true/false,是否清空,true时可以在取得物品数据的同时清空取得的物品
- ===============================================================================
- =end
- def get_allthing(c1,c2,c3,j,d)
- if j == 1
- @itempack1 = []
- @weaponpack1 = []
- @armorpack1 = []
- for i in 0..c1
- @itempack1[i]=$game_party.item_number(i)
- @weaponpack1[i]=$game_party.weapon_number(i)
- @armorpack1[i]=$game_party.armor_number(i)
- end
- end
- if j == 2
- itempack2 = []
- weaponpack2 = []
- armorpack2 = []
- for i in 1..c2
- itempack2[i]=$game_party.item_number(i)
- weaponpack2[i]=$game_party.weapon_number(i)
- armorpack2[i]=$game_party.armor_number(i)
- end
- end
- if j == 3
- itempack3 = []
- weaponpack3 = []
- armorpack3 = []
- for i in 0..c3
- itempack3[i]=$game_party.item_number(i)
- weaponpack3[i]=$game_party.weapon_number(i)
- armorpack3[i]=$game_party.armor_number(i)
- end
- end
- if d == true
- for i in 0..c1
- $game_party.gain_item(i,-@shanxian)
- $game_party.gain_weapon(i,-@shanxian)
- $game_party.gain_armor(i,-@shanxian)
- end
- for i in 0..c2
- $game_party.gain_weapon(i,-@shanxian)
- end
- for i in 0..c3
- $game_party.gain_armor(i,-@shanxian)
- end
- end
- end
- def give_allthing(c1,c2,c3,j)
- if j == 1
- for i in 0..c1
- if @itempack1[i] + $game_party.item_number(i) >= @shanxian
- $game_party.gain_item(i,@shanxian-$game_party.item_number(i))
- else
- $game_party.gain_item(i,@itempack1[i])
- end
- if @weaponpack1[i] + $game_party.weapon_number(i) >= @shanxian
- $game_party.gain_weapon(i,@shanxian-$game_party.weapon_number(i))
- else
- $game_party.gain_weapon(i,@weaponpack1[i])
- end
- if @armorpack1[i] + $game_party.armor_number(i) >= @shanxian
- $game_party.gain_armor(i,@shanxian-$game_party.armor_number(i))
- else
- $game_party.gain_armor(i,@armorpack1[i])
- end
- end
- end
- if j == 2
- for i in 0..c2
- if @itempack2[i] + $game_party.item_number(i) >= @shanxian
- $game_party.gain_item(i,@shanxian-$game_party.item_number(i))
- else
- $game_party.gain_item(i,@itempack2[i])
- end
- if @weaponpack2[i] + $game_party.weapon_number(i) >= @shanxian
- $game_party.gain_weapon(i,@shanxian-$game_party.weapon_number(i))
- else
- $game_party.gain_weapon(i,@weaponpack2[i])
- end
- if @armorpack2[i] + $game_party.armor_number(i) >= @shanxian
- $game_party.gain_armor(i,@shanxian-$game_party.armor_number(i))
- else
- $game_party.gain_armor(i,@armorpack2[i])
- end
- end
- end
- if j == 3
- for i in 0..c3
- if @itempack3[i] + $game_party.item_number(i) >= @shanxian
- $game_party.gain_item(i,@shanxian-$game_party.item_number(i))
- else
- $game_party.gain_item(i,@itempack3[i])
- end
- if @weaponpack3[i] + $game_party.weapon_number(i) >= @shanxian
- $game_party.gain_weapon(i,@shanxian-$game_party.weapon_number(i))
- else
- $game_party.gain_weapon(i,@weaponpack3[i])
- end
- if @armorpack3[i] + $game_party.armor_number(i) >= @shanxian
- $game_party.gain_armor(i,@shanxian-$game_party.armor_number(i))
- else
- $game_party.gain_armor(i,@armorpack3[i])
- end
- end
- end
- end
复制代码 |
|