Events Such as Unit Recruitment - Middle Ages v0.35

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.
KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Events Such as Unit Recruitment - Middle Ages v0.35

Post by KingJohnVI »

Middle Ages Era - v0.34

The idea behind this era was to combine a few great ideas I saw in other eras with a few of my own to create a more of an "empire creation" feeling to the game. In this vein I wanted to create a basic middle ages style era, have factions representing real parts of the world, and most importantly, allow players to expand using thier officers to capture territory rather than using themselves. It's nice to go to war and lead from the front, but it's better if you can watch at a safe distance. :lol2: Attached below is the very early alpha stages of this era. I highly recommed you play the era using the included map for now, I am not sure how balanced the era would be on regular wesnoth maps. Please feel free to comment on any bugs or the game balance, but keep in mind that it is still very early in development. I may eventually include ships as well.

To install, simply extract the zip file to your add-ons folder, by default located at "C:\Users\User Name\Documents\My Games\Wesnoth1.8\data\add-ons" and then start a game of Wesnoth to begin playing. Please enjoy! Edit: The add-on is now available through the add-on server. Just search for Middle Ages!

For some reason images will not display on the officers recruit menu. Edit: Fixed!
---------------Original Post----------------------------
Within a custom Era, I would like do be able to have a Sergeant unit recruit specific units of lesser quality, but not all available units that can be recruited by the leader, when they are on a keep. I think I basically have the code for doing this, but I have no idea how or where to define the variables or how to include them, so all I get is a bunch of error messages whenever I try to start up the era.

Attached is the code I have so far within the Sergeant.cfg unit file if someone is interested, but I think my problem is that nothing is defined anywhere.
Last edited by KingJohnVI on September 29th, 2011, 6:42 pm, edited 8 times in total.

User avatar
Pentarctagon
Forum Administrator
Posts: 4127
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Creating Events Such as Unit Recruitment

Post by Pentarctagon »

A couple things:

1. The event is "side turn", not sideturn.
2. What errors are you getting?
3. This is your second thread in 2 days, so if you think you are going to be asking questions often in the future, I would encourage you to make a single thread for them next time you have a question (or just rename this thread).
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Re: Creating Events Such as Unit Recruitment

Post by KingJohnVI »

Wow... I think "side turn" was the majority of the problem amazingly. It seems to be working now except that the image for the axeman is not displaying on the special recruit menu. Any idea why that would be happening?

Also: I would be happy to just post lots of questions in a single thread if that is what you prefer, but it seemed to me that multiple smaller threads would allow others who had the same question to more easily search for and find the information. I guess I couldn't really see why you would want fewer threads? Again, if you prefer I stick to one thread it isn't a problem.

User avatar
Pentarctagon
Forum Administrator
Posts: 4127
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Creating Events Such as Unit Recruitment

Post by Pentarctagon »

If I had to guess, I'd say you mistyped the image name. Also if you are using 1.9, "colour" was changed to "color" (you have colour in the ~RC part of it).

As for the single vs multiple threads, it really isn't a huge issue unless you end up with like seven threads all on page one (actually happened once) or have more than one thread going at the same time. Also if the problem comes up again for you, it is easier to find one thread that has all your questions in it than looking through a bunch of mini-threads.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Re: Creating Events Such as Unit Recruitment

Post by KingJohnVI »

As to the threads, fair enough. In any event, I checked the image names, all 5 are correct, but none of them appear. I am using 1.8, so colour wasn't the issue I guess, though that is good to know for the future. Unfortunatly, it still doesn't work, and none of the images are displayed. I am using the exact same code as above, except that "side turn" was fixed, and I can't seem to figure out why it is not working... I have the images located at ~add-ons\Middle_Ages\images\units. Does that make a difference? I tried...

Code: Select all

message={MENU_IMG_TXT "images/units/MA_Woodsman.png~RC(magenta>$recruiter.colour)" ("Woodsman - 10 Gold")}
and I orginally had...

Code: Select all

message={MENU_IMG_TXT "MA_Woodsman.png~RC(magenta>$recruiter.colour)" ("Woodsman - 10 Gold")}
and neither seems to work. :/

It only displays the last part "Woodsman - 10 Gold"

User avatar
Pentarctagon
Forum Administrator
Posts: 4127
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Creating Events Such as Unit Recruitment

Post by Pentarctagon »

try

Code: Select all

    message={MENU_IMG_TXT "units/MA_Woodsman.png~RC(magenta>$recruiter.colour)" ("Woodsman - 10 Gold")}
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Re: Creating Events Such as Unit Recruitment

Post by KingJohnVI »

I tried that as well. No dice sadly, same result. Is there some file I need to include or identify elsewhere?

KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Re: Creating Events Such as Unit Recruitment

Post by KingJohnVI »

On a different note, I would like to create a hit and run style unit or attack, whereby a unit regains some of its movement points after attacking, but is unable to attack again. I tried to find guidance on this and was unable to locate it. Thanks again for your help.

blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Creating Events Such as Unit Recruitment

Post by blueknight1758 »

Have you specified {add-ons/Middle_ages/images/units} as a binary path in your main.cfg because that could cause this problem.

mattsc
Posts: 1141
Joined: October 13th, 2010, 6:14 pm
Location: Hidden on the hex behind Fred

Re: Creating Events Such as Unit Recruitment

Post by mattsc »

KingJohnVI wrote:On a different note, I would like to create a hit and run style unit or attack, whereby a unit regains some of its movement points after attacking, but is unable to attack again. I tried to find guidance on this and was unable to locate it. Thanks again for your help.

Code: Select all

[event]
    name=attack end
    first_time_only=no
    [filter]
        type=hit_and_run_unit_type
    [/filter]

    {MODIFY_UNIT id=$unit.id moves 3}
[/event]
Untested

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

Re: Creating Events Such as Unit Recruitment

Post by Crendgrim »

blueknight1758 wrote:Have you specified {add-ons/Middle_ages/images/units} as a binary path in your main.cfg because that could cause this problem.
Wrong.
The binary path should point to data/add-ons/Middle_ages, then using "units/MA_Woodsman.png" as an image path will automatically be searched in data/add-ons/Middle_ages/images/.


Crend
UMC Story Images — Story images for your campaign!

blueknight1758
Posts: 252
Joined: March 30th, 2011, 8:38 pm
Location: The UK

Re: Creating Events Such as Unit Recruitment

Post by blueknight1758 »

Crendgrim wrote:
blueknight1758 wrote:Have you specified {add-ons/Middle_ages/images/units} as a binary path in your main.cfg because that could cause this problem.
Wrong.
The binary path should point to data/add-ons/Middle_ages, then using "units/MA_Woodsman.png" as an image path will automatically be searched in data/add-ons/Middle_ages/images/.


Crend
Sorry about that then :(

KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Re: Creating Events Such as Unit Recruitment

Post by KingJohnVI »

mattsc wrote:
KingJohnVI wrote:On a different note, I would like to create a hit and run style unit or attack, whereby a unit regains some of its movement points after attacking, but is unable to attack again. I tried to find guidance on this and was unable to locate it. Thanks again for your help.

Code: Select all

[event]
    name=attack end
    first_time_only=no
    [filter]
        type=hit_and_run_unit_type
    [/filter]

    {MODIFY_UNIT id=$unit.id moves 3}
[/event]
Untested

Haha it worked! Thanks a bunch!

KingJohnVI
Posts: 30
Joined: July 18th, 2011, 2:02 am

Re: Creating Events Such as Unit Recruitment

Post by KingJohnVI »

Crendgrim wrote:
blueknight1758 wrote:Have you specified {add-ons/Middle_ages/images/units} as a binary path in your main.cfg because that could cause this problem.
Wrong.
The binary path should point to data/add-ons/Middle_ages, then using "units/MA_Woodsman.png" as an image path will automatically be searched in data/add-ons/Middle_ages/images/.


Crend
Ok so two points on this. First the binary path does indeed point to data/add-ons/Middle_ages in the Middle_Ages.cfg. Moreover, even those images such as Woodsman.png which come from the core data directory are not showing up, which leads me to believe that the code

Code: Select all

message={MENU_IMG_TXT "MA_Woodsman.png~RC(magenta>$recruiter.colour)" ("Woodsman - 10 Gold")}
is incorrect... I just don't know what about it is wrong becuase it is identical to other ad-ons' code. Also keep in mind all the images display on the units correctly in a game when not in the menu. For example, both MA_Axeman and MA_Woodsman work correctly in the regular recruit menu, and they appear and fight correctly once recruited.
Last edited by KingJohnVI on September 29th, 2011, 12:33 am, edited 1 time in total.

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

Re: Creating Events Such as Unit Recruitment

Post by Max »

would be easier if you just zipped your era and attached it...

Post Reply