local state = {} local x = {} local land_time = {} local height = {} local startheight = {} local z = {} function chopping_fools_torso_init(e) state[e] = "init" CollisionOff(e) Hide(e) height[e] = 999999 end function chopping_fools_torso_main(e) if z[e] == nil then for a = e-50, e+50 do if g_Entity[a] ~= nil then if GetDistance(e,a) < 120 then if weapon_name[a] == "chopping zombie" then z[e] = a break end end end end else if state[e] == "init" then if dead[z[e]] == 0 then SetPosition(e,g_Entity[z[e]]['x'],g_Entity[z[e]]['y']+50,g_Entity[z[e]]['z']) SetRotation(e,math.random(60,80),g_PlayerAngY,0) x[e] = 0 startheight[e] = g_Entity[z[e]]['y'] land_time[e] = GetTimer(e) else Show(e) if x[e] < 20 then MoveForward(e,-20) x[e] = x[e] + 1 else CollisionOn(e) if GetTimer(e) > land_time[e] then if g_Entity[e]['y'] >= height[e] + 0.25 and g_Entity[e]['y'] < startheight[e] then else land_time[e] = GetTimer(e) + 10 height[e] = g_Entity[e]['y'] end end end end end end end --main function GetDistance(e,v) if g_Entity[e] ~= nil and g_Entity[e] ~= 0 and g_Entity[v] ~= nil then local disx = g_Entity[e]['x'] - g_Entity[v]['x'] local disy = g_Entity[e]['y'] - g_Entity[v]['y'] local disz = g_Entity[e]['z'] - g_Entity[v]['z'] return math.sqrt(disx^2 + disy^2 + disz^2) end end