Setting timers for game events

Is there a way to make a mission trigger a timer, like say on a mininuke? Or a LOT of them? And have the countdown broadcast over a PA system or something? I want to make a lab initiate a self destruct protocol once you get the data you need or if containment is breached.

I had an idea for a mission which would generate a static lab variant (I would have to design it). It would be ultra-dangerous, a cross between real life security and quarantine procedures mixed with bond villain style traps and security systems.

  • Malfunctioning decontamination chambers (UV irradiation, will give you a high dose of rads if you don’t avoid or deactivate it).
  • Airlocks.
  • Fail-deadly containment units for creatures.
  • Wraitheon style security bots.
  • Nerve gas+door lockdown.

Basically, the mission I am picturing would be like if Indiana Jones & The Temple of Doom were set in a secret government lab, and the treasure at the end was a 10 gallon drum of Alpha Serum.

1 Like

CDDA doesn’t support timers. It’s really unfortunate, because a lot of things would be easier with proper timer support. But adding timers would be a big change, so it’s a post 0.D thing at the earliest.

I would suggest working with Brian Lefler on your lab ideas. He’s the guy who did all the great work with labs this last year and he can add the little bits of code you would need.


Yes. Yes it is. That really puts a damper on some of the bond-villainesque things I had planned. There is nothing quite as menacing as a ticking clock.

No way to jury rig a timer based off of a differential between the current in-game time of day and a later time, or some other trickery?

There’s about a zillion ways to jury-rig it. There’s just no way to guarantee that your jury-rig will get called when it’s outside of the reality bubble.

So yea, slight correction, there are timers, there just aren’t global timers.


How big is the reality bubble, like in terms of map tiles? And can you make something happen in a lower z-level as a result of the player changing levels?

If the reality bubble is big enough, I could keep my Indiana Jones lab sized such that all portions of the facility stay inside it no matter where the player is.

That way I would still be able to make a lab-wide self destruct work with a jury rigged timer. If the player gets out, the facility detonates behind them and the stairs collapse the moment the player steps off of them onto the surface. If they don’t make it out in time, rocks fall, everyone dies.

Reality bubble is 11x11 map tiles, and the player is always in the center tile.
So your lab could at most be a 6x6 and force itself to stay loaded.
That’s pretty big TBH, like a city block across.

Side note, z-levels other than the one the player is on are only loaded if the z-levels option is on.

For the stuff you’re describing I wonder if there’s a way to put a timed effect on the player, and have stuff happen in world when the effect expires. That leverages existing code.

I’ve been wondering about distances and scale in the game recently, because looking at the map and comparing it to the scales of vehicles, buildings, and distance traveled on foot, it just seem kind of…off.
It might just be me though.

Each map tile is 24 squares across IIRC, so how big is a square the player is standing on exactly?
1 m^2?

There is no consistent scale, and there is fundamentally no way to make it consistent.

In particular vehicle and building sizes can’t be really consistent with themselves because walls are forced by the grid layout of everything to be “an entire tile” thick, but at the same time open space wants to be as large as possible so the bounds of the game world are reasonably sized, and then road and building bounding boxes are driven by mapgen chunk sizes, which is arbitrary but pretty solidly locked in.

Hmm, thats unfortunate, because without a consistent distance scale it seems like it would make some things kind of problematic. Like determining how far a noise should propagate or implementing realistic fuel/energy efficiency for vehicles.

We can derive some numbers from the vehicle code:

  • a motorcycle is 1 tile wide, and real life motorcycles are a little less than a meter wide, so 1 tile is about 33 inches or 0.8 m.
  • A car is 4 tiles wide, and real life cars are about 2 meters wide, so 1 tile is about 0.5 meters.
  • A semi-truck is 7 tiles wide, and real life semis are about 2.5m wide, so 1 tile is about 0.35 meters.
  • A vehicle moving at 10 mph moves 1 tile every turn. A turn is 6 seconds long. A tile must be 26 meters.

Pick a value you like.

1 Like

Guys it’s really simple. A tile in cataclysm is exactly the same size as a tile in dwarf fortress. One tile is the size of a cat. Also, a dragon. Also, a wagon takes up nine tiles, and is about 3m wide by 5m long. However a dragon is substantially larger than an elephant.


Don’t forget that rifles can fire 1,000m, so tiles are at least 1,000 / 60 = 16m.

It makes things ambiguous, and then you resolve the ambiguity when it makes sense to and otherwise ignore it.

In reality you try and stay consistent when it matters, and don’t worry about it too much if it doesn’t.

Can’t a general calendar /turn counter be used as a global counter for the purpose, like it is used in many places to simulate out of reality bubble time depending actions in progress?

Indeed. I was under the impression the global calendar that keeps track of days was a timer. Wouldn’t it also keep track of hours/minutes too? Perhaps only days?

I’m using the timer in the sense of a programmable counter that will execute something at some future time. So while I can use the calendar to track when an event should happen, I can’t make an event happen.

Simple example that I’m seeing a lot in the faction camp code:

  1. You send an NPC off to go build something that takes 4 hours. He disappears off from the map, and the time you sent him off and the time you expect him back is saved in a data structure.
  2. 4 hours later, the NPC doesn’t suddenly reappear. There’s no timer that can trigger a callback to execute the code that causes the NPC to return.
  3. An hour after that, you go talk to the camp manager. The code checks the current time from the calendar against the saved time, and gives you the option of executing the code to retrieve the NPC.

What nameless_survivor wants is the ability to set a countdown timer, have it expire, and then have the lab collapse off-screen if it’s no longer in the reality bubble. We can’t do that - the best we can do is have the lab collapse as soon as it re-enters the bubble. Which is good enough 90% of the time, but a general timer infrastructure would be useful for things like smoking racks, NPC movement, bombs, and other things that I haven’t thought of.

If you just want it to collapse once the player finishes the quest, could you tie it to the quest completion dialogue, so that when you talk to the quest-giver it collapses the lab? If you want it more immediate, could you put an NPC guarding the exit door to the lab, make it necessary to talk to him to get out, and put the trigger there?

Well, I was planning to do it with mininukes hidden in the walls, so being anywhere in that reality bubble when they went off would be instant death.