見出し画像

架空バトスピの作り方④「立体コアの演出」

はじめに

この記事では、「AviUtl」ソフトを使用する前提で進めていきます。
平面コアの運用に飽きてきた、興味本位でやってみたいという方は是非チャレンジしてみてください!
ちなみに参考画像は自分が作った動画をスクショで持ってきました。

スクリプト配布

今回紹介するのは、「@BS_Core_k8」というファイルです。
旧版も紹介していますが、k1~k5、k7は試作で作ったもので、よく使っているのがk6です。
※立体バトルの作り方は、架空バトスピの作り方③「立体バトルの編集」を参考にしてください。
https://note.com/avriel0829/n/n85fa53c447be
※アニメーションファイルのため、中身は見れません。
※中身の編集もOKです。


使用説明(準備)

  1. ダウンロードしたら、フォルダごとscriptフォルダにコピーします。
    (aviutl > script > CoreScript)

  2. AviUtlアプリケーションを開いて、新規プロジェクトを立ち上げましょう。

  3. Layer1の行にカメラ制御を入れましょう。Y座標を0から-1000にします。

  4. タイムラインを表示させ、Layer2の行に画像ファイル、テキストのどれかを入れましょう。画像ファイルなら適当な画像を、テキストなら何か適当に文字を入れてください。そして、「拡張絵画」に変えましょう。

  5. 手順4.で出したアイテムにアニメーション効果を選択し、「BS_Core_k8」を選びます。

  6. 「コアの数」トラックバーを動かすと、+1~+10で「コアのみ」-1~-10で「ソウルコア込み」になります。ここまで表示できればOKです。

コアの数が「-10」にしたとき

取説

  • 「始点」と「終点」は、コアの移動位置に使います。+1~はフィールド、0はリザーブ、-1はトラッシュになります。「始点」と「終点」の数字が一致している場合、その場で静止します。

  • 「コアの数」は、+1~+10で「普通のコア」、-1~-10で「ソウルコア込み」、0は何も表示していません。

  • 静止時間は、移動し始めるのにかかる時間・移動し終えてから静止する時間です。静止している間はフェードイン、フェードアウトします。

  • プレイヤー2(座標反転)は、チェックボックスに☑を入れると相手側(向こう側)に移します。

  • (設定)基準位置座標は、カード位置が「5」の座標を決めます。

  • (設定)間隔x、間隔zは、カード位置が隣同士の座標間隔を決めます。

  • (設定)リザーブx、リザーブzは、リザーブの座標位置を決めます。トラッシュの位置に関しては、リザーブのx座標を反転させています。

  • (設定)コア(%)、ソウルコア(%)は、コア、ソウルコアの拡大率を決めます。ただし、極端に変化させるとコアとコアがぶつかるのでほどほどに。

※カードの位置とはこんな感じです。 
 過去の画像なので、今とは異なります。

カードの位置(参考)

ダイアログ設定

上記以外に、微調整が必要かもしれないものをいくつか挙げます。

  • 拡大率:変化させるとコアとソウルコアの大きさが変化し、間隔も拡大率に応じて変化します。一応、ぶつからないようにはしています。

  • 透明度:基本的には「0」にしていますが、実際はガラスでできているので、「10」くらいがちょうどいいと思います。※あまり透明にしすぎると背景が同化して見えづらいので注意。

  • Y:Y座標を変化させると、コアが浮きます。最近の環境の煌臨などカードの厚みによってぶつかる可能性があるため微調整は必要かもしれません。

  • (カメラ制御)シャドー:光源の位置を設定し、影を演出させます。背景が同化してしまう場合には調整が必須。※透明度が大きいと影響しにくいため注意。

立体コアの演出

ちょっと分かりづらいかもしれませんが、現状これが限界です。

ソースコード

@コア移動
--track0: 始点, -1, 10, 0, 1
--track1: 終点, -1, 10, 0, 1
--track2: コアの数, -10, 10, 0, 1
--track3: 静止時間, 0, 1, 0.5, 0.1

--check0: プレイヤー2(座標反転), 0
--dialog: 基準位置座標,ori={0,-1,-115}; 間隔x, x1=175; 間隔z, z1=210; リザーブx, re_x =-540; リザーブz, re_z =-480; コア(%), c_zoom =100.0;ソウルコア(%), s_zoom =70.0;

--【説明】始点0はリザーブ、始点-1はトラッシュ、始点1~10はフィールドです。
--【更新】k2 オブジェクトの最初と最後の0.5秒間は静止状態。※ただし、オブジェクトの長さが1秒以下の場合はk1の動作にする。
--【更新】k3 静止状態時間をトラックバーで操作する(track2) ※ただし、オブジェクトの長さがtrack2の長さの2倍以下の場合はk1の動作にする。
--【更新】k4 静止状態の間にフェードイン・フェードアウト
--【更新】k6 コアの数を設定(マイナスはソウルコア含めた数)
--【更新】k7 読み込む画像を普通コア1個とソウルコアのみにする。
--【更新】k8 画像読み込み不要→立体コアに変更

--ここから変更不可
local st      = obj.track0
local gl      = obj.track1
local pl      = obj.check0
local coreNum = obj.track2
local pt      = {}
local fi      = {}
local stopt   = obj.track3
local alp     = 1.0
local core_rz = 0.0


if re_x  == nil then
    re_x  = -540
end
if re_z  == nil then
    re_z  = -480
end

if     st  > 0 then
  st = {
          x1 * math.floor((st-5)/2) + ori[1],
          ori[2],
          -z1 * ((st-1)%2)          + ori[3]
       }

elseif st ==  0 then
  st = {re_x, ori[2], re_z}

elseif st == -1 then
  st = {-re_x, ori[2], re_z}

end

if     gl  > 0 then
  gl = {
          x1 * math.floor((gl-5)/2) + ori[1],
          ori[2],
          -z1 * ((gl-1)%2)          + ori[3]
       }

elseif gl == 0 then
  gl = {re_x, ori[2], re_z}

elseif gl == -1 then
  gl = {-re_x, ori[2], re_z}

end

-- k1 絵画
-- k2 「t1,t2」は動作中オブジェクトのうち移動している時間を1として、進行率は何パーセントかを表す。
-- k3 静止状態時間が変化すると、k1かk2を動作する条件が変わる。
-- k4 k3の機能に加え、静止している場合にフェードを行う。

local t1 = obj.frame/obj.totalframe
local t2 = (obj.frame - math.floor(stopt * obj.framerate)) / (obj.totalframe - math.floor(stopt*2*obj.framerate))

if  obj.totaltime <= stopt*2 then
  for i = 1, 3 do
     pt[i] = st[i] + (gl[i] - st[i]) * t1

  end

else
  if obj.time < stopt then
     alp = obj.frame / (stopt * obj.framerate)
     
     for i = 1, 3 do
        pt[i] = st[i]

     end
  
  elseif obj.time > obj.totaltime - stopt then
     alp = (obj.totalframe - obj.frame) / (stopt * obj.framerate)
     
     for i = 1, 3 do
        pt[i] = gl[i]
     
     end

  else
     for i = 1, 3 do
     	  pt[i] = st[i] + (gl[i] - st[i]) * t2

     end

  end

end


if pl == true then
  pt[1], pt[3] = -pt[1], -pt[3]
  core_rz = 180
end


obj.setoption("billboard",0)


function alignment(i, coreNum)
   local shift = {}

   if   coreNum == 1 then
      shift = {0, 0, 0}

   elseif coreNum == 2 then
      if     i == 1 then
          shift = {-15, 0, 15}
      elseif i == 2 then
          shift = {15, 0, -15}
      end

   elseif coreNum == 3 then
      if     i == 1 then
          shift = {0, 0, -15}
      elseif i == 2 then
          shift = {20, 0, 15}
      elseif i == 3 then
          shift = {-20, 0, 15}
      end

   elseif coreNum == 4 then
      if     i == 1 then
          shift = {-20, 0, -20}
      elseif i == 2 then
          shift = {20, 0, -20}
      elseif i == 3 then
          shift = {-20, 0,  20}
      elseif i == 4 then
          shift = {20, 0,  20}
      end

   elseif coreNum == 5 then
      if     i == 1 then
          shift =  {0, 0, 0}
      elseif i == 2 then
          shift = {-25, 0, -25}
      elseif i == 3 then
          shift = {25, 0, -25}
      elseif i == 4 then
          shift = {-25, 0, 25}
      elseif i == 5 then
          shift = {25, 0, 25}
      end

   elseif coreNum == 6 then
      if     i == 1 then
          shift = {0, 0, -20}
      elseif i == 2 then
          shift = {0, 0, 20}
      elseif i == 3 then
          shift = {-30, 0, -20}
      elseif i == 4 then
          shift = {30, 0, -20}
      elseif i == 5 then
          shift = {-30, 0, 20}
      elseif i == 6 then
          shift = {30, 0, 20}
      end

   elseif coreNum == 7 then
      if     i == 1 then
          shift = {0, 0, 0}
      elseif i == 2 then
          shift = {-30, 0, -30}
      elseif i == 3 then
          shift = {0, 0, -30}
      elseif i == 4 then
          shift = {30, 0, -30}
      elseif i == 5 then
          shift = {-30, 0, 30}
      elseif i == 6 then
          shift = {0, 0, 30}
      elseif i == 7 then
          shift = {30, 0, 30}
      end

   elseif coreNum == 8 then
      if     i == 1 then
          shift = {-20, 0, 0}
      elseif i == 2 then
          shift = {20, 0, 0}
      elseif i == 3 then
          shift = {-30, 0, -30}
      elseif i == 4 then
          shift = {0, 0, -30}
      elseif i == 5 then
          shift = {30, 0, -30}
      elseif i == 6 then
          shift = {-30, 0, 30}
      elseif i == 7 then
          shift = {0, 0, 30}
      elseif i == 8 then
          shift = {30, 0, 30}
      end

   elseif coreNum == 9 then
      if     i == 1 then
          shift = {0, 0, 0}
      elseif i == 2 then
          shift = {-30, 0, 0}
      elseif i == 3 then
          shift = {30, 0, 0}
      elseif i == 4 then
          shift = {-30, 0, -30}
      elseif i == 5 then
          shift = {0, 0, -30}
      elseif i == 6 then
          shift = {30, 0, -30}
      elseif i == 7 then
          shift = {-30, 0, 30}
      elseif i == 8 then
          shift = {0, 0, 30}
      elseif i == 9 then
          shift = {30, 0, 30}
      end

   elseif coreNum == 10 then
      if     i == 1 then
          shift = {0, 0, -45}
      elseif i == 2 then
          shift = {-15, 0, -15}
      elseif i == 3 then
          shift = {15, 0, -15}
      elseif i == 4 then
          shift = {-30, 0, 15}
      elseif i == 5 then
          shift = {0, 0, 15}
      elseif i == 6 then
          shift = {30, 0, 15}
      elseif i == 7 then
          shift = {-45, 0, 45}
      elseif i == 8 then
          shift = {-15, 0, 45}
      elseif i == 9 then
          shift = {15, 0, 45}
      elseif i == 10 then
          shift = {45, 0, 45}
            
      end

   end
   shift[1] = shift[1] * 1.2 * obj.getvalue("zoom")*0.01
   shift[3] = shift[3] * 1.2 * obj.getvalue("zoom")*0.01
   return shift

end

function core_generate(sx,sy,sz,c_zoom, alp)
	local zoom=obj.getvalue("zoom")*0.01
	local N=6
	local H=10.0*zoom*c_zoom/100
	local R1=10.0*zoom*c_zoom/100
	local R2=20.0*zoom*c_zoom/100
	local obh=obj.h
	local iso= 1 and math.pi*0.5 or 0
	local ant = 0
	local int = 0
	local Futa= 1
	local cchk= 1
	local rev = 1
	local star= 0
	local cst = 50
	local uX={}
	local uZ={}
	local dX={}
	local dZ={}
        
        obj.cy = H
  
	obj.setoption("antialias",ant)
	if int==1 then N=math.floor(N) end
	if star==0 then
		for i=0,N do
			local rad=2*i*math.pi/N+iso
			local cos=math.cos(rad)
			local sin=math.sin(rad)
			uX[i]=R1*cos
			uZ[i]=R1*sin
			dX[i]=R2*cos
			dZ[i]=R2*sin
		end
	else
		cst=1-cst*0.01
		N=2*N
		for i=0,N,2 do
			local rad=2*i*math.pi/N+iso
			local cos=math.cos(rad)
			local sin=math.sin(rad)
			uX[i]=R1*cos
			uZ[i]=R1*sin
			dX[i]=R2*cos
			dZ[i]=R2*sin
		end
		R1=R1*cst
		R2=R2*cst
		for i=1,N,2 do
			local rad=2*i*math.pi/N+iso
			local cos=math.cos(rad)
			local sin=math.sin(rad)
			uX[i]=R1*cos
			uZ[i]=R1*sin
			dX[i]=R2*cos
			dZ[i]=R2*sin
		end
	end

	local U={}
	for i=0,N do
		U[i]=i/N*obj.w
	end

	local Y1,Y2
	if cchk==1 and rev==0 then
		Y1=-H*0.5
		Y2= H*0.5
	else
		Y1=-H
		Y2=0
	end

	obj.load("figure", "四角形", 0x00ffff, 1)

	for i=0,N-1 do
		obj.drawpoly(sx+uX[i],sy+Y1,sz+uZ[i], sx+uX[i+1],sy+Y1,sz+uZ[i+1], sx+dX[i+1],sy+Y2,sz+dZ[i+1], sx+dX[i],sy+Y2,sz+dZ[i], U[i],0,U[i+1],0,U[i+1],obh,U[i],obh, alp)
	end

	
	for i=0,N-1 do
		obj.drawpoly(sx+uX[i+1],sy-Y1, sz+uZ[i+1],sx+uX[i],sy-Y1,sz+uZ[i], sx+dX[i],sy,sz+dZ[i], sx+dX[i+1],sy,sz+dZ[i+1], U[i+1],0,U[i],0,U[i],obh,U[i+1],obh, alp)
	end
	
	
        for i=0,N-1 do
		obj.drawpoly(sx,sy+Y1,sz, sx,sy+Y1,sz,sx+uX[i+1], sy+Y1,sz+uZ[i+1],sx+uX[i], sy+Y1,sz+uZ[i], U[i],0,U[i+1],0,U[i+1],0,U[i],0,alp)
		obj.drawpoly(sx,sy-Y1,sz, sx,sy-Y1,sz, sx+uX[i],sy-Y1,sz+uZ[i], sx+uX[i+1],sy-Y1,sz+uZ[i+1], U[i+1],0,U[i],0,U[i],0,U[i+1],0,alp)
	end

end

function soulcore_generate(sx,sy,sz,s_zoom, alp)
	local zoom=obj.getvalue("zoom")*0.01
	local N=5
	local H=15.0*zoom*s_zoom/100
	local R1=20.0*zoom*s_zoom/100
	local R2=30.0*zoom*s_zoom/100
	local obh=obj.h
	local iso= 1 and math.pi*0.5 or 0
	local ant = 0
	local int = 0
	local Futa= 1
	local cchk= 1
	local rev = 1
	local star= 0
	local cst = 50
	local uX={}
	local uZ={}
	local dX={}
	local dZ={}
        
        obj.cy = H
  
	obj.setoption("antialias",ant)
	if int==1 then N=math.floor(N) end
	if star==0 then
		for i=0,N do
			local rad=2*i*math.pi/N+iso
			local cos=math.cos(rad)
			local sin=math.sin(rad)
			uX[i]=R1*cos
			uZ[i]=R1*sin
			dX[i]=R2*cos
			dZ[i]=R2*sin
		end
	else
		cst=1-cst*0.01
		N=2*N
		for i=0,N,2 do
			local rad=2*i*math.pi/N+iso
			local cos=math.cos(rad)
			local sin=math.sin(rad)
			uX[i]=R1*cos
			uZ[i]=R1*sin
			dX[i]=R2*cos
			dZ[i]=R2*sin
		end
		R1=R1*cst
		R2=R2*cst
		for i=1,N,2 do
			local rad=2*i*math.pi/N+iso
			local cos=math.cos(rad)
			local sin=math.sin(rad)
			uX[i]=R1*cos
			uZ[i]=R1*sin
			dX[i]=R2*cos
			dZ[i]=R2*sin
		end
	end

	local U={}
	for i=0,N do
		U[i]=i/N*obj.w
	end

	local Y1,Y2
	if cchk==1 and rev==0 then
		Y1=-H*0.5
		Y2= H*0.5
	else
		Y1=-H
		Y2=0
	end
 	obj.load("figure", "四角形", 0xbebebe, 1)

	for i=0,N-1 do
		obj.drawpoly(sx+uX[i],sy+Y1,sz+uZ[i], sx+uX[i+1],sy+Y1,sz+uZ[i+1], sx+dX[i+1],sy+Y2,sz+dZ[i+1], sx+dX[i],sy+Y2,sz+dZ[i], U[i],0,U[i+1],0,U[i+1],obh,U[i],obh,alp)
	end

	
	for i=0,N-1 do
		obj.drawpoly(sx+uX[i+1],sy-Y1, sz+uZ[i+1],sx+uX[i],sy-Y1,sz+uZ[i], sx+dX[i],sy,sz+dZ[i], sx+dX[i+1],sy,sz+dZ[i+1], U[i+1],0,U[i],0,U[i],obh,U[i+1],obh,alp)
	end
	
	obj.load("figure", "四角形", 0xff0000, 1)
        for i=0,N-1 do
		obj.drawpoly(sx,sy+Y1,sz, sx,sy+Y1,sz,sx+uX[i+1], sy+Y1,sz+uZ[i+1],sx+uX[i], sy+Y1,sz+uZ[i], U[i],0,U[i+1],0,U[i+1],0,U[i],0,alp)
		obj.drawpoly(sx,sy-Y1,sz, sx,sy-Y1,sz, sx+uX[i],sy-Y1,sz+uZ[i], sx+uX[i+1],sy-Y1,sz+uZ[i+1], U[i+1],0,U[i],0,U[i],0,U[i+1],0,alp)
	end
	
end


if coreNum > 0 then
   for i = 1, coreNum do
      fi = alignment(i, coreNum)
      core_generate(pt[1]+fi[1], pt[2]+fi[2], pt[3]+fi[3],c_zoom, alp)
      
   end

elseif coreNum < 0 then
   for i = 1, -coreNum do
	fi = alignment(i, -coreNum)
	
        if i == 1 then
		soulcore_generate(pt[1]+fi[1], pt[2]+fi[2], pt[3]+fi[3],s_zoom, alp)
	else
		core_generate(pt[1]+fi[1], pt[2]+fi[2], pt[3]+fi[3],c_zoom, alp)
	end
	
   end
elseif coreNum == 0 then
   obj.alpha = 0.0

end



debug_print("%d",coreNum)

ちなみに、一部はティム氏作成の「錐変形」というスクリプトファイルを参考にしました。

さいごに

これで動作できれば良いのですが、他にPCを持っていないので自分ではテストはできません・・・。でも、これだけは言えます。立体コアは架空バトスピの進化には必要でしょう。
もしかしたらちょっと改良を加えるかもしれません。

カード位置についてですが、そのうちnoteにて公開するかもしれません。



この記事が気に入ったらサポートをしてみませんか?