■ホムンクルス基礎知識 PrivateMoon :ttp://www15t.sakura.ne.jp/~privatemoon/alc/hom_100.html Chemical Company :ttp://blog.livedoor.jp/meta_mor/archives/50073961.html
local type = GetV (V_HOMUNTYPE,myid) if (type == LIF or type == LIF_H or type == AMISTR or type == AMISTR_H or type == LIF2 or type == LIF_H2 or type == AMISTR2 or type == AMISTR_H2) then result = GetMyEnemyA (myid) elseif (type == FILIR or type == FILIR_H or type == VANILMIRTH or type == VANILMIRTH_H or type == FILIR2 or type == FILIR_H2 or type == VANILMIRTH2 or type == VANILMIRTH_H2) then result = GetMyEnemyB (myid) end return result end
i宣言してる割には値が増えないね・・ else local motion = GetV(V_MOTION,i) if (motion == MOTION_ATTACK or motion == MOTION_ATTACK2) then enemys[index] = v (↑がenemys[index] = iってなってればまあ何となくiも使われることになるんだけどね) index = index+1
>>227 for i,v in ipairs(actors) do ... end で、リストactorsが尽きるまで(1,actors[1])、(2,actors[2])、…が順に(i,v)に格納され、 そのたびにfor〜end間の処理が繰り返されます。 iはipairsが吐き出す1,2,…の単なる受け皿のようなものです。
ふと思ったのだが、件のところは、 function GetMyEnemy (myid) local result = 0
local type = GetV (V_HOMUNTYPE,myid) if (type == LIF or type == LIF_H or type == AMISTR or type == AMISTR_H or type == LIF2 or type == LIF_H2 or type == AMISTR2 or type == AMISTR_H2 or type == FILIR or type == FILIR_H or type == VANILMIRTH or type == VANILMIRTH_H or type == FILIR2 or type == FILIR_H2 or type == VANILMIRTH2 or type == VANILMIRTH_H2) then result = GetMyEnemyA (myid) end return result end と、1つの条件判定文に纏めてもいいと思う。もといそうした。 つーかこれで何かエラーが出るとすればLUAがry
local type = GetV (V_HOMUNTYPE,myid) if (type == LIF or type == LIF_H or type == AMISTR or type == AMISTR_H or type == LIF2 or type == LIF_H2 or type == AMISTR2 or type == AMISTR_H2) then result = GetMyEnemyA (myid) elseif (type == FILIR or type == FILIR_H or type == VANILMIRTH or type == VANILMIRTH_H or type == FILIR2 or type == FILIR_H2 or type == VANILMIRTH2 or type == VANILMIRTH_H2) then result = GetMyEnemyB (myid) -- ←この行のGetMyEnemyBをAに変える end return result end