Axefighterr's 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.
User avatar
axefighterr
Posts: 27
Joined: May 1st, 2012, 9:16 am
Location: Poland
Contact:

Axefighterr's questions

Post by axefighterr »

Hello, I am now making an RPG scenario and I want to have an additional unit description availible on rmb. I tried to use [set_menu_item], but option appears everywhere on the map (it should only be active on a specyfic unit). :(

Here is my code (I addet it into the unit .cfg file):

Code: Select all

[event]
name=turn 1
   [set_menu_item]

        id=opismagaognia
      description= _ "Skill tree"

      image=icons/opis.png
        [show_if]


        [filter_location]

            [filter]
                type=wafiremage

                side=$side_number

            [/filter]

        [/filter_location]
 [/show_if]

        [command]

            [message]

                speaker=narrator

                side_for=$side_number

                caption=_ "Skill Tree"
               message= _ "Skill tree - description"

                image=fire_mage/portret.png
           [/message]
        [/command]

    [/set_menu_item]
[/event]
Anybody knows how to fix it? I will be grateful. ^_^
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Axefighterr's questions

Post by Ravana »

I believe filter_location returns true if there is at least one location matched. Better use

Code: Select all

        [show_if]
            [have_unit]
                side=$side_number
                x,y=$x1,$y1
                type=wafiremage
            [/have_unit]
        [/show_if]
or just something that uses $x1 and $y1.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Axefighterr's questions

Post by zookeeper »

User avatar
axefighterr
Posts: 27
Joined: May 1st, 2012, 9:16 am
Location: Poland
Contact:

Re: Axefighterr's questions

Post by axefighterr »

Ravana, thank you! :) Now when it works properly I am now able to finish my add-on. Again, thanks!

Fixed code for additional unit description if somebody is interested:

Code: Select all

[event]
name=turn 1
   [set_menu_item]

        id=<insert id here>
      description= _ "<description in rmb menu>"

      image=<path to the image in rmb menu>
        [show_if]
            [have_unit]
                side=$side_number
                x,y=$x1,$y1
                type=<unit id>
            [/have_unit]
        [/show_if]
        [command]

            [message]

                speaker=narrator

                side_for=$side_number

                caption=_ "<caption>"
               message= _ "<message>"

                image=<path to the image in the message>
           [/message]
        [/command]

    [/set_menu_item]
[/event]
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Axefighterr's questions

Post by Ravana »

type=<unit id>If you use unit id then you need id= not type=.
User avatar
axefighterr
Posts: 27
Joined: May 1st, 2012, 9:16 am
Location: Poland
Contact:

Re: Axefighterr's questions

Post by axefighterr »

Ravana, idk why, but code works and that matters. Another question: it is posiible to change unit level in scenario (like making lvl 50 Goblin Spearman)? And what are the tags in [modify unit] which are responsible for movement? I wanted to give that goblin 0 mp. I will be very grateful for any help. :roll:
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Axefighterr's questions

Post by Ravana »

Never relied on modify_unit, I only know how to do that with store_unit way.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Axefighterr's questions

Post by ChaosRider »

This should works (since unit type is changing while advancing (if unit not reached amla advances) this changed level value may change after lvlup).
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: Axefighterr's questions

Post by Astoria »

axefighterr wrote:Ravana, idk why, but code works and that matters. Another question: it is posiible to change unit level in scenario (like making lvl 50 Goblin Spearman)? And what are the tags in [modify unit] which are responsible for movement? I wanted to give that goblin 0 mp. I will be very grateful for any help. :roll:

Code: Select all

[modify_unit]
    [filter]
        type=Goblin Spearman
    [/filter]
    level=50
    moves=0 #sets current mp
    max_moves=0 #sets max mp
[/modify_unit]
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
axefighterr
Posts: 27
Joined: May 1st, 2012, 9:16 am
Location: Poland
Contact:

Re: Axefighterr's questions

Post by axefighterr »

Bumbadadabum, thanks for help! ^_^ Now I have another stupid problem:

Code: Select all

[event]
      name=prestart
      [modify_unit]
      [filter]
            type=Goblin Impaler
      [/filter]
	  max_hitpoints=500
	  hitpoints=500
    	level=50
    	moves=0 
    	max_moves=0 
[effect]
apply_to=attack
name=spear
range=ranged
increase_attacks=2
increase_damage=3
[/effect]
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES} 
[/abilities]
[/effect]
	  [/modify_unit]
[/event]
You see, I now I wanted to increase somewhat goblin's power (because he is the main boss) and i don't know why increasing damage and strikes and adding ability is not working. Any thoughts? :hmm:

Edit: Yet another question: how to block unit advancement in scenario?

Code: Select all

      [modify_unit]
      [filter]
            type=Ruffian
      [/filter]
	  max_hitpoints=100
	  hitpoints=100
	advances_to=null
	experience=100
	{AMLA_DEFAULT}
    	level=20
    	moves=0 
    	max_moves=0 
	  [/modify_unit]
This theoretically works, but not as i wanted. Unit does not lvl up, but still has blue exp bar and can have things like 15/13 xp. Thanks in advance.
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Axefighterr's questions

Post by beetlenaut »

axefighterr wrote:Unit does not lvl up, but still has blue exp bar and can have things like 15/13 xp. Thanks in advance.
Yes, you can give a unit more than its max_experience with WML. It will resolve automatically when that unit fights, or you can do it in an event with store and unstore. (By default, unstore advances units if they come back with too much XP.)

I'm not sure what's going on with your modify_unit; the documentation isn't very clear. Try modifying just one thing at a time (just the max_hitpoints for example) and see if you can get it to work. Then, as you add back the items one at a time, it will be obvious which part doesn't work.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
axefighterr
Posts: 27
Joined: May 1st, 2012, 9:16 am
Location: Poland
Contact:

Re: Axefighterr's questions

Post by axefighterr »

Okay, I will just avoid using units without AMLA as guardians. But there is still a problem: how to give unit placed on the map an ability? In this case, regeneration. And how upgrade this unit's strikes and/or damage? I have this in my scenario:

Code: Select all

[multiplayer]
    id=watest
    name= _ "WA 2p Test"
    description= _ "This is a scenario designed to test units. For developers only."
    map_data="{~add-ons/Wesnoth_Adventures/maps/test.map}"
    turns=-1
    experience_modifier=100%
    random_start_time=no
    victory_when_enemies_defeated=yes
    {DEFAULT_SCHEDULE}

{SCENARIO_MUSIC weight_of_revenge.ogg} 

    [side]
        side=1
        canrecruit=yes
        controller=human
        income=0
        gold=0
        village_gold=0
        team_name="heroes"
        user_team_name= _ "Heroes"
        fog=no
        shroud=no
    [/side]

    [side]
        side=2
        canrecruit=yes
        controller=human
        gold=0
        income=0
        village_gold=0
        team_name="heroes"
        user_team_name= _ "Heroes"
        fog=no
        shroud=no
    [/side]

    [side]
        id=wrogowie
        name="Grinx"
        type=Goblin Impaler
        side=3
        canrecruit=yes
        controller=ai
        gold=0
        village_gold=0
        color=black
        income=0
        team_name="enemies"
        user_team_name= _ "Enemies"
        fog=no
        shroud=no
        allow_player=false
    [/side]

[event]
      name=prestart
        {UNIT 3 "Giant Mudcrawler" 3 7 ()}{GUARDIAN}
        {UNIT 3 "Orcish Slayer" 3 3 ()}{GUARDIAN}
      [modify_side]
        side=1
        gold=0
        income=-2
        village_gold=0
      [/modify_side]
      [modify_side]
        side=2
        gold=0
        income=-2
        village_gold=0
      [/modify_side]
      [modify_side]
        side=3
        gold=0
        income=-2
        village_gold=0
      [/modify_side]

      [modify_unit]

      [filter]
            x=9
            y=5
      [/filter]
	  max_hitpoints=500
	  hitpoints=500
    	level=50
    	moves=0 
    	max_moves=0 
[/modify_unit]

      [modify_unit]
      [filter]
	x=3
	y=7
      [/filter]
	  max_hitpoints=100
	  hitpoints=100
    	moves=0 
    	max_moves=0 
[/modify_unit]

      [modify_unit]
      [filter]
	x=3
	y=3
      [/filter]
	  max_hitpoints=100
	  hitpoints=100
    	moves=0 
    	max_moves=0 
[/modify_unit]

[/event]

[event]
      name=start

      [message]
            speaker=narrator
            message= _ "This is a test map."
      [/message]
[/event]

[objectives]
            
[objective]
 
description= _ "Defeat Grinx"
       
condition=win
            
[/objective]

            
[objective]
                
description= _ "Death of all heroes"
                
condition=lose
            
[/objective]

            
[/objectives]

[/multiplayer]
Additionally, default objectives are shown at the beginning of the scenario, instead of mine. And the last question: how to make a conversation between leader of side 1 and side 2?
User avatar
vultraz
Developer
Posts: 960
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: Axefighterr's questions

Post by vultraz »

The [objectives] tag cannot be at toplevel. You need to put it in your prestart or start event.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
User avatar
axefighterr
Posts: 27
Joined: May 1st, 2012, 9:16 am
Location: Poland
Contact:

Re: Axefighterr's questions

Post by axefighterr »

Thanks for help, now I have problem with dialogs. While units from default have their transparent portrait shown, my heroes are shown with the small, black versions. I don't know how to fix this. Thanks in advance. :)

Code: Select all

[multiplayer]
    id=watest
    name= _ "WA 2p Test"
    description= _ "This scenario was designed for testing purposes. For testers and developers only.

Author: AxeFighter"
    map_data="{~add-ons/Wesnoth_Adventures/maps/test.map}"
    turns=-1
    experience_modifier=100%
    random_start_time=no
    victory_when_enemies_defeated=yes
    {DEFAULT_SCHEDULE}

{SCENARIO_MUSIC weight_of_revenge.ogg} 

    [side]
        side=1
        canrecruit=yes
        controller=human
        income=0
        gold=0
        village_gold=0
        team_name="heroes"
        user_team_name= _ "Heroes"
        fog=no
        shroud=no
    [/side]

    [side]
        side=2
        canrecruit=yes
        controller=human
        gold=0
        income=0
        village_gold=0
        team_name="heroes"
        user_team_name= _ "Heroes"
        fog=no
        shroud=no
    [/side]

    [side]
        id=wrogowie
        name="Grinx"
        type=Goblin Impaler
        side=3
        canrecruit=yes
        controller=ai
        gold=0
        village_gold=0
        color=black
        income=0
        team_name="enemies"
        user_team_name= _ "Enemies"
        fog=no
        shroud=no
        allow_player=false
    [/side]

   [event]
      name=prestart
      [objectives]
         side=0
         [objective]
            description= _ "Defeat Grinx"
            condition=win
         [/objective]
         [objective]
            description= _ "Death of all heroes"
            condition=lose          
         [/objective]
      [/objectives]

      name=prestart
      [modify_side]
        side=1
        gold=0
        income=-2
        village_gold=0
      [/modify_side]
      [modify_side]
        side=2
        gold=0
        income=-2
        village_gold=0
      [/modify_side]
      [modify_side]
        side=3
        gold=0
        income=-2
        village_gold=0
      [/modify_side]

[modify_unit]
      [filter]
            x=9
            y=5
      [/filter]
    level=50
[/modify_unit]

      [object]
         [filter]
            x,y=9,5
         [/filter]
         silent=yes
         [effect]
            apply_to=movement
            set=0
         [/effect]
         [effect]
            apply_to=hitpoints
            increase_total=974
            heal_full=yes
         [/effect]
         [effect]
            apply_to=new_ability
            [abilities]
               {ABILITY_REGENERATES}
            [/abilities]
         [/effect]
         [effect]
            apply_to=attack
	range=ranged
            increase_damage=3
         [/effect]
         [effect]
            apply_to=attack
	range=ranged
            increase_attacks=2
         [/effect]
      [/object]

	   {PICKUPPABLE_ITEM cloak_of_power 3 3 () items/cloak-green.png
     _"This cloak emanates a strong magical energy. Do you want to pick it up?"
     _"cloak of courage^Take it"
     _"cloak of courage^Leave it"
     _"You can't use this item." (
     [object]
		name= _ "Cloak of Power"
		image=icons/cloak_leather_brown.png
		description= _ "This magical cloak gives the wearer additional 1 point to damage and movement and also 4 to hitpoints."
			[not]
				side=3
			[/not]
		[effect]
			apply_to=attack
			increase_damage=1
		[/effect]
		[effect]
			apply_to=hitpoints
			increase_total=4
			increase=4
		[/effect]
		[effect]
			apply_to=movement
			increase=1
		[/effect]
     [/object]
 )}

	   {PICKUPPABLE_ITEM ring_of_hp 3 7 () items/ring-red.png
     _"This red ring emanates a calming warmth. Do you want to pick it up?"
     _"ring of HP^Take it"
     _"ring of HP^Leave it"
     _"You can't use this item." (
     [object]
         name= _ "Ring of Health"
         image=icons/ring_red.png
         description= _ "This ring provides additional 14 hitpoints to the person wearing it."
			[not]
				side=3
			[/not]
         [effect]
             apply_to=hitpoints
             increase_total=14
	 increase=14
         [/effect]
     [/object]
 )}
[/event]

[event]
      name=start
      [message]
            speaker=narrator
            message= _ "This is a test scenario. It should be used to test new characters, items, etc."
            image=wesnoth-icon.png
      [/message]
      [message]
canrecruit=yes
side=1
            message= _ "We must kill that goblin!"
      [/message]
      [message]
canrecruit=yes
side=2
            message= _ "You are right!"
      [/message]
[/event]

[event]
      name=attack

      [filter]
            side=1,2
      [/filter]

      [filter_second]
            side=3
      [/filter_second]

      [message]
            speaker=unit
            message= _ "You will die now!"
      [/message]      
      [message]
            speaker=second_unit
            message= _ "You cannot beat me, I am invincible!"
      [/message]
[/event]

[/multiplayer]
To clarify this is the code for my mage:

Code: Select all

#textdomain wesnoth-units
[unit_type]
    id=wafiremage
    name= _ "Fire Mage"
    race=wahuman
    image="fire_mage/magognia.png"
    profile="fire_mage/portretczarny.png"
    {MAGENTA_IS_THE_TEAM_COLOR}
    hitpoints=34
    movement_type=smallfoot
    movement=5
    experience=12
    level=1
    alignment=lawful
    cost=100
    usage=hero
    description= _ "Fire mages are known by many people due to their power to control fire. They can destroy their enemies with fireballs, make light in the darkness and also summon meteorites from outer space. To counter drakes, which are highly resistant to fire they have also darts in their arsenal. Fire mages are mostly concentrating at ranged fighting, but some of them developed good melee capabilities and ability to summon flaming sword. 

Unit creator: AxeFighter"

    [resistance]
	fire=80
    [/resistance]

    [portrait]
        size=400
        side="left"
        mirror="false"
        image="fire_mage/portret.png"
    [/portrait]
    [portrait]
        size=400
        side="right"
        mirror="true"
        image="fire_mage/portret.png"
    [/portrait]
...
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Axefighterr's questions

Post by beetlenaut »

Use profile= to select the portrait. The portrait tag is for internal use, and when it conflicts with the profile, the profile is the one that is chosen (apparently). You don't need the portrait tag at all.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply