3 little questions

The place to post your WML questions and answers.

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.
Post Reply
Nitzer
Posts: 13
Joined: February 21st, 2005, 5:37 pm
Location: Germany

3 little questions

Post by Nitzer »

HI

Here are some questions:

1. Is there a list of all the macros in the game? The use seems to be very common. But some I just cant figure out.

2. Whats the advantage of creating a story.cfg? It works perfectly if I include it just in the scenario file.

3. I guess this one has been asked a bazillion times, but i did not find a solution. I want to create a unit that is poisoned, and stay this way - even if moved to a village. Or it should be automatically re poisoned when it leaves the village.

I tryed some Ideas, but none did work.

First try:

Code: Select all

[event]
  name=new turn
		first_time_only=no
		[filter]
		description=Maria
		[/filter]
		[status]
		poisoned=on
		[/status]
[/event]
second:

Code: Select all

[event]
	name=new turn
	first_time_only=no
  	[store_unit]
		[filter]
		description=Maria
		[/filter]
		[status]
		poisoned=on
		[/status]
	[/store_unit]

	[unstore_unit]
		[filter]
		description=Maria
		[/filter]
	[/unstore_unit]
[/event]
third

Code: Select all

[event]
	name=new turn
	first_time_only=no
  	[store_unit]
		[filter]
		description=Maria
		[/filter]
		[status]
		poisoned=on
		[/status]
	[/store_unit]

[set_variable]
name=unit_store.status.poisoned
value=yes
[/set_variable]

	[unstore_unit]
		[filter]
		description=Maria
		[/filter]
	[/unstore_unit]
[/event]
Nitzer
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: 3 little questions

Post by zookeeper »

Nitzer wrote:1. Is there a list of all the macros in the game? The use seems to be very common. But some I just cant figure out.
Check data/utils.cfg. Personally I think the file has lots of useless stuff, and could need some updating.
Nitzer wrote:2. Whats the advantage of creating a story.cfg? It works perfectly if I include it just in the scenario file.
I've never understood why someone would put the [story] things in a separate file. It just makes zero sense to me.
Nitzer wrote:3. I guess this one has been asked a bazillion times, but i did not find a solution. I want to create a unit that is poisoned, and stay this way - even if moved to a village. Or it should be automatically re poisoned when it leaves the village.

I tryed some Ideas, but none did work.
You're not using [store_unit] correctly. In the last one, the [filter] part is ok, but you do not provide the key variable in the [store_unit]. Here is what you need:

Code: Select all

[event]
    name=new turn
    first_time_only=no
    
    [store_unit]
        [filter]
            description=Maria
        [/filter]

        variable=stored_Maria   #The variable into which to store the unit
        kill=yes   #[unstore_unit] will restore the unit, so no worries
    [/store_unit]

    [set_variable]
        name=stored_Maria.status.poisoned   #The variable we're setting
        value=on   #poisoned if 'on', the unit loses 8 HP each turn.
    [/set_variable]

    [unstore_unit]
        variable=stored_Maria
    [/unstore_unit]
[/event]
What keys and tags are needed inside each tag are described in ReferenceWML, it's a good idea to check from there that you have everything right, especially if you're new to WML.

This is how I'd make a unit always be poisoned:

Code: Select all

    [event]
        name=side turn
        first_time_only=no

        [if]
            [variable]
                name=side_number
                equals=1
            [/variable]

            [then]
                {MODIFY_UNIT description=Maria status.poisoned on}
            [/then]
        [/if]
    [/event]

    [event]
        name=moveto
        first_time_only=no

        [filter]
            description=Maria
        [/filter]

        {MODIFY_UNIT description=Maria status.poisoned on}
    [/event]
The name=moveto event is just there to poison the unit again when it leaves a village. When the unit starts the turn in a village, it isn't shown to be poisoned (and this actually can't be helped in anyway), so the moveto event just takes care that the poison becomes visible again if the unit moves. The actual effect remains the same, however.

The MODIFY_UNIT macro, which I find incredibly handy, is from the WML Utilities page (inside the UsefulWMLFragments page).
Nitzer
Posts: 13
Joined: February 21st, 2005, 5:37 pm
Location: Germany

Post by Nitzer »

Hey,

Thanks, even more for the accurate explaining. Works perfectly, and the util file is what i am was looking for.

Nitzer
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Re: 3 little questions

Post by Noyga »

zookeeper wrote:
Nitzer wrote:1. Is there a list of all the macros in the game? The use seems to be very common. But some I just cant figure out.
Check data/utils.cfg. Personally I think the file has lots of useless stuff, and could need some updating.
There is also some description on the Wiki IIRC
zookeeper wrote:
Nitzer wrote:2. Whats the advantage of creating a story.cfg? It works perfectly if I include it just in the scenario file.
I've never understood why someone would put the [story] things in a separate file. It just makes zero sense to me.
It can be useful fo readability... If your story is quite huge, you don't have to scroll a lot down if you just intend to modify the rest of the scenario.
Post Reply