snippets.aoe2map.net

Share Age of Empires 2 Random Map Script snippets online

Error-Handling with Actor Areas
/*
	An explanation of this (with pictures) is available here:
	https://docs.google.com/document/d/1rShRudnsaqU8vgNuyhjSnFvLQq_K0eAF9Ftdl2KnY-o
*/

<PLAYER_SETUP>
direct_placement

<LAND_GENERATION>
create_land {
	terrain_type DIRT
	land_percent 0
	base_size 5
	land_position 10 10
	assign_to_player 1
}
create_land {
	terrain_type DIRT
	land_percent 0
	base_size 5
	land_position 22 22
	assign_to_player 2
}

<OBJECTS_GENERATION>
create_object TOWN_CENTER {
	set_place_for_every_player
	max_distance_to_players 0
}

create_object HOUSE {
	number_of_groups 3
	temp_min_distance_group_placement 5
	set_place_for_every_player
	terrain_to_place_on DIRT
	
	min_distance_to_players 4
	max_distance_to_players 5
	avoid_all_actor_areas
	
	actor_area 1
	actor_area_radius 5
}

create_object GOLD {
	set_gaia_object_only
	number_of_objects 4
	set_tight_grouping
	
	set_place_for_every_player
	terrain_to_place_on DIRT
	
	min_distance_to_players 4
	max_distance_to_players 5
	avoid_actor_area 1
	
	actor_area 2
	actor_area_radius 5
}

/*
	Oh no!. The gold doesn't spawn reliably
	(try it with seed 0, for example)
	
	One way to fix it is by spawning a backup gold as shown below
*/

create_object MACAW {
	set_gaia_object_only
	set_place_for_every_player
	
	actor_area_to_place_in 2
	find_closest

	actor_area 3	
	actor_area_radius 7
}

create_object GOLD {
	set_gaia_object_only
	number_of_objects 4
	set_tight_grouping
	
	set_place_for_every_player
	terrain_to_place_on DIRT
	
	avoid_actor_area 3
	min_distance_to_players 4
	max_distance_to_players 5
}