查看: 3133|回复: 11

[已经解决] 關於戰棋設定的問題

[复制链接]
梦石
0
星屑
210
在线时间
1196 小时
注册时间
2010-7-18
回帖
52
发表于 2010-8-8 16:26:16 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
目前研究GTBS的戰棋腳本,發現一點問題
我先PO上作者的一段Q&A

# Can I have events on the map that will effect the battle without being battlers?
#----------------------------------------------------------------------
#     Yes.  To do this simply create a event on the map named "battle_event"(without the quotes)
#     Then set it up just like you always would, you can make checks against the number
#     enemies/actors/neutral or practically anything you want, keep in mind, that
#     the changes and checking/etc must be done via script.  Also, events set to
#     trigger by player/event touch or Action Button, will trigger when you 'wait'
#     on their tile.
#       Here are a couple of useful script commands -
#          $scene.actors - this returns the array of actors in battle
#          $scene.enemies - this returns the array of enemies in battle
#          $scene.neutral - this returns the array of netruals in battle
#          $game_temp.battle_turn - returns the current turn # for battle

使用判斷式
IF $game_temp.battle_turn<2
表示戰鬥回合小於二則執行
這個成功
但是...
其他的$scene.actors、$scene.enemies、$scene.neutral,
卻沒辦法這樣設置

是不是我誤會他的意思了?
array是數列的意思嗎?
那要怎麼設置,才會執行?
譬如: IF 敵人數<2,這要怎麼設置呢?

另外,不曉得有沒有人知道,
如何設定指定的actor或enemy死亡時則執行事件?

嗯...自己研究了一陣子但都沒有確切的辦法><
希望大哥大姐可以幫幫忙
萬分感謝!!

万物创造者

梦石
0
星屑
54
在线时间
352 小时
注册时间
2008-2-15
回帖
2406
发表于 2010-8-8 17:13:44 | 显示全部楼层
array是数组
数组不能直接用来判断,如果要取数组大小的话用size参数
From mortal hope immortal power springs.
回复

使用道具 举报

梦石
0
星屑
210
在线时间
1196 小时
注册时间
2010-7-18
回帖
52
 楼主| 发表于 2010-8-8 17:20:41 | 显示全部楼层
感謝樓上回答!
但具體來說該如取數組大小呢?
size[$scene.actors]?

或是要使用到腳本呢?
回复

使用道具 举报

万物创造者

梦石
0
星屑
54
在线时间
352 小时
注册时间
2008-2-15
回帖
2406
发表于 2010-8-8 17:25:29 | 显示全部楼层
size是参数不是方法
if $scene.enemies.size < 2

点评

我一般用size  发表于 2010-8-9 12:23
是size?不是length?  发表于 2010-8-8 23:02

评分

参与人数 1星屑 +700 收起 理由
DeathKing + 700 认可答案

查看全部评分

From mortal hope immortal power springs.
回复

使用道具 举报

梦石
0
星屑
210
在线时间
1196 小时
注册时间
2010-7-18
回帖
52
 楼主| 发表于 2010-8-8 17:30:22 | 显示全部楼层
感謝小幽的马甲大大!!
測試成功!

我來去多讀一下ruby的東西
再次謝謝你!
回复

使用道具 举报

梦石
0
星屑
210
在线时间
1196 小时
注册时间
2010-7-18
回帖
52
 楼主| 发表于 2010-8-8 18:22:52 | 显示全部楼层
我又遭遇問題了
這次是取array中特定的數字
我用 if !$scene.enemies[0],可以取array中第一個不存在就執行
但是當我使用到if !$scene.enemies[1]的時候,
array中不論0或1不存在,都會執行,
不知道為什麼會這樣...
回复

使用道具 举报

万物创造者

梦石
0
星屑
54
在线时间
352 小时
注册时间
2008-2-15
回帖
2406
发表于 2010-8-8 18:34:38 | 显示全部楼层
什么叫特定的数字?你想实现什么效果?
From mortal hope immortal power springs.
回复

使用道具 举报

梦石
0
星屑
210
在线时间
1196 小时
注册时间
2010-7-18
回帖
52
 楼主| 发表于 2010-8-8 18:41:10 | 显示全部楼层
譬如說a=[enemy2,enemy1]
如上所說取 if !a[0]則表示enemy2消失才執行

我的問題是當我用 if !a[1]的時候
不管是enemy1或enemy2消失,
它都會執行
但我要的就只是當enemy1消失時才執行
回复

使用道具 举报

万物创造者

梦石
0
星屑
54
在线时间
352 小时
注册时间
2008-2-15
回帖
2406
发表于 2010-8-8 18:44:46 | 显示全部楼层
= =为何要用!
"!"是对布尔值取反,!false = true、!true = false
你是不是要判断数组里有enemy1这个对象?
From mortal hope immortal power springs.
回复

使用道具 举报

梦石
0
星屑
210
在线时间
1196 小时
注册时间
2010-7-18
回帖
52
 楼主| 发表于 2010-8-8 18:46:55 | 显示全部楼层
是!
我要判斷沒有它才執行!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部