wml help

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

wml help

Post by Stosswelle »

the ogre gets created strong and resilient
no message is displayed
i dont think hes invisible either
the wiki is really vague on unit creation so i had to go rooting around for even the the apply_to=status and add=invisible parts
ended up finding it in items.cfg
so if anyone could help with being able to just recall and make it resilient and strong instead of putting all that code in there and possibly making it invisible for real (unless i dont understand what invisible really does) that would be great

Code: Select all

#define FINDOGRE xl yl ogrename ogreid
[event]
name=moveto
[filter]
  x={xl}
  y={yl}
[/filter]
[command]
  [unit]
  type=Ogre
  description={ogrename}
  x=2
  y=18
  side=$side_number
    [modifications]
	[trait]
	id=resilient
	name=resilient
		[effect]
		apply_to=hitpoints
		increase_total=7
		heal_full=yes
		[/effect]
	[/trait]
    [trait]
    id=invisible
    name=invisible
    [effect]
    apply_to=status
    add=invisible
    [/effect]
    [/trait]
	[trait]
	id=strong
	name=strong
		[effect]
		apply_to=attack
		range=short
		increase_damage=1
		[/effect]
		[effect]
		apply_to=hitpoints
		increase_total=2
		heal_full=yes
		[/effect]
	[/trait]
  [/modifications]
  [message]
  id={ogreid}
  description={ogrename}
  message="Player $side_number has enlisted the aid of an invisible Ogre!"
  [/message]
  [/unit]
[/command]
[/event]
#enddef

{FINDOGRE 1 20 Thud ogre1}
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

Well, the message tag needs to be outside the unit tag.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Re: wml help

Post by Dacyn »

Stosswelle wrote:make it resilient and strong instead of putting all that code in there
AFAIK this is impossible; but you can of course do what you did. Anyway, why do you want the ogre to be strong and resilient? Most WML-generated units don't have traits.
Stosswelle wrote:the wiki is really vague on unit creation so i had to go rooting around for even the the apply_to=status and add=invisible parts
ended up finding it in items.cfg
where did you look? The wiki pages these are described on are SingleUnitWML and EffectWML.
Stosswelle wrote:making it invisible for real
I don't know whether this is possible; invisible is a status meaning it goes away easily.
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

thanks
the code has changed a decent bit now
if i need more help ill come back
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

ok now the code looks like this
im not sure why it doesnt work
and im open to ways it can be shortened for greater efficiency

Code: Select all

#define FINDOGRE xl yl ogrename ogreid
[event]
name=moveto
[filter]
  x={xl}
  y={yl}
[/filter]
[command]
  [unit]
  type=Ogre
  description={ogrename}
  [if]
  [variable]
  name=side_number
  numerical_equals=1
  [/variable]
    [then]
    x=1
    y=20
    [/then]
  [else]
  [variable]
  name=side_number
  numerical_equals=2
  [/variable]
    [then]
    x=27
    y=20
    [/then]
  [else]
    [then]
    x=12
    y=1
    [/then]
  [/else]
  [/else]
  [/if]
  side=$side_number
    [modifications]
    [trait]
    id=strongandresilientandinvisible
    [effect]
    apply_to=hitpoints
    increase_total=12
    heal_full=yes
    [/effect]
    [effect]
    apply_to=attack
    range=short
    increase_damage=2
    [/effect]
    [effect]
    apply_to=status
    add=invisible
    [/effect]
	[/trait]
  [/modifications]
  [/unit]
  [message]
  id={ogreid}
  description={ogrename}
  message="Player $side_number has enlisted the aid of a temporarily invisible Ogre!"
  [/message]
[/command]
[/event]
#enddef
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Post by Dacyn »

[if] is not like '#ifdef'; it can only be used as an action. So you could have instead:

Code: Select all

#define IFSIDECOORDINATES SIDE X Y
[if]
 [variable]
  name=side_number
  numerical_equals={SIDE}
 [/variable]
 [then]
  {VARIABLE x {X}}
  {VARIABLE y {Y}}
 [/then]
[/if]
#enddef
#define FINDOGRE xl yl ogrename ogreid
[event]
 name=moveto
 [filter]
  x={xl}
  y={yl}
 [/filter]
 {IFSIDECOORDINATES 1 1 20}
 {IFSIDECOORDINATES 2 27 20}
 {IFSIDECOORDINATES 3 12 1}
 [unit]
  type=Ogre
  description={ogrename}
  x=$x
  y=$y
  side=$side_number
  [modifications]
   [trait]
    id=strongandresilientandinvisible
    [effect]
     apply_to=hitpoints
     increase_total=12
     heal_full=yes
    [/effect]
    [effect]
     apply_to=attack
     range=short
     increase_damage=2
    [/effect]
    [effect]
     apply_to=status
#this is actually called 'ambush'
     add=ambush
    [/effect]
   [/trait]
  [/modifications]
 [/unit]
 [message]
  id={ogreid}
  description={ogrename}
  message="Player $side_number has enlisted the aid of a temporarily invisible Ogre!"
 [/message]
[/event]
#enddef
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

[if] is not like '#ifdef'; it can only be used as an action
say what?
apply_to=status
#this is actually called 'ambush'
     add=ambush
wiki refers to poison, slow, somethingelse, and invisible
you sure its ambush?

thanks for the fix
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

oh yeah and ive been staring at this

Code: Select all

{VARIABLE x {X}} 
  {VARIABLE y {Y}} 
why isnt that just

Code: Select all

x={X}
y={Y}
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Invisible Philosopher
Posts: 873
Joined: July 4th, 2004, 9:14 pm
Location: My imagination
Contact:

Post by Invisible Philosopher »

Stosswelle wrote:oh yeah and ive been staring at this

Code: Select all

{VARIABLE x {X}} 
  {VARIABLE y {Y}} 
why isnt that just

Code: Select all

x={X}
y={Y}
Because WML doesn't do that. That syntax is used only for specifying attributes for tags. The only way to modify variables is with [set_variable]. This

Code: Select all

{VARIABLE x {X}} 
{VARIABLE y {Y}} 
expands to this

Code: Select all

[set_variable]
name=x
value={X}
[/set_variable]
[set_variable]
name=y
value={Y}
[/set_variable]
(although the {X} and {Y} would also be expanded to whatever was put into the other macro)
Play a Silver Mage in the Wesvoid campaign.
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

and finally, unfortunately, wesnoth is rejecting that code
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

Because WML doesn't do that. That syntax is used only for specifying attributes for tags. The only way to modify variables is with [set_variable].
something doesnt make sense then, because it doesnt seem right that in one case you would have to treat the location as a variable and in another place treat it as a tag
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Post by Dacyn »

Stosswelle wrote:
[if] is not like '#ifdef'; it can only be used as an action
say what?
[if] is not a preprocessor symbol; it is more comparable to [message] than '#ifdef'.
Stosswelle wrote:wiki refers to poison, slow, somethingelse, and invisible
not anymore.
Stosswelle wrote:you sure its ambush?
yes; I saved a game where an Elvish Ranger was in forest and looked at the savefile.
Stosswelle wrote:something doesnt make sense then, because it doesnt seem right that in one case you would have to treat the location as a variable and in another place treat it as a tag
The variables are not the location of the unit; it's just a variable. However the variable is used to determine the location.
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

yes; I saved a game where an Elvish Ranger was in forest and looked at the savefile.
ao ambush is for forests
and nightstalk im guessing is for nighttime
i bet you could code invisibility for all situations until you approach a unit...
ill get on that when theres nothing else to do
The variables are not the location of the unit; it's just a variable. However the variable is used to determine the location.
so x={x} and y={y} work in some sitautions because?

oh yeah, code still blows up when trying to do multi, wesnoth rejects it, says something about illegal [/set_variable]
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Stosswelle
Posts: 166
Joined: June 4th, 2004, 8:18 pm
Location: Atlanta, GA
Contact:

Post by Stosswelle »

ok i just checked
invisible is a status
ambush and nightstalk are abilities
supposedly adding abilities to units doesnt work as of yet...
Hard/Melodic Trance, other Electronica:
http://www.musicv2.com/artist/stosswelle
Play Blood Series Maps!
--- ~WAY~ We Are Yousnoth---
<Li`sar> he likes it when i stand up with the remote held high "I am the princess"
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Post by Dacyn »

Stosswelle wrote:so x={x} and y={y} work in some sitautions because?
the fact that you are using brackets has nothing to do with whether you are storing a variable; the brackets are preprocessor symbols. Here's an example:

Code: Select all

#define SETX X
x={X}
#enddef
{SETX 5}
is the same as writing

Code: Select all

x=5
However, variables are not like this.

Code: Select all

{VARIABLE x 5}
x=$x
sets the variable 'x' to 5, then sets the key (keys are different from variables) to the value of 'x', or 5.
Stosswelle wrote:oh yeah, code still blows up when trying to do multi, wesnoth rejects it, says something about illegal [/set_variable]
It works for me; maybe you should post the context you are using it in?

About statuses: I just checked and the system seems illogical. How it works is that all units with the ability 'ambush' always have the status 'ambush', regardless of whether they are in forest (similarly for 'nightstalk'). What is the point of that? You already know that the unit has ambush by its unit type! And 'invisible' is not a status; it doesn't do anything.
Post Reply