Recalling a dead unit and keeping leadership

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.
Post Reply
User avatar
MathBrush
Posts: 191
Joined: February 12th, 2018, 10:21 pm

Recalling a dead unit and keeping leadership

Post by MathBrush »

I'm working on a Knalgan campaign and I'm putting on the finishing touches before asking for testers.

The point of the campaign is to give people a feeling for the actual 'knalgan' faction, not just criminals or dwarves separately.

Anyway, that means including ulfserkers. I have a hero ulfserker but, unfortunately, they die really really easily.

What I'm trying to do is to just let him die, but automatically recall him next time (with the excuse that he's 'sleeping it off').

So at the beginning of each game, I'm using

Code: Select all

		[recall]
			id=Konry
		[/recall]
(where Konry is the hero's id). I thought it might force him alive despite his death, but it's not working. How can I bring him back to life in the subsequent rounds after death?

I have a similar issue with {ABILITY_LEADERSHIP}. In the first round, I give it to my (footpad) leader:

Code: Select all

[side]
	side=1
	save_id=Florel
        controller=human
	{ABILITY_LEADERSHIP}
        recruit=Footpad, Thief
        gold=100
        team_name=human
        user_team_name= _ "Humans"
        type=Footpad
	gender=female
        id=Florel		
	name= _ "Florel"
        canrecruit=yes
	random_traits=yes
	[modifications]
	{TRAIT_LOYAL}
	[/modifications]
	unrenamable=yes
        facing=nw

	[unit]
		type=Thief
		id=Trud
		name=_"Trud"  # wmllint: ignore
		x,y=2,16
		random_traits=yes
	[/unit]
[/side]
It's preserved between scenarios, but she loses it on leveling up. Is there any way I can make it 'stick'?
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Recalling a dead unit and keeping leadership

Post by Pentarctagon »

I think you could try a last breath event for Konry, store him, then unstore him to x,y=recall,recall.
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
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Recalling a dead unit and keeping leadership

Post by octalot »

Store him in a name=last_breath event, and in the name=victory event put him on the player's recall list. Feel free to copy&paste from the Non Fatal Wounds add-on, which is more or less this.

Give her an [object] with:

Code: Select all

        [effect]
            apply_to=new_ability
            [abilities]
                {ABILITY_LEADERSHIP}
            [/abilities]
        [/effect]
User avatar
MathBrush
Posts: 191
Joined: February 12th, 2018, 10:21 pm

Re: Recalling a dead unit and keeping leadership

Post by MathBrush »

Ah, this is perfect. Thank you! Works like a charm :)
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die
User avatar
lhybrideur
Posts: 369
Joined: July 9th, 2019, 1:46 pm

Re: Recalling a dead unit and keeping leadership

Post by lhybrideur »

About the {ABILITY LEADERSHIP}, use an [object] to have him keep the ability when leveling up.
Post Reply