Portraits: a way to have expression & unique level graph

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
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Portraits: a way to have expression & unique level graph

Post by Eleazar »

OK, i'm working on a campaign and i frakenstien some different expressions for the hero, and make a version for each of his levels.
Then i realize i don't know how to use these in the scenarios.

What's the easiest way to select a emotion for a particular chunk of dialog, but have the the character's correct level shown?
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Lots of [if] statements. That's the only way I can think of.
Hope springs eternal.
Wesnoth acronym guide.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Store the unit (kill=no) and put some [if]'s which check what the unit's type (unit.type) is. That's what I'd do, and I'm not sure if it could be done a whole lot simpler.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

name the portraits after the unit type, then store unit type before each dialogue sequence and have image=portraits/$herovariable.type|-{normal, angry, etc}.png in the [message] tag.

I'm not sure if "|" will work in [message] image= [/message]. If not, you'll have to concatenate at the beginning - you should store the unit, then set the variable $profile-normal equal to portraits/$unitname|-normal, etc.


This way has the advantage that, after the initial 20 lines or so per message sequence (which you can make into a macro), you don't need any if-statements or stuff like that. The disadvantage is that you have to have the portrait file names named after the unit type, complete with capital letters, spaces, etc. You could probably fix that with [if] statements in the initial macro...
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

just choose a character, name the portriats according to the expression, and then use the right one in the right place.

Code: Select all

[message]
description=Eleazar
message="Nothing here"
image=portraits/Eleazar-angry.png
[/message]
for angry guy

Code: Select all

[message]
description=Eleazar
message="Wow! four thousand gold pieces!"
image=portraits/Eleazar-happy.png
[/message]
for happy guy



I really don't see the need for [if] tags (unless his expression depends on previous events, if so, just use the [if] tags, and then do the same as above, but have message the same (or different if you want).
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Ranger M wrote:I really don't see the need for [if] tags (unless his expression depends on previous events, if so, just use the [if] tags, and then do the same as above, but have message the same (or different if you want).
The reason for needing [if]'s:
Eleazar wrote:different expressions for the hero, and make a version for each of his levels.
User avatar
Ranger M
Art Contributor
Posts: 1965
Joined: December 8th, 2005, 9:13 pm
Location: England

Post by Ranger M »

zookeeper wrote:
Ranger M wrote:I really don't see the need for [if] tags (unless his expression depends on previous events, if so, just use the [if] tags, and then do the same as above, but have message the same (or different if you want).
The reason for needing [if]'s:
Eleazar wrote:different expressions for the hero, and make a version for each of his levels.
ah, didn't see that (and even when I did, It took me a moment to understand)
toms
Posts: 1717
Joined: November 6th, 2005, 2:15 pm

Post by toms »

Do you mean that you want to change your leader often?

Code: Select all

#define CHG_LEADER TYPE
[store_unit]
variable=leader_store
kill=no
[filter]
(the leader)
[/filter]
[/store_unit]
{VARIABLE leader_store.type {TYPE}}
[unstore_unit]
variable=leader_store
[/unstore_unit]
{VARIABLE msg {TYPE}}
#enddef
#define LEADER_MSG TEXT
[message]
description=(leader´s description)
message=_{TEXT}
image=$msg|.png
[/message]
#enddef
:roll:
First read, then think. Read again, think again. And then post!
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

*Sigh*

What Eleazar is trying to do is not hard to understand. He wants to have 1. different portraits based on the level of the hero, and 2. different portraits for different "emotions" of messages. Toms' macro is useless here.


This is doable. Here's the macro:

Code: Select all

#define START_DIALOGUE
[store_unit]
   [filter]
   description=Leadername
   [/filter]
variable=temp
[/store_unit]
[set_variable]
name=leader-portrait
value=portraits/$temp.type|-normal.png
[/set_variable]
[set_variable]
name=leader-portrait-happy
value=portraits/$temp.type|-happy.png
[/set_variable]
- - -
#enddef
Then, in all situations where there will be dialogue, put:

Code: Select all

{START_DIALOGUE}
[message]
description=Leadername
image=$leader-portrait
message= _ "Hi."
[/message]
[message]
description=Leadername
image=$leader-portrait-happy
message= _ "I'm happy."
[/message]
Then have files in images/portraits/ named "Unit Type-normal.png", "Unit Type-happy.png", etc.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

Not that if it is for 1.1.1+ you can use level= as a key for standard unit filter.
Then you cound do things like :

Code: Select all

[if]
   [have_unit]
      side=1
      canrecruit=1
      level=1
   [/have_unit]
[then]
  <code for level 1 unit>
[/then]
[else]
  ... idem for lvl 2, 3, ect...
[/else]
[/if]
However i find Turin's technique more elegant and portable.
Post Reply