TGI coding and stuff like that

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

TGI coding and stuff like that

Post by Golden_Soldier »

Hey Im back from wesbreak and I have started work on a new campaign (that frankly will be more fun to make than TAP. I may get back to TAP someday though). In the first scenario there are enemies coming in pairs of two for a while every turn. Is there an easier way to do this than making an event for each turn?
Last edited by Golden_Soldier on July 26th, 2011, 5:59 am, edited 1 time in total.

User avatar
Captain_Wrathbow
Posts: 1664
Joined: June 30th, 2009, 2:03 pm
Location: Guardia

Re: Reinforcements

Post by Captain_Wrathbow »

Yes, there's a much easier way to do that. Example: (untested)

Code: Select all

[event]
    name=new turn
    first_time_only=no
    [if]
        [variable]
            name=turn_number
            less_than=[turn at which reinforcements stop coming]
        [/variable]
        [then]
            # Place the units
        [/then]
    [/if]
[/event]
This assumes that the units you are creating are of the same type each turn; if different units are supposed to be appearing each turn it would be a bit more complicated...

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: Reinforcements

Post by Golden_Soldier »

thats perfect thanks!

User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Reinforcements

Post by Gambit »

Moved to WML Workshop; the appropriate forum for getting help with making UMC.

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: Reinforcements

Post by Golden_Soldier »

Sorry about that :wink:

And now for the good stuff... the campaign that is, not chili cheese fritos
I did mean to put status updates for the campaign here but I geuss the category doesnt really matter...
anyway I finished the first scenario and got an error message that said no closing scenario tag and it also mentioned the _main.cfg file. I tried to find the problemo but I couldnt figger it out. any helpful hints? (btw the campaign has been named The Grand Impressionist)
Attachments
The_Grand_Impressionist.zip
(752.94 KiB) Downloaded 124 times

User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: TGI coding and stuff like that

Post by Crendgrim »

I really suggest you to use a WML editor with syntax highlighting, because that makes things much easier. For example, I just opened your first scenario file, and saw that the end of it was all colored in the wrong color. :P
So I looked around where it started, and see here:

Code: Select all

[event]
    name=new turn
    first_time_only=yes
     [if]
         [variable]
             name=turn_3
         [/variable]
     [then]
        [unit]
            type=Dog
            id=superdog
            side=1
            x,y=1,7
        [/unit]
        [unit]
            type=Dog
            side=1
            x,y=1,9
        [/unit]
        [message]
            speaker=superdog
            message= _ "Grr... Ruff! Ruff!"
        [/message]
        [message]
            speaker=Reuban
            message= _ "The dogs are here!"
        [/message]
{/then]
[/if]
[/event]
This event causes the trouble. Just look again carefully at it. :)


Crend
UMC Story Images — Story images for your campaign!

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: TGI coding and stuff like that

Post by Golden_Soldier »

As I probably do need to refresh my memory since I have not done this in a while I am not finding the mistake in the event :hmm:
Also how do you get the this WML editor with syntax highlighting to work? I got emac but I cant figure it out

User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: TGI coding and stuff like that

Post by Crendgrim »

Golden_Soldier wrote:As I probably do need to refresh my memory since I have not done this in a while I am not finding the mistake in the event :hmm:
Look at the closing tag for "then". You have a wrong bracket there. ;)
Golden_Soldier wrote:Also how do you get the this WML editor with syntax highlighting to work? I got emac but I cant figure it out
It's explained in this thread: http://forums.wesnoth.org/viewtopic.php?t=13798
I can give you no information from experience, though, because I don't use emacs myself..


Crend
UMC Story Images — Story images for your campaign!

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: TGI coding and stuff like that

Post by Golden_Soldier »

Bah! :doh: thats one mistake that I can never find! thx for your help! :D
Ok now the scenario works, but all the timed events (the dogs appearing) happens all at once. Do want me to post the fixed version?

Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: TGI coding and stuff like that

Post by Max »

Code: Select all

[event]
     name=new turn
     first_time_only=no
[if]
   [variable]
       name=turn_4 ???
       less_than=10
   [/variable]
don't guess - look it up:
http://wiki.wesnoth.org/EventWML

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: TGI coding and stuff like that

Post by Golden_Soldier »

Ahh... I got it now got the scenario running perfectly. Which means its time for scenario two. which calls for this:

Is it possible to have one stage where there are many different "portals" in which each of them you go to a different scenario meaning you can pick and choose the order that you do the scenarios? Thats the way most of the rest of this campaign will go.

User avatar
Pentarctagon
Project Manager
Posts: 4434
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: TGI coding and stuff like that

Post by Pentarctagon »

Yes, you can use the next_scenario key in the [endlevel] tag combined with moveto events.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: TGI coding and stuff like that

Post by Golden_Soldier »

ok Im getting farther into the campaign (got a talking scenario done-ish and about halfway done with a fighting scenario) and I have two questions
first is it possible to turn off the recall option for your leader in a keep? second can you have units not die when you get their health to zero but just leave so you can fight them or use them in a different scenario?

User avatar
Golden_Soldier
Posts: 265
Joined: July 20th, 2010, 10:26 pm
Location: Roanoke

Re: TGI coding and stuff like that

Post by Golden_Soldier »

hmm. seems that nobody commented. but no matter Im sure with some searcing I can find out on my own... maybe
well anyway I have gotten much farther in my campaign now and this is my status as of now:
scenario 1:finished
scenario 2(talk): finished for now but a lot more work needs to go into it but I dont need any help for that
scenario 3:well... it loads. but victory doesnt work right (you get it after attacking just one enemy) one unit isnt recalled, one unit isnt created
so if I could get some help with scenario 3 that would be great (oh and those directions to get that .emac thing to work seemed like a foreign language to me :( does anyone no of a wml editor that is easy to set up?)
Attachments
The_Grand_Impressionist.zip
(818.93 KiB) Downloaded 117 times

User avatar
Alarantalara
Art Contributor
Posts: 784
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: TGI coding and stuff like that

Post by Alarantalara »

Golden_Soldier wrote:ok Im getting farther into the campaign (got a talking scenario done-ish and about halfway done with a fighting scenario) and I have two questions
first is it possible to turn off the recall option for your leader in a keep? second can you have units not die when you get their health to zero but just leave so you can fight them or use them in a different scenario?
The answer to both questions is yes.
For the first, the easiest way is to just kill all the units on the recall list (see the [kill] tag with x,y=recall,recall) If you want them to come back, then [store_unit] with kill = yes can achieve what you want.

For the second, call [store_unit] in a die event. You'll need to follow it with [set_variables] with mode=append to get them into the actual variable you want, otherwise each unit that dies will replace the previous one.

Post Reply