-- LUA Script - precede every function and global member with lowercase name of script + '_main' -- Adjust this value to match board size local boardSize = 800 -- mess with anything below here at your peril ;-) local U = require "scriptbank\\utillib" local Q = require "scriptbank\\quatlib" local rad = math.rad local deg = math.deg local modf = math.modf local SS = boardSize / 20 local coords = {SS, SS * 3, SS * 5, SS * 7, SS * 9, SS * 11, SS * 13, SS * 15, SS * 17, SS * 19 } local Ladders = { [2] = 42, [27] = 67, [50] = 88, [51] = 83} local Snakes = {[43] = 17, [69] = 19, [92] = 42, [97] = 55} function SLLadder( square ) return Ladders[square] end function SLSnake( square ) return Snakes[square] end local bQuat = nil local bPos = {} function SLCalcPos(square) local YSQ = modf( (square - 1) / 10 ) local XSQ = (square - 1) - YSQ * 10 local xrot, yrot, zrot = Q.ToEuler(bQuat) local rx, ry, rz = U.Rotate3D (coords[ XSQ + 1 ], (boardSize + 20) / 100, coords[ YSQ + 1 ] , xrot, yrot, zrot) return bPos.x + rx, bPos.y + ry, bPos.z + rz, xrot, yrot, zrot end function slboard_init(e) Include("quatlib.lua") Include("utillib.lua") Scale(e, 200) end function slboard_main(e) local Ent = g_Entity[ e ] if bQuat == nil then bPos = {x = Ent.x, y = Ent.y, z = Ent.z} bQuat = Q.FromEuler(rad(GetEntityAngleX(e)), rad(GetEntityAngleY(e)), rad(GetEntityAngleZ(e))) end end