特定のユニットが隣のタイルに止まったら一言言う

例 Poppon が Lulu の隣に来ると Lulu が不満を言う。
   [event]
       name=moveto
       first_time_only=no
           [filter]
               id=Poppon  ←Poppon が行動した場合に発動
           [/filter]
       [if]
           [have_location]
                   x,y=$x1,$y1 ←第1のユニット(=Poppon)が止まった座標
               [and]
                   radius=1  座標 $x1,$y1 の周囲のタイル(ヘクス)
                   [filter]
                       id=Lulu ←Lulu が居れば
                   [/filter]
               [/and]
           [/have_location]
           [then]
               [message]
                   speaker=Lulu
                   message= _ "ちょっと、近寄らないでよ!"
               [/message]
           [/then]
       [/if]
   [/event]
 ポイントは、[have_location]タグを使用することです。このタグで特定の座標や地形を指定して、もしそこに特定のユニットが居れば(居なければ)、何らかのアクションを起こすことが出来ます。
 「radius」を使うことで、座標の範囲を広げることができます。すぐ隣までなら、radius=1 とすることで指定できます。radius=5 とすると周囲5ヘクス以内の座標が対象となります。
 この例の場合は「Poppon が止まったタイルに何かユニットがいて(もちろんPoppon自身がいる)、なおかつ(and)、周囲1ヘクス以内(radius=1)のタイルに Lulu が居れば成立する」ことになります。
 [then] の中に他のタグを入れることで他の効果を出すことができます。

 逆に、すぐ隣より離れたタイルに止まったときに一言言わせたい場合は、[and] の代わりに [not] を使います。
   [event]
       name=moveto
       first_time_only=no
           [filter]
               id=Poppon  ←Poppon が行動した場合に発動
           [/filter]
       [if]
           [have_location]
                   x,y=$x1,$y1 ←第1のユニット(=Poppon)が止まった座標
               [not]
                   radius=1  座標 $x1,$y1 の周囲のタイル(ヘクス)
                   [filter]
                       id=Lulu ←Lulu が居なければ
                   [/filter]
               [/not]
           [/have_location]
           [then]
               [message]
                   speaker=Lulu
                   message= _ "あー、せいせいする!"
               [/message]
           [/then]
       [/if]
   [/event]

タグ:

+ タグ編集
  • タグ:
最終更新:2012年03月04日 08:26