ON_SIGHTING Macro

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
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

ON_SIGHTING Macro

Post by Velensk »

So I know that using anything to do with sighting is bug prone but I wanted to know if there was anything I could do to get that fixed. I saw that the wiki recommended using the ON_SIGHTING macro and I tried using it. I still am running into bugs and I wanted to know if I was doing something wrong or if it's just an inevitability of doing what I'm trying to do.

I use the macro twice once for the first time a unit of side 2 is sighted, once the first time a unit of side 3 is. The first time a unit is sighted both of them fire. The scenario objectives do not show up until both dialogues end.
-This is what the code looks like (less the dialogue), I followed the example given.

Code: Select all

 {ON_SIGHTING () 1 side=3 (
     [message]
         #Long string of messages
     [/message]
               [objectives]
                   [objective]
                        description= _ "Defeat the enemy leader."
                        condition=win
                   [/objective]
               {HOW_TO_LOSE}
               [gold_carryover]
                    bonus=yes
                    carryover_percentage=40
                [/gold_carryover]
               [/objectives]
)}

 {ON_SIGHTING () 1 side=2 (
     [message]
         #several more messages
     [/message]
)}
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: ON_SIGHTING Macro

Post by trewe »

The macro/event should have an id if more than one is used (the unused argument in your example). Other than that, plain old moveto events are probably the only safe way to get the desired behavior.

Note that in 1.11.x sighted events can be relayed again.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: ON_SIGHTING Macro

Post by Anonymissimus »

trewe wrote:Note that in 1.11.x sighted events can be relayed again.
"relied upon"
Yes, please support jamit's hard work in this area, and report any potential remaining problems to him, when using 1.11.x.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Velensk
Multiplayer Contributor
Posts: 4002
Joined: January 24th, 2007, 12:56 am

Re: ON_SIGHTING Macro

Post by Velensk »

This was for 1.11.x

So for mutliple of these I need to provide each of them with a distinct id. Am I safe in assumeing that how the id actually reads is irrelevant?
"There are two kinds of old men in the world. The kind who didn't go to war and who say that they should have lived fast died young and left a handsome corpse and the old men who did go to war and who say that there is no such thing as a handsome corpse."
Post Reply