[remove_shroud] and [terrain] question

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
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Game crushes when trying my add-on

Post by Paulomat4 »

well, that's what i get out of this error message:
Attachments
Sans titre.png
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Nested quoted string error

Post by SkyOne »

Error messages do not always point out what we exactly want to fix. It seems the error is somewhere on scenario 3, though. You can post it.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Nested quoted string error

Post by Paulomat4 »

sure, here it is:

Code: Select all

[scenario]
  id=03_valley_of_death
  next_scenario=04_royal_court
 
  name= _ "Valley of death"
  map_data="{~add-ons/Rise_of_the_second_sun/maps/03_valley_of_death.map}"
  turns=-1 
  {DEFAULT_SCHEDULE}
  music=battle.ogg
  victory_when_enemies_defeated=no
  
    [event]
    name=prestart
    [objectives]
      side=1
      [objective]
        description= _ "Move Fiannon to the signpost"
        condition=win
      [/objective]
      [objective]
        description= _ "Defeat all enemies (Bonus)"
        condition=win
      [/objective]
      [objective]
        description= _ "Death of Fiannon"
        condition=lose
      [/objective]
	  [objective]
        description= _ "Death of Naia"
        condition=lose
      [/objective]
	  [objective]
        description= _ "Death of Nàriël"
        condition=lose
      [/objective]
    [/objectives]
	{PLACE_IMAGE scenery/monolith3.png 31 32}
	{PLACE_IMAGE scenery/signpost.png 39 1}
	[recall]
        id=Alasar
		x=9
        y=39
    [/recall]
	[recall]
        id=Naia
		x=8
        y=39
    [/recall]
    [/event]
  
    [story]
        [part]
            story= _ "While walking to the Aethenwood, where the royal family resided, Fiannon was thinking of the first time he entered these woods. It was one of his first memorys. He was walking next to his mother an elvish sorceress guiding him to the King"
            background=story/forestpath.jpg
        [/part]
        [part]
            story=_"She later told him, that she found him a bit outside the forest, sitting next to three wolfcadavers, apparently burned to death. His adopted mother, an elvish sorceress, soon recognized the magical talent this child had inherited."
            background=story/forestpath.jpg
        [/part]
        [part]
            story=_"During his childhood, she helped him to develop this magic which resulted in a powerful magical attack."
            background=story/map.png
        [/part]
    [/story]
   {BIGMAP_VALLEY_OF_DEATH}
   
   [side]
    side=1
    controller=human
    team_name=1
    user_team_name= _ "Elves"

    type=Elvish Thunderer
    id=Fiannon
    name= _ "Fiannon"
	profile=portraits/Fiannon.png
    canrecruit=yes

    recruit=Elvish Fighter,Elvish Archer,Elvish Shaman,Elvish Scout
    {INCOME 2 0 -2}
    {FLAG_VARIANT long}
    [/side]
	
	[side]
    side=2
    controller=ai
    team_name=1
    user_team_name= _ "Elves"

    type=Elvish Druid
    id=Nàriël
    name="Nàriël"
	profile=portraits/Nariel.png
	unrenameble=yes
	[modifications]
    {TRAIT_AGED2}
	[/modifications]
    canrecruit=yes
    {GOLD 250 200 150}
    recruit=Elvish Shaman
    {INCOME 2 0 -2}
    {FLAG_VARIANT long}
	[village]
    x=19
    y=15
    [/village]
	[village]
    x=21
    y=10
    [/village]
	[village]
    x=14
    y=12
    [/village]
	[village]
    x=26
    y=17
    [/village]
	[village]
    x=22
    y=17
    [/village]
    [/side]
	
	[side]
    side=3
    controller=ai
    team_name=2
    user_team_name= _ "Elvish Ghosts"
	no_leader=yes
	[ai]
    village_value=0
    [goal]
    name=target_location
    [criteria]
        x,y=21,15
    [/criteria]
    value=5
    [/goal]
    [/ai]
	{MICRO_AI_GOTO}
	[/side]
	
	{DEATHS}	
		
	[event]
        name=moveto
        [filter]
            x=39
            y=1
            id=Fiannon
        [/filter]
		[message]
		speaker=Fiannon
		message= _ "Onwards, we need to continue to the Royal Court!"
		[/message]
		[message]
		speaker=Naia
		message= _ "That was about time."
		[/message]
		[message]
		speaker=Naia
		message= _ "But i feel bad, about leaving behind Nàriël and her shamans."
		[/message]
		[message]
		speaker=Nàriël
		message= _ "Don't worry, we'll be fine."
		[/message]
		[message]
		speaker=Nàriël
		message= _ "Goodbye, young warrior. I need to stay here, to guard this valley.""
		[/message]
		[message]
		speaker=Nàriël
		message= _ "I hope we'll see again in better times."
		[/message]
		[message]
		speaker=M'Brin
		message= _ "Ha, flee, fool. You may escape me, but I'll find you, and then you won't be able to flee."
		[/message]
		[endlevel]
		result=victory
		[/endlevel]
	[/event]
	
	[event]
        name=die
        [filter]
            id=M'Brin
        [/filter]
		[message]
		speaker=second_unit
		message= _ "Die, traitor of your own kin!"
		[/message]
		[message]
		speaker=M'Brin
		message= _ "You, the elves, are the real traitors. You helped killing me when I died for the second time! "
		[/message]
		[message]
		speaker=M'Brin
		message= _ "Pah, I'll rise again. There's no way you could banish me forever! "
		[/message]
		[message]
		speaker=Fiannon
		message= _ "Is that true? Could he come back? And who is he?"
		[/message]
		[message]
		speaker=Nàriël
		message= _ "Yes, he can, as long as he finds a necromancer willing to do it. He's an incredibly powerful and old soul. He was born two millenniums ago and during his first lifetime he was one of our wisest sages."
		[/message]
		[message]
		speaker=Nàriël
		message= _ "But he assisted to the betrayal of the humans short, after their landing on our cost. "
		[/message]
		[message]
		speaker=Nàriël
		message= _ "And when he was killed for the first time by human rogues, he became so mad, that he came back in unlife and sweared to kill all men... "
		[/message]
		[message]
		speaker=Naia
		message= _ "Ugh"
		[/message]
		[message]
		speaker=Nàriël
		message= _ "... Some Elves were with him, but most followed Ethiliel one of our shydes, who worked together with a young human knight to defeat M'Brin. "
		[/message]
		[message]
		speaker=Nàriël
		message= _ "But it seems like M'Brin has risen again. And this time he was out for vengeance."
		[/message]
		[message]
		speaker=Alasar
		message= _ "What a nice coeval"
		[/message]
		[clear_variable]
            name=M'Brin_living
			value=0
        [/clear_variable]
	[/event]
	
	[event]
	    name=die
		[filter]
		    id=Nàriël
		[/filter]
		[message]
		speaker=Nàriël
		message= _ "Nooo! who will protect this valley now?"
		[/message]
	    [endlevel]
		result=defeat
		[/endlevel]
	[/event]
	
	[event]
        name=moveto
        [filter]
            x=31
            y=32
        [/filter]
		[message]
		speaker=narrator
		message= _ "In Memory of one of our greatest sages, who fell into Darkness"
		[/message]
		[message]
		speaker=unit
		message= _ "Pah!"
		[/message]
		[message]
		speaker=unit
		message= _ "(spits on the stone)"
		[/message]
		[message]
		speaker=unit
		message= _ "May he rest forever."
		[/message]
	[/event]
	
	[event]
	    name=turn 7
		[scroll_to]
		    x=33
		    y=33
		[/scroll_to]
	    [unit]
		    id=M'Brin
			type=Elvish Forefather
            [modifications]
            {TRAIT_MIGHTY}
        	[/modifications]
            name="M'Brin"
           	profile=portraits/M'Brin.png
			unrenameble=yes
			random_traits=no
            side=3
            x=33
            y=33
			canrecruit=yes
		[/unit]
		[micro_ai]
            side=3
            ai_type=goto
            action=add
            ca_id=M'Brin
			release_unit_at_goal=yes
            [filter]
                id=M'Brin
            [/filter]
            [filter_location]
                x,y=24,21
            [/filter_location]
        [/micro_ai]
		[message]
	    	speaker=M'Brin
	    	message= _ "I have arriven. Now i will finally get my revenge on you, elves."
		[/message]
		[message]
	    	speaker=Fiannon
	    	message= _ "Revenge? What have we done to you?"
		[/message]
		[message]
	    	speaker=M'Brin
	    	message= _ "You, the elves, my own people betrayed me!"
		[/message]
		[message]
	    	speaker=M'Brin
	    	message= _ "For these pesty humans!"
		[/message]
		[message]
	    	speaker=M'Brin
	    	message= _ "What is this?"
		[/message]
		[message]
		    speaker=M'Brin
		    message= _ "I can sense, that there is at least one of these damned humans in this valley."
		[/message]
		[message]
		    speaker=M'Brin
		    message= _ "You all will perish!"
		[/message]
	    [set_variable]
            name=MBrin_living
			value=0
        [/set_variable]
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
	[/event]
	
	[event]
	    name=turn 2
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
	    [message]
		speaker=Nàriël
		message= _ "Here come the first. You need to decide now."
		[/message]
	    [message]
		speaker=Nàriël
		message= _ "Do you want to flee now, or do you fight?"
		[/message]
	[/event]
	
	[event]
	    name=turn 12
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
	[/event]
	
	[event]
	    name=turn 17
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
	[/event]
	
	[event]
	    name=turn 22
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
	[/event]
	
	[event]
	    name=turn 27
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
	[/event]
	
	[event]
	    name=turn 32
		{LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 6}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Ancestor) 40 10}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 40 13}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 12 1}
        {LOYAL_UNDEAD_UNIT 3 (Soulless) 15 1}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 14 2}

        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit) 1 19}
        {LOYAL_UNDEAD_UNIT 3 (Skeleton Archer) 1 15}
        {LOYAL_UNDEAD_UNIT 3 (Elvish Warrior Spirit )2 7}

        {LOYAL_UNDEAD_UNIT 3 (Skeleton) 1 11}
		[set_variable]
        name=last_wave
        value=1
        [/set_variable]
	[/event]
	
	[event]
	    name=turn 2
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 4
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 6
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 8
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 10
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 12
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 14
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 16
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 18
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 20
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 22
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 24
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 26
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 28
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 30
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	[event]
	    name=turn 32
		{LOYAL_UNDEAD_UNIT 3 (Walking Corpse) 1 31}
	[/event]
	
	[event]
    name=side turn
    first_time_only=no
        [filter_condition]
            [not]
                [have_unit]
                    side=3
                [/have_unit]
            [/not]
			[variable]
				name=last_wave
                greater_than=0
            [/variable]
        [/filter_condition]
		
		[message]
		    speaker=Fiannon
	    	message= _ "These should have been the last. They can't terrorize this valley anymore! We must continue to the royal court now."
		[/message]
		[message]
	    	speaker=Nàriël
	    	message= _ "Yes, and I think that we'll come with you. New dangers will come, and apparently we aren't safe in this valley."
		[/message]

	   [modify_unit]
		    [filter]
		        id=Nàriël
		    [/filter]
	    	side=1
		    {TRAIT_LOYAL}
		    {IS_LOYAL}
		    canrecruit=no
		    [event]
	            name=post advance
	            [modify_unit]
	                [filter]
	                    id=Nàriël
	                [/filter]
	                profile=portraits/Nariel_wings.png
	            [/modify_unit]
            [/event]
		[/modify_unit]
		
		[endlevel]
            result=victory
            bonus=no
            {NEW_GOLD_CARRYOVER 40}
        [/endlevel]
    [/event]
	
	[event]
	    name=start
		[message]
		    speaker=narrator
		    message= _ "After leaving the Southwood, our heroes entered a peaceful valley..."
	    [/message]
	    [message]
		    speaker=Nàriël
		    message= _ "Welcome travellers, to the vale of tears."
	    [/message]
	    [message]
		    speaker=Fiannon
		    message= _ "Good to see some Elves. May we rest here for a while?"
	    [/message]
	    [message]
		    speaker=Fiannon
		    message= _ "We are coming from the edge of the Southwood, and we need to speak to the King."
	    [/message]
	    [message]
		    speaker=Nàriël
		    message= _ "I fear, that you won't be able to rest. I can feel Undeads coming in waves from all side. "
	    [/message]
	    [message]
		    speaker=Nàriël
		    message= _ "You could try to break through in the North-east, we will engage them, while you flee."
	    [/message]
	    [message]
	    	speaker=Naia
	    	message= _ "We shouldn't let these innocent shamans fight these skeletons alone. I'd help them, but it's up to you to decide."
	    [/message]
	[/event]
	
	[/scenario]
Okay, after looking at some similar threads i found an error. It was an " which was there two times. Apparently it is a good idea to count them, to see if you have a regular number
Last edited by Paulomat4 on July 11th, 2013, 12:14 pm, edited 1 time in total.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Nested quoted string error

Post by SkyOne »

Okay, this is one I found in a quick look:

Code: Select all

      [message]
      speaker=Nàriël
      message= _ "Goodbye, young warrior. I need to stay here, to guard this valley.""
      [/message]
in the moveto event of Fiannon.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Nested quoted string error

Post by Paulomat4 »

okay, you were 2 minutes faster :D
thank you for the help. Anyone an idea why the error message refers to this trait?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Creating an item event doesn't launches

Post by Paulomat4 »

okay, so this time i was trying to create an item which is dropped after killing an enemy at the location he was standing before.
All i did was modifying the code for the sword of fire in heir to the throne. The first event launches correctly as it should, but the second one does not fire.
Anyone an idea why it doesn't?

Code: Select all

[event]
	name=last breath
	[filter]
	    id=Nagaguy
	[/filter]
	[set_variable]
        name=x_ring
        value=$x1
    [/set_variable]
	[set_variable]
        name=y_ring
        value=$y1
    [/set_variable]
	[message]
	    speaker=Nagaguy
		message= _ "Hissssssss, we'll come back!"
	[/message]
    {PLACE_IMAGE items/ring-gold.png ($x_ring) ($y_ring)}
	[move_unit]
	    id=Nagaguy
		to_x=44
		to_y=12
	[/move_unit]
    [kill]
	    id=Nagaguy
		animate=no
		fire_event=no
	[/kill]
    [set_variable]
        name=ring
        value=1
    [/set_variable]
	[message]
	    speaker=Naia
		message= _ "Look, he dropped something!"
	[/message]
	[/event]

    [event]
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=($x_ring)
            y=($y_ring)
        [/filter]
        [if]
            [variable]
                name=ring
                numerical_equals=1
            [/variable]
            [then]
                [message]
                    speaker=narrator
                    image="wesnoth-icon.png"
                    message= _ "Do you want this unit to pick up the Ring of Swordmanship?"
                    [option]
                        message= _ "Yes"
                        [command]
                            [object]
                                id=ring_of_swordmanship
                                name= _ "Ring of Swordmanship"
                                image=items/ring-gold.png
                                duration=forever
                                description= _ "This ring makes a cunning Swordsman out of every Fighter"
                                cannot_use_message= _ "You need to have a sword to become a Master of swords. "
                                [filter]
                                    has_weapon=sword
                                    x,y=($x_ring), ($y_ring)
                                [/filter]
                                [then]
                                    [remove_item]
                                        x,y=($x_ring), ($y_ring)
                                    [/remove_item]
                                    [message]
                                        speaker=narrator
                                        image="wesnoth-icon.png"
                                        message= _ "As you put the shining ring on your finger, the weight of your sword is reduced to nearly nothing. Your mind is suddenly infused with different techniques qnd styles of swordfighting. "
                                    [/message]
                                    [set_variable]
                                        name=ring
                                        value=2
                                    [/set_variable]
                                [/then]
                                [effect]
                                    apply_to=sword
                                    increase_damage=2
                                [/effect]
		                        [effect]
                                    apply_to=sword
		                        	increase_attacks=1
                                [/effect]
                                [effect]
                                    apply_to=hitpoints
                                    increase=3
                                [/effect]
                            [/object]
                        [/command]
                    [/option]
                    [option]
                        message= _ "No"
                        [command]
                            [allow_undo]
                            [/allow_undo]
                        [/command]
                    [/option]
                [/message]
            [/then]
            [else]
                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Creating an item, event does not launch

Post by Elvish_Hunter »

At the moment I can't see anything wrong with your code. However, I have some suggestions that you may find useful:
  • At the end of the first event, insert this:

    Code: Select all

    [inspect][/inspect]
    This recalls the inspection window, exactly like when you type:

    Code: Select all

    :debug
    :inspect
    This way, you can see if the variables are set correctly.
  • In the moveto event, your [if] tag contains an [else] which only has [allow_undo] into it. That's a perfect situation where you can use [filter_condition] instead of the [if] tag.
  • In the same event's filter (and elsewhere), you can just use

    Code: Select all

    x,y=$x_ring,$y_ring
    In this case, brackets are not required.
  • Same thing for this line:

    Code: Select all

    numerical_equals=1
    You can just use equals= instead. True, there are some situations where numerical_equals may be a better choice, but this one isn't.
  • If you feel like being adventurous, you can try moving the moveto event inside the last breath event, thus creating a nested event. You'll then need to use delayed_variable_substitution=no inside the nested event, and this will allow you to remove some variables.
  • Finally, in mainline we have a PICKUPPABLE_ITEM macro, so you may be interested in using it.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Creating an item, event does not launch

Post by Paulomat4 »

At the moment I can't see anything wrong with your code. However, I have some suggestions that you may find useful:
At the end of the first event, insert this:
CODE: SELECT ALL
[inspect][/inspect]
This recalls the inspection window, exactly like when you type:
CODE: SELECT ALL
:debug
:inspect
This way, you can see if the variables are set correctly.
I tested it with debug mode, and yeah the variable has the right value. Could it be that the event isn't triggered, because the event is loaded before even knowing the value of x_ring and y_ring? I'll try it with a nested event and take a look at the PICKUPPABLE_ITEM macro.
In the moveto event, your [if] tag contains an [else] which only has [allow_undo] into it. That's a perfect situation where you can use [filter_condition] instead of the [if] tag.
In the same event's filter (and elsewhere), you can just use
CODE: SELECT ALL
x,y=$x_ring,$y_ring
In this case, brackets are not required.
Same thing for this line:
CODE: SELECT ALL
numerical_equals=1
You can just use equals= instead. True, there are some situations where numerical_equals may be a better choice, but this one isn't.
I've just taken the code from the sword of fire in heir to the throne. It's written like this there. Else i'd use equals= too.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Creating an item, event does not launch

Post by Paulomat4 »

Code: Select all

[event]
	name=last breath
	[filter]
	    id=Nagaguy
	[/filter]
	[set_variable]
        name=x_ring
        value=$x1
    [/set_variable]
	[set_variable]
        name=y_ring
        value=$y1
    [/set_variable]
	[message]
	    speaker=Nagaguy
		message= _ "Hissssssss, we'll come back!"
	[/message]
    {PLACE_IMAGE items/ring-gold.png ($x_ring) ($y_ring)}
	 [event]
	    delayed_variable_substitution=no
        name=moveto
        first_time_only=no
        [filter]
            side=1
            x=($x_ring)
            y=($y_ring)
        [/filter]
        [if]
            [variable]
                name=ring
                numerical_equals=1
            [/variable]
            [then]
                [message]
                    speaker=narrator
                    image="wesnoth-icon.png"
                    message= _ "Do you want this unit to pick up the Ring of Swordmanship?"
                    [option]
                        message= _ "Yes"
                        [command]
                            [object]
                                id=ring_of_swordmanship
                                name= _ "Ring of Swordmanship"
                                image=items/ring-gold.png
                                duration=forever
                                description= _ "This ring makes a cunning Swordsman out of every Fighter"
                                cannot_use_message= _ "You need to have a sword to become a Master of swords. "
                                [filter]
                                    has_weapon=sword
                                    x,y=($x_ring), ($y_ring)
                                [/filter]
                                [then]
                                    [remove_item]
                                        x,y=($x_ring), ($y_ring)
                                    [/remove_item]
                                    [message]
                                        speaker=narrator
                                        image="wesnoth-icon.png"
                                        message= _ "As you put the shining ring on your finger, the weight of your sword is reduced to nearly nothing. Your mind is suddenly infused with different techniques qnd styles of swordfighting. "
                                    [/message]
                                    [set_variable]
                                        name=ring
                                        value=2
                                    [/set_variable]
                                [/then]
                                [effect]
                                    apply_to=sword
                                    increase_damage=2
                                [/effect]
		                        [effect]
                                    apply_to=sword
		                        	increase_attacks=1
                                [/effect]
                                [effect]
                                    apply_to=hitpoints
                                    increase=3
                                [/effect]
                            [/object]
                        [/command]
                    [/option]
                    [option]
                        message= _ "No"
                        [command]
                            [allow_undo]
                            [/allow_undo]
                        [/command]
                    [/option]
                [/message]
            [/then]
            [else]
                [allow_undo]
                [/allow_undo]
            [/else]
        [/if]
    [/event]
	[move_unit]
	    id=Nagaguy
		to_x=44
		to_y=12
	[/move_unit]
    [kill]
	    id=Nagaguy
		animate=no
		fire_event=no
	[/kill]
    [set_variable]
        name=ring
        value=1
    [/set_variable]
	[message]
	    speaker=Naia
		message= _ "Look, he dropped something!"
	[/message]
	[/event]
Well i tried it like this but it does not work neither.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Creating an item, event does not launch

Post by gfgtdf »

try to delete the brackets in

Code: Select all

        [filter]
            side=1
            x=($x_ring)
            y=($y_ring)
        [/filter]
like Elvish_Hunter said.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Creating an item, event does not launch

Post by Paulomat4 »

try to delete the brackets in
CODE: SELECT ALL
[filter]
side=1
x=($x_ring)
y=($y_ring)
[/filter]

like Elvish_Hunter said.
Ahhh, i understood it as not necessary but not bad neither. Anyway, thank you both, it works now.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: Game crushes when trying my add-on

Post by Mabuse »

Paulomat4 wrote:I'm getting a nested quoted string error, when opening a savefile of my campaign. Apparently it's in line 5 of this file. Perhaps it's obvious, but i can't see an error, as i was just pklaying around with the strong trait, doubling his effect.
if something like this happens you usually forgot or added a ' " ' earlier in the file.
the error relates to line 5 of that code becuase it gets to the first ' " ' that seems out of place. the error is somewhere earlier in the code.
The best bet is your own, good Taste.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Creating an item, event does not launch

Post by Paulomat4 »

if something like this happens you usually forgot or added a ' " ' earlier in the file.
the error relates to line 5 of that code becuase it gets to the first ' " ' that seems out of place. the error is somewhere earlier in the code.
okay, thank you. I'll think of it if it ever happens again.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: Creating an item, event does not launch

Post by Mabuse »

Paulomat4 wrote:
if something like this happens you usually forgot or added a ' " ' earlier in the file.
the error relates to line 5 of that code becuase it gets to the first ' " ' that seems out of place. the error is somewhere earlier in the code.
okay, thank you. I'll think of it if it ever happens again.
Nvm ... i just forgot t read the second page of this thread ... :whistle:
The best bet is your own, good Taste.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Question about [move_unit]

Post by Paulomat4 »

Okay, this time it's not a problem, but rather a question.
What i want to do:

Code: Select all

moving all units from one side to a certain location and killing them there, BUT one after the other. This means unit moves to location, unit gets killed, next unit moves to location, gets killed,etc..
What i got:

Code: Select all

#Nagaguy is the leader of side 2
[move_unit]
	    id=Nagaguy
		to_x=44
		to_y=12
	[/move_unit]
    [kill]
	    id=Nagaguy
		animate=no
		fire_event=no
	[/kill]
	[move_unit]
	    side=2
		to_x=44
		to_y=12
	[/move_unit]
	[kill]
	    side=2
		animate=no
		fire_event=no
	[/kill]
The problem: For the leader it works fine, he moves to the location and gets killed. then the entire side moves there, one after the other, and only gets killed once that all units are on the location or on the fields next to the unit who is on the location.

Is there a possibility to let [move_unit] move only one unit? Also if there is, is there an option to redo this until no unit from side 2 is on the field?
Would this be doable with wml?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
Post Reply