Generalized RANDOM_FEATURE_PLACEMENT is working.
This commit is contained in:
parent
96177d84bf
commit
14c73ffba8
1 changed files with 29 additions and 13 deletions
|
@ -72,7 +72,10 @@
|
|||
[event]
|
||||
name="prestart"
|
||||
|
||||
#define RANDOM_FEATURE_PLACEMENT X_SPAN Y_SPAN TERRAIN_PATTERN IMAGE MOD_WML
|
||||
#define RANDOM_FEATURE_PLACEMENT X_SPAN Y_SPAN FILTER NUMBER IMAGE MOD_WML
|
||||
# Place NUMBER copies of the IMAGE on hexes matching FILTER in the
|
||||
# region specified by X_SPAN and Y_SPAN. Insert MODE_WL in the image
|
||||
# declaration (useful for alpha hacks).
|
||||
[store_locations]
|
||||
x={X_SPAN}
|
||||
y={Y_SPAN}
|
||||
|
@ -82,23 +85,36 @@
|
|||
|
||||
{VARIABLE_OP random_string format "0..$random_placement_locations.length"}
|
||||
|
||||
{RANDOM $random_string}
|
||||
{VARIABLE REPEAT_i 0}
|
||||
|
||||
{VARIABLE_OP random_placement_x format "$random_placement_locations[$random].x"}
|
||||
{VARIABLE_OP random_placement_y format "$random_placement_locations[$random].y"}
|
||||
[while]
|
||||
[variable]
|
||||
name=REPEAT_i
|
||||
less_than={NUMBER}
|
||||
[/variable]
|
||||
|
||||
[do]
|
||||
{RANDOM $random_string}
|
||||
|
||||
{VARIABLE_OP random_placement_x format "$random_placement_locations[$random].x"}
|
||||
{VARIABLE_OP random_placement_y format "$random_placement_locations[$random].y"}
|
||||
|
||||
[item]
|
||||
image={IMAGE}
|
||||
x,y=$random_placement_x,$random_placement_y
|
||||
{MOD_WML}
|
||||
[/item]
|
||||
|
||||
{VARIABLE_OP REPEAT_i add 1}
|
||||
[/do]
|
||||
[/while]
|
||||
|
||||
{CLEAR_VARIABLE REPEAT_i}
|
||||
|
||||
{CLEAR_VARIABLE random_placement_locations}
|
||||
|
||||
{UNIT_WML}
|
||||
|
||||
[item]
|
||||
image={IMAGE}
|
||||
x,y=$random_placement_x,$random_placement_y
|
||||
{MOD_WML}
|
||||
[/item]
|
||||
#enddef
|
||||
|
||||
{RANDOM_FEATURE_PLACEMENT 1-44 1-30 Gg scenery/pine1.png ()}
|
||||
{RANDOM_FEATURE_PLACEMENT 1-44 1-30 (terrain=Gg) 20 scenery/pine1.png ()}
|
||||
|
||||
[unit]
|
||||
type=Gryphon Rider
|
||||
|
|
Loading…
Add table
Reference in a new issue