Movement Problem
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.
Movement Problem
I am learning WML, and am making a custom scenario based on a board game.
I am trying to simulate the rolling of dice at the beginning of each player's turn (players only get a leader, no recruiting).
I've tried all I can think of, including putting this in a foreach to make it work, it simply will not however.
This WILL randomly generate movement points for side 1, bu never does for sides 2-6
Thank you for any help you can offer
EDIT: Forgot to mention, I run the current latest stable version using Linux.
I am trying to simulate the rolling of dice at the beginning of each player's turn (players only get a leader, no recruiting).
I've tried all I can think of, including putting this in a foreach to make it work, it simply will not however.
Code: Select all
[event]
name=side turn
first_time_only=no
{RANDOM 2..12}
[store_unit]
[filter]
canrecruit=yes
side=$side_number
[/filter]
variable=leader
[/store_unit]
[object]
[filter]
name=$leader.name
[/filter]
[effect]
apply_to=movement
set=$random
[/effect]
silent=yes
[/object]
{CLEAR_VARIABLE leader}
[unstore_unit]
variable=leader
[/unstore_unit]
[/event]
Thank you for any help you can offer

EDIT: Forgot to mention, I run the current latest stable version using Linux.
Re: Movement Problem
I don't know exactly how I fixed it, but this seems to work for anyone who ends up searching for how to do this later on.
Code: Select all
[event]
name=side turn
first_time_only=no
{RANDOM 2..12}
[store_unit]
[filter]
canrecruit=yes
side=$side_number
[/filter]
variable=leaders
[/store_unit]
{FOREACH leaders i}
[object]
[filter]
id=$leaders[$i].id
[/filter]
[effect]
apply_to=movement
set=$random
[/effect]
[effect]
apply_to=moves
set=12
[/effect]
silent=yes
[/object]
{NEXT i}
{CLEAR_VARIABLE leaders}
[unstore_unit]
variable=leaders
[/unstore_unit]
[/event]
Re: Movement Problem
You store the unit into a variable, give the unit (not the stored unit in the variable) an object, and then overwrite the unit that just got the object by unstoring the stored unit on top of it. Just remove the [unstore_unit] and it'll probably work just fine.
And actually you don't even need to store the unit first, just put your [store_unit] [filter] contents into your [object] [filter].
And actually you don't even need to store the unit first, just put your [store_unit] [filter] contents into your [object] [filter].
Code: Select all
[event]
name=side turn
first_time_only=no
{RANDOM 2..12}
[object]
[filter]
canrecruit=yes
side=$side_number
[/filter]
[effect]
apply_to=movement
set=$random
[/effect]
silent=yes
[/object]
[/event]
Re: Movement Problem
Some message about number of allowed movement also be good. It can be pseudo-graphics with two cubes with numbers. Or some images, what you can paint and put to this message.
If you give player some button (context menu or two units, what looks like cobes(with event name=select)) to click to throw cubes, it will be +1 to your work.
If you give player some button (context menu or two units, what looks like cobes(with event name=select)) to click to throw cubes, it will be +1 to your work.