Results 1 to 7 of 7

Thread: Kill Unit After Training

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    UndyingNephalim's Avatar Primicerius
    Patrician Artifex

    Join Date
    Jan 2011
    Posts
    3,967

    Default Kill Unit After Training

    Is there a way to make it so that a unit is immediately killed when it is trained? I'm trying to create the effect of summoning units from the edge of the map rather then in a settlement. So far this is my script:
    Code:
    monitor_event UnitTrained UnitType Manhunters
        and I_SettlementOwner Fort_of_Wings = zola
    
        kill_unit
    
        spawn_army
            faction zola
            character no_name, general, age 20, x 201, y 92
            unit Manhunters exp 0 armour 0, weapon_lvl 0
        end
    end_monitor
    Everything works perfectly except the killing of the original unit, so it still exists in the settlement in addition to the unit that is spawned. Is there any way to kill the unit immediately once training is complete? If not is there a way to reposition a unit to new coordinates immediately after it's finished being trained?

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Kill Unit After Training

    You need a unit label with the kill_unit command - big drawback as it kills all existing units with that label. No problem if you only allow one unit.

    kill_unit Manhunters

    You need the name of a character before you can move him.

    Workaround:

    • create a copy of that unit in the EDU with only a minor difference in name and a no_custom entry.
    • Spawn that unit.
    • Example for name: Manhunter-s, entry in export_units: {Manhunter-s}Manhunter - same display name as the recruitable unit.
    • Don't forget the unit pics.
    Last edited by Gigantus; September 14, 2012 at 03:37 AM.










  3. #3

    Default Re: Kill Unit After Training

    Gigantus
    Command kill_units kill all existing units or all units belongs to specific faction?

  4. #4
    UndyingNephalim's Avatar Primicerius
    Patrician Artifex

    Join Date
    Jan 2011
    Posts
    3,967

    Default Re: Kill Unit After Training

    Very nice workaround, though the log keeps bringing up an error when I try this method:

    "Error in battle script command "kill_unit": invalid unit label "Manhunter_s"

    I get the impression that "unit_label" does not equal the name of the unit in the EDU.

    EDIT: Did not notice the new posts before I made this one.

  5. #5

    Icon1 Re: Kill Unit After Training

    I think that the ‘destroy_units’ command might work better:
    Code:
    	monitor_event UnitTrained SettlementName Fort_of_Wings
        		and I_SettlementOwner Fort_of_Wings = zola
    		and UnitType Manhunters A
    		destroy_units zola Manhunters A
        	spawn_army
            	faction zola
            	character random_name, general, age 20, x 201, y 92
            	unit Manhunters B exp 0 armour 0, weapon_lvl 0
        	end
    	end_monitor
    Last edited by TNZ; September 14, 2012 at 04:10 AM. Reason: zola not france

  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Kill Unit After Training

    I think that kill_unit is for the battle map only. Units can't be labeled in the campaign map.

    destroy_units is the one, as TNZ said. And, yes, it kills all units of that kind in the faction.

  7. #7
    UndyingNephalim's Avatar Primicerius
    Patrician Artifex

    Join Date
    Jan 2011
    Posts
    3,967

    Default Re: Kill Unit After Training

    Quote Originally Posted by Withwnar View Post
    I think that kill_unit is for the battle map only. Units can't be labeled in the campaign map.

    destroy_units is the one, as TNZ said. And, yes, it kills all units of that kind in the faction.
    destroy_units works just fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •