Gloria Victis code issues
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.
Re: Gloria Victis code issues
[message] takes a SUF andmattsc wrote:Another thing in you code snippet is that 'side' is not a valid key for [message] AFAIK.
side
is therefore a valid key.Co-Creator of The Fellowship of the Clay (BfW 1.10) ~~ Maintainer of the German Code of Conduct
How to isolate problematic WML code ~~ WML error messages and their reasons
How to isolate problematic WML code ~~ WML error messages and their reasons
- Neuromancer
- Posts: 204
- Joined: September 10th, 2010, 9:49 pm
Re: Gloria Victis code issues
Im trying to copy the units from side 1 to recall list of side 4, but it wont work.
Inspect command indicates there are copies created and their side is switched too, only the units are not in team 4 recall list. I use this code:
Inspect command indicates there are copies created and their side is switched too, only the units are not in team 4 recall list. I use this code:
Code: Select all
[store_unit]
[filter]
side=1
[/filter]
variable=copies
kill=no
[/store_unit]
{FOREACH copies i}
{VARIABLE copies[$i].side 4}
[unstore_unit]
variable=copies[$i]
x,y=recall,recall
[/unstore_unit]
{NEXT i}
Re: Gloria Victis code issues
Well the code looks right. Are you sure they're not in the recalls list?
If so, you might try putting this before [unstore_unit] :
{VARIABLE copies[$i].x recall}
{VARIABLE copies[$i].y recall}
If so, you might try putting this before [unstore_unit] :
{VARIABLE copies[$i].x recall}
{VARIABLE copies[$i].y recall}
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- Neuromancer
- Posts: 204
- Joined: September 10th, 2010, 9:49 pm
Re: Gloria Victis code issues
Well, Im sure as far as inspect is sure. And am I assuming right AI-controlled sides with empty recruit field will try to recall?
I tried your piece of code, but it didnt work.
In attachment are zipped campaign files: to reproduce, start game on normal, pick random recruits and on world map go north into dried trees (they will be marked by icon). In that scenario, necrophage is leader of the side which wont recall.
I tried your piece of code, but it didnt work.
In attachment are zipped campaign files: to reproduce, start game on normal, pick random recruits and on world map go north into dried trees (they will be marked by icon). In that scenario, necrophage is leader of the side which wont recall.
- Attachments
-
- Gloria_Victis.zip
- (3.19 MiB) Downloaded 176 times
Re: Gloria Victis code issues
I haven't downloaded and checked out your campaign file, but could you try something? Put "persistent=yes" into the side definition of Side 4 for this scenario (I assume that this is an AI controlled side?) and see if it works then. I think (maybe I misremember and am saying something stupid; again ) I've encountered it before that I cannot put units on a side's recall list that isn't persistent (i.e. either player controlled or with the parameter set specifically), but I haven't done enough research yet to figure out whether that is always like that or just for the cases I have tried (and whether it's supposed to work that way or not).
EDIT: Well, thinking about it, that does make some sense. Why would a non-persistent side need a recall list - under normal circumstances at least? But I still don't know whether it is implemented that way. It's probably documented somewhere, but I don't have time to look for it right now.
EDIT: Well, thinking about it, that does make some sense. Why would a non-persistent side need a recall list - under normal circumstances at least? But I still don't know whether it is implemented that way. It's probably documented somewhere, but I don't have time to look for it right now.
SP campaigns: Galuldur's First Journey (1.12 & 1.14) & Grnk the Mighty (1.10 & 1.12)
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
AI experiments: Micro AIs (wiki, forum thread, known/fixed bugs), Fred, AI-demos add-on
- Neuromancer
- Posts: 204
- Joined: September 10th, 2010, 9:49 pm
Re: Gloria Victis code issues
It... actually works! Thanks a lot!
- Neuromancer
- Posts: 204
- Joined: September 10th, 2010, 9:49 pm
Re: Gloria Victis code issues
This should be the last set of questions. The scenarios are done now - except for a few parts which needs tweaking:
1. I'm trying to insert animated fountain, but engine tells me [terrain_graphics] is not supported:
2. This code stores units of side 1 and changes some of their variables, so they can be recruited by another side. How to change their IDs?
As always, sincere thank you for all your answers.
1. I'm trying to insert animated fountain, but engine tells me [terrain_graphics] is not supported:
Code: Select all
[terrain_graphics]
x={X}
y={Y}
[tile]
x=0
y=0
[image]
layer=0
name="../scenery/fountain-animated-1.png:140,../scenery/fountain-animated-2.png:140,../scenery/fountain-animated-3.png:140,../scenery/fountain-animated-4.png:140"
[/image]
[/tile]
[/terrain_graphics]
Code: Select all
[store_unit]
[filter]
side=1
[not]
id=Hazael
[/not]
[/filter]
variable=copies
kill=no
[/store_unit]
{FOREACH copies i}
{VARIABLE copies[$i].side 4}
{VARIABLE copies[$i].canrecruit no}
{VARIABLE copies[$i].x recall}
{VARIABLE copies[$i].y recall}
[unstore_unit]
variable=copies[$i]
x,y=recall,recall
[/unstore_unit]
{NEXT i}
- artisticdude
- Moderator Emeritus
- Posts: 2424
- Joined: December 15th, 2009, 12:37 pm
- Location: Somewhere in the middle of everything
Re: Gloria Victis code issues
For the first problem, you are including the code at scenario toplevel, correct?
For the second, the unit's id is automatically stored when you use [store_unit] (which you can see using the debug command :inspect ). To change the id of the unit, you need to modify the variable id within the container copies[$i], like so:
For the second, the unit's id is automatically stored when you use [store_unit] (which you can see using the debug command :inspect ). To change the id of the unit, you need to modify the variable id within the container copies[$i], like so:
Code: Select all
{VARIABLE copies[$i].id This_is_the_new_id}
"I'm never wrong. One time I thought I was wrong, but I was mistaken."
Re: Gloria Victis code issues
I can confirm the occurence of the $owner_side variable being 0 in a multiplayer campaign I am developing for version 1.10.0 when according to the documentation http://wiki.wesnoth.org/EventWML it shouldn't be. At least I feel more confident that I have not made a mistake somewhere. I have attached the (messy) scenario I am working on that has some debugging messages if it helps. Time for me to write a work-around for this bug.mattsc wrote:This event fires, but only when Side 1 captures a village, that is owner_side contains the side which does the capture, not the previous owner side as it says at EventWML. Furthermore, the owner_side variable displayed both by [inspect] and in the message is always 0. So unless I misunderstand something here, this looks like a bug to me.
- Attachments
-
- Silaric_Odyssey-owner-side.7z
- (182.63 KiB) Downloaded 133 times
- Neuromancer
- Posts: 204
- Joined: September 10th, 2010, 9:49 pm
Re: Gloria Victis code issues
Time to finish this campaign. You were great help before, could you help me again?
In one scenario, player is advancing into forest where hostile woses have settled. When players unit stumbles onto one, I want him/her to say something. I chose to use sighted event, because (if I understood correctly) from 1.11. it should work with units with hides ability. Im using version 1.11.6. Player is side 1, woses are 3. This code does nothing:
Another situation is when heroes are escaping into cave, one by one. Its done by moveto event, which stores, then kills every unit which steps on the specified tile. When there are only 2 units left, one on the field and one entering the cave, I want the one entering the cave say something like "Hey $last_unit, quickly to the caves!" How to store that one unit into the $last_unit variable?
In one scenario, player is advancing into forest where hostile woses have settled. When players unit stumbles onto one, I want him/her to say something. I chose to use sighted event, because (if I understood correctly) from 1.11. it should work with units with hides ability. Im using version 1.11.6. Player is side 1, woses are 3. This code does nothing:
Code: Select all
[event]
name=sighted
[filter]
side=3
[/filter]
[filter_second]
side=1
[/filter_second]
[message]
speaker=second_unit
message= _ "<i>Gasp!</i>"
[/message]
[/event]
- pyrophorus
- Posts: 533
- Joined: December 1st, 2010, 12:54 pm
Re: Gloria Victis code issues
Hi !
I would use a 'moveto' event instead with a filter_adjacent tag describing the hiding wose. (Or even a new 'enter' tag, but I never used them).
HTH
I would use a 'moveto' event instead with a filter_adjacent tag describing the hiding wose. (Or even a new 'enter' tag, but I never used them).
HTH
HowTos: WML filtering, WML variables
Re: Gloria Victis code issues
You understand perfectly. Feel free to put emphasis on "should" -- apparently some idiot forgot to actually implement that aspect when I was fixing up the sighted events. It'll be in 1.11.7 (and in trunk by the end of the weekend, possibly within an hour or so, in case you want it faster ).Neuromancer wrote:I chose to use sighted event, because (if I understood correctly) from 1.11. it should work with units with hides ability.
Well, ambush will be fixed. I might have to update the documentation to say that nightstalking units do not get a sighted event at the end of a night's last turn.
Perhaps:Neuromancer wrote:How to store that one unit into the $last_unit variable?
Code: Select all
{STORE_UNIT_VAR (
# Assuming side 1 is the side with two units left:
side=1
# Not the unit who triggered this moveto event.
[not]
id=$unit.id
[/not]
) name last_unit_name}