Recruit Variation Macro -- and boarding ships.

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.
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Recruit Variation Macro -- and boarding ships.

Post by junoslord »

I am trying to use this code below to run a test on a idea for my faction... having a cheap reserve unit that may be a crap level 0, or maybe a level 1 or 2. The example below is short and very heavily weighed, so I could see results. But I am getting an error, telling me there are 11 exceptions and it expected 3.
Spoiler:
It works with zombies. But I realize I am trying to use different unit types..... Is it a possibility to due something with an after recruit test where some get enough experience points to advance to the next level(s)?

-----

I am trying to use some of the ships to do a naval battle. How (using the plague feature) can I have a ship killed by Boarding Party switch sides? Mechanical is immune and I don't won't floating zombies. A die event filtered by unit type, then by mode of death-- but I don't know how to set this up. And instead of being at full health only be at 10hp (hp= 1 crew) to represent a small prize crew?
Spoiler:
I also have a problem with ships spawning on castle keeps if you don't assign them a water keep. Any ideas on how to avoid this from the recruit phase?
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Recruit Variation Macro -- and boarding ships.

Post by Pentarctagon »

For the first one, you need to put the third argument in quotes. Otherwise it thinks that every space represents the start of a new argument.
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
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: Recruit Variation Macro -- and boarding ships.

Post by junoslord »

Thanks for the idea, but this didn't work.

Somehow I need to manipulate the unit_type file... I think.
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Recruit Variation Macro -- and boarding ships.

Post by Crendgrim »

If I'm not mistaken, the macro you used only works for variations of a unit type, not for modifying the whole type. So, either you have to set up all your types as variations, or go a slightly more complicated way (if there isn't also a macro for that) using a recruit event and [modify_unit] to randomly modify its type.
UMC Story Images — Story images for your campaign!
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: Recruit Variation Macro -- and boarding ships.

Post by junoslord »

Crendgrim wrote:If I'm not mistaken, the macro you used only works for variations of a unit type...
I'm pretty sure you're right on that... but it does say in the wiki that it should work for anything, so I gave it a shot.

..you have to set up all your types as variations, or go a slightly more complicated way (if there isn't also a macro for that) using a recruit event and [modify_unit] to randomly modify its type.
I didn't find a macro listed, but [modify_unit] seems to be the best, easiest, solution... how would I set up the random factor?

I want 80% Reserve Archer, 16% Reserve Bowman, and 4% Reserve Master Bowman, do I use (none,none,Reserve Bowman)?
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Re: Recruit Variation Macro -- and boarding ships.

Post by junoslord »

While trying to figure out how to make boarding parties work (capture ships) with the plague I decided to change the ships to human...

This worked great! Not only do my ships have names now (allowing events), but they have traits as well. Which gives some variety and makes different ships more valuable for certain tasks. It also means that the ship is now vulnerable to the "plague" boarding party, and can be transformed. Except that it switches to a Walking Corpse, and now I have zombies floating around in the Atlantic.

I thought I managed to get around this, but I obviously put type=Prize Frigate in the wrong place. This is from the unit_type file, should this be in the victims file?

Code: Select all

    
[attack]
        name=short sword
        description=_"Boarding Party"
        icon=attacks/sword-human-short.png
        type=blade
        range=melee
        damage=21
        number=1
        [specials]
            {WEAPON_SPECIAL_PLAGUE}
	    type=Prize Frigate                    ### <---------- Misplaced?
        [/specials]
    [/attack]
Once this works properly how do I get it to account for the different class ships... a Sloop or Trade Junk shouldn't respawn as a Prize Frigate.



On a side note. I was looking at the race files and a lot of them are using macros... What files do I need to edit to create new races?
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
User avatar
Piko555
Posts: 75
Joined: January 12th, 2013, 11:27 am
Location: Poland

Re: Recruit Variation Macro -- and boarding ships.

Post by Piko555 »

It propably should look that:

Code: Select all

    
[attack]
        name=short sword
        description=_"Boarding Party"
        icon=attacks/sword-human-short.png
        type=blade
        range=melee
        damage=21
        number=1
        [specials]
            {WEAPON_SPECIAL_PLAGUE_TYPE Prize Frigate}
        [/specials]
    [/attack]
About the races: look at races.cfg in /core, and make a similar file, with custom races made by You.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Recruit Variation Macro -- and boarding ships.

Post by zookeeper »

Piko555 wrote: {WEAPON_SPECIAL_PLAGUE_TYPE Prize Frigate}
...with the difference that WEAPON_SPECIAL_PLAGUE_TYPE takes one argument, not two.
User avatar
Piko555
Posts: 75
Joined: January 12th, 2013, 11:27 am
Location: Poland

Re: Recruit Variation Macro -- and boarding ships.

Post by Piko555 »

Yes, it does. What do You suggest for unit types with a space in their id?
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Recruit Variation Macro -- and boarding ships.

Post by Ceres »

Put parantheses or quotes around it.
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

Question about boarding ships, gold, storing units, & traits

Post by junoslord »

I have the plague working, as long as I change the ships to human... but I have another situation crop up. When the ships kill a ground unit, the ground unit spawns as a Prize Ship. Maybe not a problem but the AI sees a unit with 0% defense and will always use a unit that would otherwise attack a threat to go after it.

Is there a way to make certain units immune, or better yet make only units with the movement_type:float affected. (Can you filter move_type?) The other alternative is to make the attack only valid against other ships...

--------

I have figured out how to add and reset gold, but not how to deduct 5 gold from a side during an event. This gets me a skip over during the event and the rest of the event does nothing.

Code: Select all

	[gold]
	side=1
	amount=-50
	[/gold
----------

I am trying to create amphibious assault units. To do this I need to store and unstore in the same event, but have never tried storing and am screwing up royally somewhere. I have this working now without storing but when you "repack" the unit and then "unpack" again you get completely new units (new name,traits) and I would like to be able to save unit experience and traits.
Spoiler:
--------

I would like to give all my warships the healthy trait, but with ships averaging around 90hp repairing 2hp a turn seems too small. Is there a way to give 'heal' to a unit and only have it effect itself? Or bump healthy up?
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Question about boarding ships, gold, storing units, & tr

Post by 8680 »

junoslord wrote:

Code: Select all

	[gold]
	side=1
	amount=-50
	[/gold
I think that should work, assuming you didn’t actually forget the last bracket. Please post the surrounding event.
junoslord wrote:I am trying to create amphibious assault units.
I think you mean this:

Code: Select all

[event]
    name=moveto
    first_time_only=no
    [filter]
        side=1
        type=Marine Archer,Marine Bowman,Marine Master Bowman
        [filter_location]
            terrain=Wwrt
        [/filter_location]
    [/filter]
    [store_unit]
        [filter]
            id=$unit.id
        [/filter]
        variable=storedAmphibian
    [/store_unit]
    [set_variable]
        name=storedAmphibian.type
        value="Artillery Barge"
    [/set_variable]
    [unstore_unit]
        variable=storedAmphibian
    [/unstore_unit]
[/event]
However, I think it would be better to replace the store-modify-unstore block with one of these:

Code: Select all

## Hitpoints are the full maximum of an Artillery Barge and status is cleared.
[modify_unit]
    [filter]
        id=$unit.id
    [/filter]
    type="Artillery Barge"
[/modify_unit]

Code: Select all

## Hitpoints and other status is unchanged.
[transform_unit]
    id=$unit.id
    transform_to="Artillery Barge"
[/transform_unit]
junoslord wrote:I would like to give all my warships the healthy trait, but with ships averaging around 90hp repairing 2hp a turn seems too small. Is there a way to give 'heal' to a unit and only have it effect itself? Or bump healthy up?
Regenerates?
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

[modify_unit] & keeping and adding traits

Post by junoslord »

gold= missing bracket... 8)

regenerate: Thought about that, but it's like the portage-- 2 is too cold, 8 is too hot, but 4 seems just right. In the end I might go with a bit of both, depending on the ship size.

[modify_unit] I used the modify unit option and it worked. So, thank you for the help on that.

But it has one problem... When I recruit and send the Barge off to land everything is fine. The Marine goes ashore, clears the island and moves to reboard the barge. But the problem is: if the unit already leveled up when it gets off the ship again it will be a archer (lvl1) again. (I hope that makes sense.)

There is a solution though: I need to make 4 Artillery Barges, 1 for recruiting, and 1 each for each level of archer unit. Then I need to do this for all the other Marine unit lines (5 lines/14 units total, plus 2 support lines/5 units-- as well as, theoretically, the entire National Army line). Then in the scenario I need to create a base landing, an embarkation, and a second landing event for each individual unit... That's 57 events!

It'll work but it'll be huge! Any idea on the second landing how to get around this and make sure each unit_type is what's it's supposed to be?

--------

Also, if my units and my ships are both human... so they draw from the same pool of traits... If I set the barge num_traits=0 will this erase the traits of the units inside them? This is in the wiki where it talks about keeping unit lines of the same race or you will loose traits for units.

To the same point... If I add a fixed trait to a unit {fearless} in this case to a second level unit in a line and change num_traits=3, will this add the fearless trait and keep the two existing traits intact?
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: [modify_unit] & keeping and adding traits

Post by 8680 »

junoslord wrote:regenerate: Thought about that, but it's like the portage-- 2 is too cold, 8 is too hot, but 4 seems just right.
Many add-ons have a regenerates +4 ability you could copy. And what’s this about portage? In the context of “too cold, too hot, just right” I’d assume you mean “porridge”, but in the wider context of boats, “portage” could work too.
junoslord wrote:But it has one problem...
Perhaps each unit’s former type could be stored in its [variables]?
User avatar
junoslord
Posts: 82
Joined: June 11th, 2012, 3:13 pm
Location: Enveloping your left flank.

{ABILITY_REPAIR}

Post by junoslord »

So this should be easy, right...

I found the ability file in the core/macro folder and copied the regenerates ability to create a new one called repair. Below is the second version. In the first version I left [regenerate] because I thought I would try to 'mirror' it by leaving the bracket and id= the same, I also tried 5% instead of a value.
Spoiler:
For the third try I changed everything to repair and used a numeric value.
Spoiler:
The last thing I tried was replacing the value= with this from a trait macro before realizing it would increase hp not repair.

Code: Select all

        [effect]
            apply_to=hitpoints
            increase_total=5%
        [/effect]
Point is I get 'macro/file "Special_Note_Repair" is missing in unit_type file' errors whatever I try to do.

If I remove the "S_N_R" tag from the [unit_type] file and add {ABILITY_REPAIR} to either the [unit_type] or [unit] it runs the scenario without error, but doesn't show 'repair' as an ability. And the last time it didn't increase the hp of the unit I manually assigned it to in the [unit_type] file.

What am I doing wrong? Everything is in the core folder, with the others.

I thought I would ask before repeating this as an attempt to make a trait... But this almost does what I want it to do, and I thought I'd try to get it to work first.
America-- Land of the Free, home of the Brave! "And now that we've taken care of the Braves we're coming after the Free."

"BANNED!!! What the hell do you mean BANNED? All I did was call one narrow-minded, power-hungry Nazi moderator a narrow-minded, power-hungry Nazi!"
Post Reply