Conveniently creating location arrays
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Conveniently creating location arrays
Hello,
Is there a way to store location in such a way that I can loop through every hex?
My intention is to fill a space with random elements, without making a lengthy WML block.
This is more or less what I am trying to achieve:
Thank you.
Is there a way to store location in such a way that I can loop through every hex?
My intention is to fill a space with random elements, without making a lengthy WML block.
This is more or less what I am trying to achieve:
Code: Select all
[store_locations]
name=orchard
x=22,23,24,25,21,22,23,24,26,25
y=28,29,29,30,29,29,30,30,30,31
[/store_locations]
[foreach]
array=orchard
[do]
[set_variable]
name=treesize
rand=72,70,68,66,64,62
[/set_variable]
[item]
x=$this.item.x
y=$this.item.y
image=scenery/oak-leaning.png~SCALE($treesize,$treesize)
[/item]
[/do]
[/foreach]
Re: Conveniently creating location arrays
Ok, solved. Thanks anyway.
Code: Select all
[store_locations]
variable=orchard
x=22,23,24,25,21,22,23,24
y=28,29,29,30,29,29,30,30
[/store_locations]
[foreach]
array=orchard
[do]
[set_variable]
name=treesize
rand=72,70,68,66,64,62
[/set_variable]
[item]
x,y=$this_item.x,$this_item.y
image=scenery/oak-leaning.png~SCALE($treesize,$treesize)
[/item]
[/do]
[/foreach]