Add-on Help.

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.
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Thanks Gnat! I think that is how I want to add my units. What are the steps? :)
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Hi all

Here is the add-on that I have so far.
Attachments
Neanderthal_MP_Era.zip
(4.43 KiB) Downloaded 238 times
User avatar
The_Gnat
Posts: 2234
Joined: October 10th, 2016, 3:06 am
Contact:

Re: I can't get my add-on to work!

Post by The_Gnat »

Hi FG_prince2000, Ok, so i have attached a fixed version of your era with all the changes i have listed below :D I still recommend reading through what i have posted below so you know what i have done and know how to fix errors and create new eras if you have to! :D
Some problems with your code:
You need to put a quotation mark " at the end of your Neanderthal Hunters description (right now it looks like description="XXXX it should be description="XXXX" with a quote at the end of the line)
Your neanderthal trapper has a weapon without a range (right now it says ranged=ranged it should be range=ranged without the "d" on the first side)
Now about creating an era: 8)

1. create a multiplayer side
It should look something like this:

Code: Select all

[multiplayer_side]
    id=ID
    name= _"NAME"
    image="PICTURE"
    {MAGENTA_IS_THE_TEAM_COLOR}
    type=random
    leader=UNIT
    random_leader=UNIT
    recruit=UNIT
    terrain_liked=TERRAIN
    [ai]
        recruitment_pattern=UNIT_USAGE
    [/ai]
[/multiplayer_side]
UNIT_USAGE refers to the type of unit a unit is (scout,archer,mixed fighter)
TERRAIN refers to a type of ground (Hh,V,Kh)
PICTURE refers to the path to a picture from the images folder (units/elves/fighter.png)

put the side into a seperate file entitled the NAMEOFYOURSIDE_side.cfg
2. create a multiplayer era
it should look something like this:

Code: Select all

[era]
    id=ID
    name= _ "NAME"
    description= _ "DESCRIPTION"

    {RANDOM_SIDE}
    {PATH_TO_YOUR_SIDES_FILE} #put in here the path to the side you just created ex: {~add-ons/Death_era/utils/death_side.cfg}
    {multiplayer/factions/khalifate-default.cfg}
    {multiplayer/factions/rebels-default.cfg}
    {multiplayer/factions/loyalists-default.cfg}
    {multiplayer/factions/northerners-default.cfg}
    {multiplayer/factions/knalgans-default.cfg}
    {multiplayer/factions/drakes-default.cfg}
    {multiplayer/factions/undead-default.cfg}

[/era]
This creates a new era with the name and description you specified and in that era it loads all the default sides and your side. I recommend putting this in another file called YOUR_NAME_era.cfg or something like that.
3. Load all this stuff
Put these two files into a folder (called "utils" or "era" or "macros")

Add a line loading that folder in your _main.cfg file:

{~add-ons/Neanderthal_MP_Era/utils}
4. Create movetype and race
I see that you have added a movetype as i recommended in the other forum but it seems that your movetype isn't loading

I moved the movetype to a single file under your units folder containing race and movetype and loaded the file with this line from the _main.cfg file:

EDIT: basically zookeeper has informed me your [movetype] & [race] tags need to be in a file loaded from the _main.cfg with a [+units] tag!

Code: Select all

[+units]
    {~add-ons/Neanderthal_MP_Era/units/neanderthal_race.cfg}
[/units]
To create a race i have created this and added it to the neanderthal_race.cfg file

Code: Select all

    [race]
        id=ID
        male_name= _ "race^NAMETITLE"
        female_name= _ "race+female^NAMETITLE"
        plural_name= _ "race^NAMETITLE"
        description= _"TODO."
        num_traits=2
        undead_variation=dwarf
        {DWARVISH_NAMES}
    [/race]
This should solve all your problems, you can go through and change the ones you want or just download the archive i have attached! :D Hopefully this helps!

Here is the archive with all the changes i have made:
Neanderthal_MP_Era.zip
(4.96 KiB) Downloaded 227 times
Last edited by The_Gnat on November 17th, 2016, 9:36 pm, edited 1 time in total.
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Hi!

Thanks a TON! This helps allot! I'l go try it out and make the modifications I want.
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Hello,

It worked great and my faction is up and running!

Since it was so successful, I am trying to make a previous faction I made that I had just integrated into the core folder ( after making a backup) into an addon. I encountered the problem that now my unit's images aren't working, their just invisible! Could I put it up here and have you guys take a look? I think the problem is that the path is no longer relevant or something... I only have one custom image, should that be in the addon somewhere?
User avatar
The_Gnat
Posts: 2234
Joined: October 10th, 2016, 3:06 am
Contact:

Re: I can't get my add-on to work!

Post by The_Gnat »

Hi FG_Prince2000, yeah if your having more trouble with your add-on i am happy to look at it! :D It sounds like your images aren't being loaded correctly, if you do want to have images with your add-on you should put them in your add-on under images/units/ and then you need to make sure your unit calls the images from the correct directory! :)
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Hi Gnat!

Yea, most of my units in this faction use images from the standard image folder, but I do have one or two images that I modified, so I'l put those in the correct folder before sending it.
Attachments
Rat_MP_Era.zip
I changed the path for the two units whose images I included.
(16.12 KiB) Downloaded 201 times
User avatar
The_Gnat
Posts: 2234
Joined: October 10th, 2016, 3:06 am
Contact:

Re: I can't get my add-on to work!

Post by The_Gnat »

Hi FG_prince2000! Your image problem is pretty simple: I have attached the fixes in a archive but once again i recommend reading through what i have done: :D

1st - image="~add-ons/images/units/giant-rat-king.png", instead you should put image="units/giant-rat-king.png", without any "~add-ons/" infront of it. (EDIT)

2nd - in the Rat_side.cfg, you have put image="units/monsters/giant-rat-king.png" but your images are actually in the /units/ folder and their is no /monsters/ folder so it should say insteaed: image="units/giant-rat-king.png"

3rd - in the Rat_side.cfg, you have put spaces and dashes in between the units names: (random_leader=Rat-Leader, Rat-Warrior, Rat-Surgion) in order for it to work you need to write the exact line that is in your unit file.

For example: in your rat-leader.cfg file it says: id=Rat Leader that everything after that = needs to be put when you want to load the unit. So it should look like: random_leader=Rat Leader,Rat Warrior,Rat Surgion

Also as zookeeper suggested you don't actually have to put {~add-ons/Rat_MP_Era/units/rat_race.cfg} in your main.cfg file because this line:

Code: Select all

[+units]
    {~add-ons/Rat_MP_Era/units}
[/units]
loads the entire units folder so you don't need to load the individual file, sorry about telling you that.

Also i noticed that your .pbl file is spelled "server.plb" this probably won't work because its supposed to be spelled ".pbl" (see this page)

Hopefully this helps! 8)
Attachments
Rat_MP_Era.zip
fixed archive
(16.08 KiB) Downloaded 215 times
Last edited by The_Gnat on November 18th, 2016, 11:40 pm, edited 2 times in total.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: I can't get my add-on to work!

Post by zookeeper »

The_Gnat wrote:instead you should put image="images/units/giant-rat-king.png"
Careful there. :eng:
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Thanks allot guys, I will definitely examine the folder to check out all the changes you made. :D
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: I can't get my add-on to work!

Post by FG_Prince2000 »

Hello again!

I am working on a campaign and I want a unit's horse to get shot, so I thought that I would store the unit "after shot" during the prestart event so that you don't see him til you unstore him after his horse gets shot. I thought that I could have him (preshot) move across the screen like the ship in the Heir to the Thrown campaign and when he gets to the spot where he will get shot he talks and then I unstore the "after shot version".

Would this be possible? And how would I make him speak right before he gets shot at and then change his image in the same event? Or would I at all?

I can keep posting Q's about my addons here right? Since this topic is called "I can't get my addon to work"?
User avatar
ForestDragon
Posts: 1857
Joined: March 6th, 2014, 1:32 pm
Location: Ukraine

Re: I can't get my add-on to work!

Post by ForestDragon »

FG_Prince2000 wrote:Hello again!

I am working on a campaign and I want a unit's horse to get shot, so I thought that I would store the unit "after shot" during the prestart event so that you don't see him til you unstore him after his horse gets shot. I thought that I could have him (preshot) move across the screen like the ship in the Heir to the Thrown campaign and when he gets to the spot where he will get shot he talks and then I unstore the "after shot version".

Would this be possible? And how would I make him speak right before he gets shot at and then change his image in the same event? Or would I at all?

I can keep posting Q's about my addons here right? Since this topic is called "I can't get my addon to work"?
it's possible, you'll need to do some work with variables, i could show you how to do that, but maybe later. you don't need to unstore a new version, you can just modify his type.

btw, about the topic, you can rename it by editing the first,and your latest messages
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: Add-on Help.

Post by FG_Prince2000 »

Thanks man! Sound great, whenever you have time is good. (preferably sooner than later of course, like within the next day or three rather than next month)
User avatar
The_Gnat
Posts: 2234
Joined: October 10th, 2016, 3:06 am
Contact:

Re: I can't get my add-on to work!

Post by The_Gnat »

FG_Prince2000 wrote:I can keep posting Q's about my addons here right? Since this topic is called "I can't get my addon to work"?
Yeah definitely!
FG_Prince2000 wrote:Hello again!

I am working on a campaign and I want a unit's horse to get shot, so I thought that I would store the unit "after shot" during the prestart event so that you don't see him til you unstore him after his horse gets shot. I thought that I could have him (preshot) move across the screen like the ship in the Heir to the Thrown campaign and when he gets to the spot where he will get shot he talks and then I unstore the "after shot version".
This is a more complex problem but it can be done if you use a [move_unit] Which takes a unit and move it to_x,to_y. See here:

Code: Select all

[move_unit]
     id=YOUR_UNITS_ID
     to_x=WHERE_YOU_WANT_IT_TO_GO_X
     to_y=WHERE_YOU_WANT_IT_TO_GO_Y
[/move_unit]
Then make someone shoot at him, maybe using a [animate_unit] tags which create a fake attack of one unit and can create a fake death of another:

Code: Select all

        [animate_unit]
            [filter]
                id=THE_PERSON_ATTACKING
            [/filter]
            flag=attack
            hits=yes
            [primary_attack]
                name=YOUR_ATTACKERS_WEAPON_NAME
            [/primary_attack]
            [facing]
                [filter]
                    id=YOUR_UNIT_ID
                [/filter]
            [/facing]

            #THEN THIS WILL MAKE THE HORSE GUY DEFEND
            #currently it makes your horse guy defend when he gets shot but
            #if you change it to say flag=death then it should animate his death instead
            [animate]
                [filter]
                    id=YOUR_HORSE_GUY
                [/filter]
                flag=defend
                hits=yes
                [secondary_attack]
                    name=HIS_WEAPON_NAME
                [/secondary_attack]
                [facing]
                    [filter]
                        id=THE_GUY_WHO_WAS_ATTACKING_HIM
                    [/filter]
                [/facing]
            [/animate]
        [/animate_unit]
Also if you want to get really complicated and interesting you an create an [extra_anim] for your unit and then load it by putting in the [animate] tag above flag=falling_off_horse_animation , or whatever you've called it.

Then modify your horse guy to be a normal guy using [modify_unit]:

Code: Select all

[modify_unit]
  [filter]
    id=YOUR_UNITS_ID
  [/filter]
  type=THE_NEW_TYPE_OF_UNIT_YOU_WANT_HIM_TO_BE
  #IF YOU WANT THIS HALVES THE HORSE GUYS HITPOINTS
  hitpoints = "$($this_unit.hitpoints / 2)
[/modify_unit]
Hopefully this helps!
FG_Prince2000
Posts: 35
Joined: November 9th, 2016, 11:04 am

Re: Add-on Help.

Post by FG_Prince2000 »

Wow! Thanks allot! I will try it out and see.
Post Reply