Random map with 4 seasons,I have some problems on that...
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.
Random map with 4 seasons,I have some problems on that...
I want to make a random map with 4 seasons.
The season of this random map changes every 6 turns.Each season affects certain types of terrain.
Since I haven't made anything like that before, code may be messy.
I have two main problems on it.
Firstly, I don't know how to make the season change every 6 turns but not every turn.Every turn is too often for me
Secondly, the season remains changing into Spring every turn.It cannot change into other seasons.The cycle of season that I hope is:Spring > Summer > Autumn > Winter > Spring...
I failed to solve the problems myself.
If someone can teach me how to do, I really appreciate
The season of this random map changes every 6 turns.Each season affects certain types of terrain.
Since I haven't made anything like that before, code may be messy.
I have two main problems on it.
Firstly, I don't know how to make the season change every 6 turns but not every turn.Every turn is too often for me
Secondly, the season remains changing into Spring every turn.It cannot change into other seasons.The cycle of season that I hope is:Spring > Summer > Autumn > Winter > Spring...
I failed to solve the problems myself.
If someone can teach me how to do, I really appreciate
Code: Select all
[event]
name=prestart
{VARIABLE weather spring}
[/event]
[event]
name=new turn
first_time_only=no
[if]
[variable]
name=weather
equals=spring
[/variable]
[then]
[command]
{VARIABLE weather summer}
[/command]
[/then]
[/if]
[if]
[variable]
name=weather
equals=summer
[/variable]
[then]
[command]
{VARIABLE weather autumn}
[/command]
[/then]
[/if]
[if]
[variable]
name=weather
equals=autumn
[/variable]
[then]
[command]
{VARIABLE weather winter}
[/command]
[/then]
[/if]
[if]
[variable]
name=weather
equals=winter
[/variable]
[then]
[command]
{VARIABLE weather spring}
[/command]
[/then]
[/if]
[/event]
[event]
name=new turn
first_time_only=no
[if]
[variable]
name=weather
equals=spring
[/variable]
[then]
[command]
[message]
speaker=narrator
message=_ "Spring..."
[/message]
[terrain_mask]
x,y=1,1
{EMPTY_MASK}
[rule]
old=gi
terrain=g
[/rule]
[/terrain_mask]
[/command]
[/then]
[/if]
[if]
[variable]
name=weather
equals=summer
[/variable]
[then]
[command]
[message]
speaker=narrator
message=_ "Summer..."
[/message]
[terrain_mask]
x,y=1,1
{EMPTY_MASK}
[rule]
old=g
terrain=d
[/rule]
[/terrain_mask]
[/command]
[/then]
[/if]
[if]
[variable]
name=weather
equals=autumn
[/variable]
[then]
[command]
[message]
speaker=narrator
message=_ "Autumn..."
[/message]
[terrain_mask]
x,y=1,1
{EMPTY_MASK}
[rule]
old=d
terrain=w
[/rule]
[/terrain_mask]
[/command]
[/then]
[/if]
[if]
[variable]
name=weather
equals=winter
[/variable]
[then]
[command]
[message]
speaker=narrator
message=_ "Winter..."
[/message]
[terrain_mask]
x,y=1,1
{EMPTY_MASK}
[rule]
old=w
terrain=i
[/rule]
[/terrain_mask]
[/command]
[/then]
[/if]
[/event]
Last edited by savagust on May 22nd, 2006, 6:54 am, edited 1 time in total.
-
- Posts: 79
- Joined: September 24th, 2005, 10:46 am
- Location: Spain
- Contact:
take a look in the Despair and Decay campaign. i mean the Haunted Houses scenario. there we change some cave tiles depending on the time of day. however i had to count the turns, so i am pretty sure that you can use the same system for the season changes you wish. just make macros for every season and call them on the turn when you need them.
i will see if i can make an example this weekend but maybe you want try it for yourself, since i can't promise anything.
i will see if i can make an example this weekend but maybe you want try it for yourself, since i can't promise anything.
Imagine there's no countries
It isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
It isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
I am working on it smoothly with the suggestion of flava_clownsparr wrote:The trick is to use <ick>MATH</ick>!
if turns-((turns/4)*4)==0 then do_stuff_every_fourth_turn
this works because the division gets rounded. ive got a map with tides (water moves in and out every 2-4 turns) that uses this, ill try to dig it up and post the WML.
Thanks again, flava_clown
However, I still didn't know how to make the season change every 6 turns until now
May you post an example here?It would help a lot because I don't know where the equation should be added.
Thanks sparr
Code: Select all
[event]
first_time_only=no
name=new turn
{SETVAR temp format $turn_number}
{SETVAR temp add 2}
{SETVAR temp multiply .25}
{SETVAR temp multiply 4}
{SETVAR temp add -2}
[if]
[variable]
name=temp
numerical_equals=$turn_number
[/variable]
[then]
{LOWTIDE}
[/then]
[else]
{SETVAR temp format $turn_number}
{SETVAR temp multiply .25}
{SETVAR temp multiply 4}
[if]
[variable]
name=temp
numerical_equals=$turn_number
[/variable]
[then]
{HIGHTIDE}
[/then]
[/if]
[/else]
[/if]
[/event]