You must be logged in to post messages.
Please login or register

AI & RM Scripting
Moderated by Leif Ericson

Hop to:    
Welcome! You are not logged in. Please Login or Register.1 reply
Age of Kings Heaven » Forums » AI & RM Scripting » RM Script Tutorial : Deer Hunt
Bottom
Topic Subject:RM Script Tutorial : Deer Hunt
local boi
Squire
(id: dragon14)
posted 06-07-18 02:36 AM CT (US)         
this tutorial requires userpatch 1.5 and will teach you how to create a deer spawner

In script, Deer spawn sharing tiles with wolves, then deer bug sends them to 0 0


PLAYER_SETUP
direct_placement is needed to use assign_to AT_[PLAYER|TEAM|COLOR] with land_position
effect_amount needs to be placed in PLAYER_SETUP

LAND_GENERATION
base_size makes a perfect square when paired with number_of_tiles 0

TERRAIN_GENERATION
spacing_to_other_terrain_types is used to create rings of different terrain

OBJECTS_GENERATION
terrain_to_place_on is used with the terrain rings from terrain_generation
resource_delta changes the time for each wave of wolves to decay, causing delayed waves of deer

CONNECTION_GENERATION
not necessary, but it was an easy way to connect the deer with players

First, create the deer and player land, the next step is to make rings of different terrain for the deer and wolves. Then spawn deer/wolf objects so that each successive ring has wolves with a higher resource_delta, so it takes longer to decay than the last. This effect causes several waves of deer to pass by players during the course of a game

/*--------------------------------------*/
/* Deer Season */
/*--------------------------------------*/

<PLAYER_SETUP>
direct_placement
#const SET_ATTRIBUTE 0 /* Type: Attribute Const */
#const AT_TEAM 2
#const ATTR_HITPOINTS 0
effect_amount SET_ATTRIBUTE DIRE_WOLF ATTR_HITPOINTS 0

<LAND_GENERATION>
base_terrain FOREST
create_land
{
terrain_type DIRT
land_position 90 90
zone 2
base_size 9
number_of_tiles 0
}
/*--------------------------------------*/
/* Player Lands */
/*--------------------------------------*/
create_land
{
terrain_type ICE
land_position 10 20
zone 2
base_size 10
number_of_tiles 0
assign_to AT_TEAM -10 0 0
}
create_land
{
terrain_type ICE
land_position 20 10
zone 2
base_size 10
number_of_tiles 0
assign_to AT_TEAM -10 0 0
}
<TERRAIN_GENERATION>
create_terrain DIRT2
{
base_terrain DIRT
number_of_clumps 99
land_percent 10
spacing_to_other_terrain_types 1
}
create_terrain DIRT3
{
base_terrain DIRT2
number_of_clumps 99
land_percent 10
spacing_to_other_terrain_types 1
}
create_terrain GRASS
{
base_terrain DIRT3
number_of_clumps 99
land_percent 10
spacing_to_other_terrain_types 1
}
create_terrain GRASS2
{
base_terrain GRASS
number_of_clumps 99
land_percent 10
spacing_to_other_terrain_types 1
}
create_terrain GRASS3
{
base_terrain GRASS2
number_of_clumps 99
land_percent 10
spacing_to_other_terrain_types 1
}
<OBJECTS_GENERATION>
/*--------------------------------------*/
/* PLAYER OBJECTS */
/*--------------------------------------*/

create_object TOWN_CENTER
{
set_place_for_every_player
min_distance_to_players 0
max_distance_to_players 0
}

create_object VILLAGER
{
set_place_for_every_player
min_distance_to_players 6
max_distance_to_players 6
}

create_object SCOUT
{
number_of_objects 1
set_place_for_every_player
min_distance_to_players 7
max_distance_to_players 9
}

/*--------------------------------------*/
/* First Wave */
/*--------------------------------------*/
create_object DEER
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on DIRT
}
create_object DIRE_WOLF
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on DIRT
resource_delta 2
}
/*--------------------------------------*/
/* Second Wave */
/*--------------------------------------*/
create_object DEER
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on DIRT2
}
create_object DIRE_WOLF
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on DIRT2
resource_delta 20
}
/*--------------------------------------*/
/* Third Wave */
/*--------------------------------------*/
create_object DEER
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on DIRT3
}
create_object DIRE_WOLF
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on DIRT3
resource_delta 40
}
/*--------------------------------------*/
/* Fourth Wave */
/*--------------------------------------*/
create_object DEER
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on GRASS
}
create_object DIRE_WOLF
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on GRASS
resource_delta 60
}
/*--------------------------------------*/
/* Fifth Wave */
/*--------------------------------------*/
create_object DEER
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on GRASS2
}
create_object DIRE_WOLF
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on GRASS2
resource_delta 80
}
/*--------------------------------------*/
/* Sixth Wave */
/*--------------------------------------*/
create_object DEER
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on GRASS3
}
create_object DIRE_WOLF
{
number_of_groups 99
number_of_objects 49
set_gaia_object_only
terrain_to_place_on GRASS3
resource_delta 100
}

<CONNECTION_GENERATION>

create_connect_all_lands
{
replace_terrain FOREST ICE
terrain_size ICE 10 0
}

USA
katsup or mustard

[This message has been edited by local boi (edited 06-07-2018 @ 08:05 PM).]

AuthorReplies:
local boi
Squire
(id: dragon14)
posted 06-09-18 00:45 AM CT (US)     1 / 1       
the map below has a controllable number of deer

/*--------------------------------------*/
/* DEER RUSH 2 */
/* JUN 08 2018 */
/* require userpatch 1.5 */
/* created by xthomas */
/*--------------------------------------*/
/*--------------------------------------*/
/* Start Script */
/*--------------------------------------*/
<PLAYER_SETUP>
direct_placement

start_random
percent_chance 100
#define OPEN_MAP
percent_chance 0
#define NOT_OPEN_MAP
end_random

#const AT_PLAYER 0
#const AT_COLOR 1
#const AT_TEAM 2

#const SET_ATTRIBUTE 0 /* Type: Attribute Const */
#const ATTR_HITPOINTS 0

effect_amount SET_ATTRIBUTE DIRE_WOLF ATTR_HITPOINTS 0

#const GAIA_SET_ATTRIBUTE -1
#const DEER_CLASS 909
#const ATTR_TERRAIN_ID 53
#const GAIA_UPGRADE_UNIT -4

effect_amount GAIA_SET_ATTRIBUTE DEER_CLASS ATTR_TERRAIN_ID 0/* Deer walk on water */

/*--------------------------------------*/
/* Define Lands */
/*--------------------------------------*/
if 1_PLAYER_GAME
start_random
percent_chance 50
#define LAND1
percent_chance 50
#define LAND2
end_random
elseif 2_PLAYER_GAME
#define LAND1
#define LAND2
elseif 3_PLAYER_GAME
#define LAND1
#define LAND2
start_random
percent_chance 50
#define LAND3
percent_chance 50
#define LAND4
end_random
elseif 4_PLAYER_GAME
#define LAND1
#define LAND2
#define LAND3
#define LAND4
elseif 5_PLAYER_GAME
#define LAND1
#define LAND2
#define LAND3
#define LAND4
start_random
percent_chance 50
#define LAND5
percent_chance 50
#define LAND6
end_random
elseif 6_PLAYER_GAME
#define LAND1
#define LAND2
#define LAND3
#define LAND4
#define LAND5
#define LAND6
elseif 7_PLAYER_GAME
#define LAND1
#define LAND2
#define LAND3
#define LAND4
#define LAND5
#define LAND6
start_random
percent_chance 50
#define LAND7
percent_chance 50
#define LAND8
end_random
elseif 8_PLAYER_GAME
#define LAND1
#define LAND2
#define LAND3
#define LAND4
#define LAND5
#define LAND6
#define LAND7
#define LAND8
endif

<LAND_GENERATION>

base_terrain SHALLOW

/*--------------------------------------*/
/* Terrain Consts */
/*--------------------------------------*/
#const PLAYER_TERRAIN_TYPE 32 /*--SNOW--*/


/*--------------------------------------*/
/* Deer run here */
/*--------------------------------------*/
create_land
{
land_position 0 0
terrain_type ICE
land_percent 100
base_size 14
border_fuzziness 6
zone 1
left_border 0
right_border 71
top_border 0
bottom_border 71
}
/*--------------------------------------*/
/* Deer Land */
/*--------------------------------------*/
create_land
{
terrain_type DESERT
number_of_tiles 0
base_size 4
land_position 99 13
top_border 0
left_border 99
right_border 0
bottom_border 99
clumping_factor 15
land_id 15
other_zone_avoidance_distance 10
zone 15
}

create_land
{
terrain_type DESERT
number_of_tiles 0
base_size 4
land_position 13 99
top_border 0
left_border 99
right_border 0
bottom_border 99
clumping_factor 15
land_id 15
other_zone_avoidance_distance 10
zone 15
}

/*--------------------------------------*/
/* Player Lands */
/*--------------------------------------*/
if 2_TEAM_GAME
start_random
percent_chance 50
#define TEAM_ONE_TWO
percent_chance 50
#define TEAM_TWO_ONE
end_random
endif

if LAND1
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(38,40) rnd(12,14)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 1 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 2 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 70
if TINY_MAP
top_border 4
elseif SMALL_MAP
top_border 4
elseif MEDIUM_MAP
top_border 5
elseif LARGE_MAP
top_border 6
elseif HUGE_MAP
top_border 7
elseif GIGANTIC_MAP
top_border 8
endif
right_border 0
left_border 0
}
endif

if LAND2
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(12,14) rnd(38,40)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 2 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 1 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 0
top_border 0
right_border 70
if TINY_MAP
left_border 4
elseif SMALL_MAP
left_border 4
elseif MEDIUM_MAP
left_border 5
elseif LARGE_MAP
left_border 6
elseif HUGE_MAP
left_border 7
elseif GIGANTIC_MAP
left_border 8
endif
}
endif

if LAND3
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(47,49) rnd(12,14)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 1 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 2 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 70
top_border 0
right_border 0
left_border 0
}
endif

if LAND4
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(12,14) rnd(47,49)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 2 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 1 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 0
top_border 0
right_border 70
left_border 0
}
endif

if LAND5
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(56,58) rnd(12,14)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 1 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 2 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 70
top_border 0
right_border 0
left_border 0
}
endif

if LAND6
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(12,14) rnd(56,58)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 2 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 1 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 0
top_border 0
right_border 70
left_border 0
}
endif

if LAND7
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(65,67) rnd(12,14)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 1 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 2 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 70
top_border 0
right_border 0
left_border 0
}
endif

if LAND8
create_land
{
terrain_type PLAYER_TERRAIN_TYPE
land_position rnd(12,14) rnd(65,67)
other_zone_avoidance_distance 10
zone 1
if TEAM_ONE_TWO
assign_to AT_TEAM 2 0 0
elseif TEAM_TWO_ONE
assign_to AT_TEAM 1 0 0
else
assign_to AT_TEAM -10 0 0
endif
base_size9
bottom_border 0
top_border 0
right_border 70
left_border 0
}
endif
<TERRAIN_GENERATION>
/*--------------------------------------*/
/* Deer Islands */
/*--------------------------------------*/
/* Place Introductory Deer on DESERT */
/* Place First Deer Wave on DIRT */
/* Place Second Deer Wave on DIRT2 */
/* Place Third Deer Wave on DIRT3 */
create_terrain DIRT
{
base_terrain DESERT
spacing_to_other_terrain_types 2
number_of_clumps 99
land_percent 99
}
create_terrain DIRT2
{
base_terrain DIRT
spacing_to_other_terrain_types 1
number_of_clumps 99
land_percent 99
}
create_terrain DIRT3
{
base_terrain DIRT2
spacing_to_other_terrain_types 1
number_of_clumps 99
land_percent 99
}
create_terrain JUNGLE
{
base_terrain DIRT3
spacing_to_other_terrain_types 1
number_of_clumps 99
land_percent 99
}

/*--------------------------------------*/
/* Water Patches */
/*--------------------------------------*/
create_terrain MED_WATER
{
base_terrain SHALLOW
number_of_clumps 45
land_percent 3
spacing_to_other_terrain_types 2
}
/*--------------------------------------*/
/* Main Forest */
/*--------------------------------------*/

/*--------------------------------------*/
/* DESTINATION */
/*--------------------------------------*/
create_terrain SHALLOW
{
base_terrain ICE
number_of_clumps 3
land_percent 100
}
create_terrain WATER
{
base_terrain SHALLOW
number_of_clumps 30
land_percent 3
}

<OBJECTS_GENERATION>

/*--------------------------------------*/
/* Deer Islands */
/*--------------------------------------*/
/* Place First Deer Wave on DIRT */
/* Place Second Deer Wave on DIRT2 Timer */
/* Place Third Deer Wave on DIRT3 Timer */
create_object DIRE_WOLF
{
number_of_groups 2
if HUGE_MAP
number_of_objects 17
elseif GIGANTIC_MAP
number_of_objects 17
else
number_of_objects 15
endif
group_placement_radius 7
temp_min_distance_group_placement 20
terrain_to_place_on DESERT
resource_delta 40
place_on_specific_land_id 15
}
create_object DIRE_WOLF
{
number_of_groups 2
if HUGE_MAP
number_of_objects 13
elseif GIGANTIC_MAP
number_of_objects 13
else
number_of_objects 11
endif
group_placement_radius 7
temp_min_distance_group_placement 20
terrain_to_place_on DIRT
resource_delta 80
place_on_specific_land_id 15
}
create_object DIRE_WOLF
{
number_of_groups 2
if HUGE_MAP
number_of_objects 10
elseif GIGANTIC_MAP
number_of_objects 10
else
number_of_objects 8
endif
group_placement_radius 5
temp_min_distance_group_placement 20
terrain_to_place_on DIRT2
resource_delta 120
place_on_specific_land_id 15
}
create_object DIRE_WOLF
{
number_of_groups 2
if HUGE_MAP
number_of_objects 3
elseif GIGANTIC_MAP
number_of_objects 3
else
number_of_objects 2
endif
group_placement_radius 2
temp_min_distance_group_placement 20
terrain_to_place_on DIRT3
resource_delta 120
place_on_specific_land_id 15
}
create_object DEER /* INTRODUCE MECHANIC */
{
number_of_groups 2
if TINY_MAP
number_of_objects 1
elseif SMALL_MAP
number_of_objects 2
elseif MEDIUM_MAP
number_of_objects 3
else
number_of_objects 4
endif
temp_min_distance_group_placement 20
terrain_to_place_on DESERT
}

create_object DEER /* FIRST WAVE */
{
number_of_groups 2
if TINY_MAP
number_of_objects 3
elseif SMALL_MAP
number_of_objects 6
elseif MEDIUM_MAP
number_of_objects 6
elseif LARGE_MAP
number_of_objects 9
else
number_of_objects 11
endif
group_placement_radius 7
temp_min_distance_group_placement 20
terrain_to_place_on DIRT
}
create_object DEER /* SECOND WAVE */
{
number_of_groups 2
if TINY_MAP
number_of_objects 2
elseif SMALL_MAP
number_of_objects 4
elseif MEDIUM_MAP
number_of_objects 4
elseif LARGE_MAP
number_of_objects 6
else
number_of_objects 8
endif
group_placement_radius 5
temp_min_distance_group_placement 20
terrain_to_place_on DIRT2
}
create_object DEER
{
number_of_groups 2
number_of_objects 2
group_placement_radius 2
temp_min_distance_group_placement 20
terrain_to_place_on DIRT3
}
/*--------------------------------------*/
/* Player Objects */
/*--------------------------------------*/
create_object TOWN_CENTER
{
set_place_for_every_player
min_distance_to_players 0
max_distance_to_players 0
}
create_object VILLAGER
{
set_place_for_every_player
min_distance_to_players 6
max_distance_to_players 6
}
create_object SCOUT
{
set_place_for_every_player
min_distance_to_players 7
max_distance_to_players 9
}
/* SPECIAL STUFF FOR REGICIDE */
if REGICIDE
create_object KING
{
set_place_for_every_player
min_distance_to_players6
max_distance_to_players6
}
endif

/*--------------------------------------*/
/* Near Food */
/*--------------------------------------*/
create_object SHEEP
{
number_of_objects 4
set_loose_grouping
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 9
max_distance_to_players 11
}
create_object FORAGE
{
number_of_objects 6
group_placement_radius 3
set_tight_grouping
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 10
max_distance_to_players 12
min_distance_group_placement 6
}
create_object BOAR
{
number_of_objects1
set_loose_grouping/* loose grouping, only 1 object? */
set_gaia_object_only
set_place_for_every_player
min_distance_to_players16
max_distance_to_players18
}
create_object BOAR
{
number_of_objects1
set_gaia_object_only
set_place_for_every_player
min_distance_to_players14
max_distance_to_players20
}
/*--------------------------------------*/
/* Extra Sheep */
/*--------------------------------------*/
create_object SHEEP
{
number_of_objects 2
number_of_groups 2
set_loose_grouping
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 14
max_distance_to_players 30
min_distance_group_placement 5
}

/*--------------------------------------*/
/* Main Gold */
/*--------------------------------------*/
create_object GOLD
{
number_of_objects 7
group_placement_radius 3
set_tight_grouping
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 12
max_distance_to_players 16
min_distance_group_placement 5
}
/*--------------------------------------*/
/* Main Stone */
/*--------------------------------------*/
create_object STONE
{
number_of_objects 5
group_placement_radius 2
set_tight_grouping
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 14
max_distance_to_players 18
min_distance_group_placement 5
}
/*--------------------------------------*/
/* Trees */
/*--------------------------------------*/
create_object OAKTREE
{
number_of_objects 2
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 4
max_distance_to_players 5
min_distance_group_placement 2
}
create_object OAKTREE
{
number_of_objects 3
set_gaia_object_only
set_place_for_every_player
min_distance_to_players 6
max_distance_to_players 8
min_distance_group_placement 2
}
if DEER_GHOST_LAKE
create_object SNOWPINETREE
elseif DEER_YUCATAN
create_object JUNGLETREE
elseif DEER_OASIS
create_object PALMTREE
else
create_object OAKTREE
endif
{
number_of_objects 49
min_distance_group_placement 6
set_scaling_to_map_size
}
/*--------------------------------------*/
/* Birds */
/*--------------------------------------*/
create_object RELIC
{
number_of_objects5
min_distance_to_players25
temp_min_distance_group_placement 20
}
create_object HAWK
{
number_of_objects 10
set_scaling_to_map_size
}
<CONNECTION_GENERATION>

<ELEVATION_GENERATION>

USA
katsup or mustard

[This message has been edited by local boi (edited 06-09-2018 @ 01:21 AM).]

You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames