Welcome to Open Carnage

A resource for Halo 1 modding and tech, with unique means of rewarding individual content creation and support. Have a wander to see why we're worth the time! EST. 2012


Simple .lua timer



I'm just looking for an example of a simple .lua timer script to repeat the spawn of a flare (it's a weap tag on aLTis's Bigass Final map) that would otherwise burn for 30 seconds and then disappear. I currently have it running on event_alive so it respawns every second and it looks clunky as all buggery 


Thank you please.

Share this post

Link to post
Share on other sites

Members of Open Carnage never see off-site ads.

Never scripted in lua before. But here is my take from a lot of googling and some corrections from 002:


api_version = ""

minutes = 0
seconds = 0

function OnScriptLoad()
    timer(1000, "TimerFunction")

function TimerFunction()
    seconds = seconds + 1
    if seconds == 60 then
        seconds = 0
        minutes = minutes + 1
    cprint(minutes .. ":" .. string.format("%02d",seconds))

You may still want a way to clear the screen so they don't pile up and a way to make the timer appear on the right side of the screen.

Weyland, Tucker933 and Kavawuvi like this

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.