local flash_time = 2000 --how long before it'll vanish completely local active_range = 80 --when it begins to flash local reset_time = 5000 --how long before it'll reappear after vanishing completely local falling_height_mod = 100 --when to start triggering damage so player wont fall forever local kill_on_fall = 1 --set to 1 if you want the script to kill the player when he falls (i.e. no terrain below the player or to set a spike trap etc you can leave at 0 if the player will naturally die from the fall damage) local state = {} local flash_delay = {} local flash_time_new = {} local flash_delay_new = {} local shown = {} function vanishing_platform_init(e) shown[e] = 1 flash_delay[e] = flash_time / 50 state[e] = "wait" end function vanishing_platform_main(e) if state[e] == "wait" then if GetPlayerDistance(e) <= active_range then state[e] = "active" flash_time_new[e] = GetTimer(e) + flash_time flash_delay_new[e] = GetTimer(e) + flash_delay[e] end elseif state[e] == "active" then if GetTimer(e) < flash_time_new[e] then if GetTimer(e) > flash_delay_new[e] then flash_delay_new[e] = GetTimer(e) + flash_delay[e] flash_delay[e] = flash_delay[e] * 0.75 if shown[e] == 1 then Hide(e) shown[e] = 0 elseif shown[e] == 0 then Show(e) shown[e] = 1 end end else Hide(e) shown[e] = 0 CollisionOff(e) flash_time_new[e] = GetTimer(e) + reset_time state[e] = "reset" end elseif state[e] == "reset" then if GetTimer(e) > flash_time_new[e] then CollisionOn(e) flash_delay[e] = flash_time / 50 Show(e) shown[e] = 1 state[e] = "wait" end end if kill_on_fall == 1 then if g_PlayerPosY < g_Entity[e]['y'] - falling_height_mod and GetPlayerFlatDistance(e) < active_range then HurtPlayer(e,g_PlayerHealth) end end end --main function GetPlayerFlatDistance(e) tPlayerDX = (g_Entity[e]['x'] - g_PlayerPosX) tPlayerDZ = (g_Entity[e]['z'] - g_PlayerPosZ) return math.sqrt(math.abs(tPlayerDX*tPlayerDX)+math.abs(tPlayerDZ*tPlayerDZ)); end