Random maps

 by Erik-Ftn

 

I was reading in splash forum about making random changes to maps. Eg a battlefield/ trenches/ corridor area in which not the same items show up every time you play the map. The argument was that this might change gameplay from learning blindly where to nade towards more needed teamwork and game presence.

Whatever the argument I find this very cool.

Hence, here are a few methods of randomly making one out of four different sets of mapobjects show up when you start your map.

(target_relay) First you need target_relay entity, not included in your et_enteties.def file from start. Include it with a texteditor and restart Radiant.

1. Simple – entities only.

random_system_small

Make the following, as in the picture:

trigger_always -> target_delay (wait 200) -> target_relay (random ON) -> 4 st func_static ( start_invis ON)

This will, 200 ms after spawn, light up _one_ if the func_statics in the end of the chain. A func_static can consist of any number of pieces. (SD does not recommend using func_statics like this. Sometimes it affects how shadows are displayed in the map and it might look ugly.)

50% chance on each
In the above description, it is 25% chance of each set of func_statics to be lit. If you want independent 50% chance on each of the four sets, make four chains and end each chain with two targets, one func_static and one target_relay.

2. With scripting and script_movers

Now you can have your random stuff damageable, moveable, resurrecteable and triggering script events as well. Make your random blocks into script_movers with triggerspawn flag ON. Give each set of script_movers scriptnames and targetnames randomblocks_set1 (2, 3 or 4).

include this in your script:

random blocks
{
spawn
{
wait 200
accum 1 random 4
accum 1 trigger_if_equal 1 self lightup1
accum 1 trigger_if_equal 2 self lightup2
accum 1 trigger_if_equal 3 self lightup3
accum 1 trigger_if_equal 4 self lightup4
}trigger lightup1
{
setstate randomblocks_set1 default
}

trigger lightup2
{
setstate randomblocks_set2 default
}

trigger lightup3
{
setstate randomblocks_set3 default
}

trigger lightup4
{
setstate randomblocks_set4 default
}

 

again,  to make four independent sets with 50% chance of lighting each of them, change the first part of the above script to this:

random blocks
{
spawn
{
wait 200
accum 1 random 2
accum 1 trigger_if_equal 1 self lightup1
accum 1 random 2
accum 1 trigger_if_equal 1 self lightup2
accum 1 random 2
accum 1 trigger_if_equal 1 self lightup3
accum 1 random 2
accum 1 trigger_if_equal 1 self lightup4
}