Re: how to make events randomly pop up in bgt

Several options:
- If it's turn-based, have a variable for how likely an event is to occur on any given turn. If (random (0, max) > chance) fire_event
- If it's frame-based, same thing, except the numbers need to account for the framerate. Ex, if you have 50 fps, and you want the event to average once every 10s, you'd have a 1 in 500 chance of the event firing each frame. If (random (0, 500) == 1). It doesn't have to be 1, so long as it's a unique number.
- Same as above, but only check once per second. You can do this with a timer (if (time.elapsed > 1000 and random (0, max) == firevalue) ), or with frames if you're tracking which frame you're in or how much time has elapsed (the clock include tracks how many frames have passed, so at 50 fps, you know a second has passed when game_clock.frame % 50 == 0).
- As 2 said, after the event, set how long you want it to be until the next one to a random value. Use a timer, or some other means of tracking how much time has passed. This allows you to change the time between events on-the-fly. It also is pretty cheatable—someone finds the time until the next event with cheatengine or whatever, and sets it to infinity, or sets it to 0 if they want to trigger events early, whatever.

There are other ways, too.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : bopitmaster34 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector

Reply via email to