Page 1 of 2 12 LastLast
Results 1 to 20 of 30

Thread: How to spawn family members via script.

  1. #1
    OfficerJohn's Avatar Domesticus
    Join Date
    Jan 2009
    Location
    Scandinavia
    Posts
    2,317

    Default How to spawn family members via script.

    I didn't see any threads explaining how to do this, so I decided to make my own, because it is just too easy.

    I stumbled across this in the Rusichi: Total War mod - an awesome mod with many awesome features, and even though I'm hardly interested in Russian culture, history or anything (no offence to Russia, Russians or the mod-makers, I just have to admit the setting wasn't really for me) I consider this mod, gameplay-wise, to be among the best I've ever played. And personally I would pick it over most of the other, more popular mods any day. Also, it was in their mod that I found this feature.
    Seems like the Russians are ahead of the rest of us in TW modding...

    I'm taking that you have a basic knowledge about scripting, as I'm not trying to teach you how to spawn armies in general, I'm just learning you how to spawn someone on the campaign map that instantly gets adopted into the family tree. If you want to do this, please, read other tutorials about scripting first.
    You cannot, however, control who becomes the father of this character. The system works like this, I think (I haven't done much testing):
    1. The character is spawned as a son of the faction leader.
    2. If the faction leader has the maximum amount of children, then the character is spawned as a son of the faction heir.
    3. If the heir has the maximum amount of children, I dunno what happens... but I'm pretty sure it works just like the vanilla adoption system (most logical anywho). As said, I haven't done much (hardly any) testing - I've just seen it in the Rusichi mod, opened their script-file, found the characters they spawn as family members, read it and understood how it works.

    What you do is that you write a regular spawn_army script, but you add one word:
    Code:
        spawn_army 
            faction <faction_name>
            character    <character_name>, named character, age <age>, x <x-coordinate>, y <y-coordinate>, family
            traits <traits>
            unit        <bodyguard_unit>
        end
    That should do the trick. The character will not only be spawned as a general, but automatically adopted into the family tree as well - if you spawn him with loads of authority, then the character will probably become the next heir...


    Oh, and please, the rep's for the Rusichi guys... This is actually not my work at all, I just wanted to share it, just in case...

  2. #2
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: How to spawn family members via script.

    Docudemons, you might want to check them out

    Identifier: spawn_army ... end
    Parameters: faction, character and units as in army description in historical battle (character description for general and unit descriptions for remainder of the army)
    Description: create an army at a particular location
    Sample use: spawn_army
    faction romans_julii
    character Foedus Chaerea, general, command 0, influence 0, management 0, subterfuge 0, age 20, x 54, y 124, direction NE, family, label script_label, battle_model model_name
    unit roman generals guard cavalry soldiers 20 exp 9 armour 1 weapon_lvl 0
    unit roman legionary first cohort ii soldiers 40 exp 0 armour 0 weapon_lvl 0
    unit roman legionary cohort ii soldiers 60 exp 0 armour 0 weapon_lvl 0
    unit roman praetorian cohort i soldiers 60 exp 0 armour 0 weapon_lvl 0
    end
    Class: SPAWN_ARMY
    Implemented: Yes
    Author: Guy

    But actually I just found them a little tricky to find. They should be stickied in this forum, especially given their usefulness compared to what is currently stickied.

    edit:

    Ah saved by google ... http://www.twcenter.net/forums/downl...o=file&id=1681
    Last edited by Taiji; July 22, 2010 at 09:22 AM.

  3. #3
    OfficerJohn's Avatar Domesticus
    Join Date
    Jan 2009
    Location
    Scandinavia
    Posts
    2,317

    Default Re: How to spawn family members via script.

    I have that (just too lazy to use it properly), but many people here seem to think that family members can't be spawned via script, so I figured it was in it's place to make a how-to...

  4. #4
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,760
    Blog Entries
    3

    Default Re: How to spawn family members via script.

    Quote Originally Posted by Taiji View Post
    But actually I just found them a little tricky to find. They should be stickied in this forum, especially given their usefulness compared to what is currently stickied.

    edit:

    Ah saved by google ... http://www.twcenter.net/forums/downl...o=file&id=1681
    *cough* GED's sticky *cough*
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  5. #5

    Default Re: How to spawn family members via script.

    I have always liked this command. With it's help i always make Saladin and Osman family members so in due time they can become Sultans.

  6. #6
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: How to spawn family members via script.

    Quote Originally Posted by Sqυιd View Post
    *cough* GED's sticky *cough*
    You're absolutely right... and I'm a bit stumped as to how I could have forgotten it. Thankyou for pointing out my error, Squid

    edit:

    Although in fact the original files are much better presented. With the 'Ultimate Docudemons' there are something like 15 lines of useless stuff getting in the way of my view. Perhaps there is some thing wrong with my excel viewer, or perhaps I'm missing some trick for getting rid of the useless stuff.

    Example:
    "Triggers are data objects consisting of an event on which to test, a number of conditions, and a list of effects. These effects can be upon character traits
    or upon advice, although this could easily be extended to other domains of activity such as the world, the empire, diplomacy &c.

    The triggers themselves are not encoded in the project - they are read in from an external file and instantiations of triggers are stored in an array indexed
    by their event.

    If you wish to add new triggers, consult the list of extant triggers and see if you are merely redefining a trigger that already exists. You can do this by
    examining the advice and VnV spreadsheets. If you are satisfied that this is indeed a new trigger, ask yourself when the trigger should be tested, and under
    what conditions the trigger should fire. If either the condition or the event is unavailable, request from Guy that they be added to the set.

    Conditions which take no logic_token in their parameter list can be negated by prepending them with not, e.g. not WonBattle

    The events are in events.txt. This document contains the current set of conditions. They are:"
    Surely noone needs that onscreen at all times.
    Last edited by Taiji; July 28, 2010 at 12:23 PM.

  7. #7
    mattgoby's Avatar Campidoctor
    Join Date
    Nov 2009
    Location
    Northants england
    Posts
    1,957

    Default Re: How to spawn family members via script.

    If anyone knows how to write scripts along these lines message FOR GONDOR http://www.twcenter.net/forums/member.php?u=67783 if you want to help with a tatw submod. The general idea is that the witchking is spawned along with his chosen generals as family members for orcs of gundabad at about turn 75 killing the original family members in the process.
    "some people say the iraq war is unnessasary, however i disagree its good practise in case one comes along that we need to fight, just in case the germans have another go"-AL MURRAY

    "us british our world war champions of the world"-AL MURRAY

  8. #8
    irishron's Avatar Cura Palatii
    Join Date
    Feb 2005
    Location
    Cirith Ungol
    Posts
    47,023

    Default Re: How to spawn family members via script.

    @mattgoby, have you checked http://www.twcenter.net/forums/forumdisplay.php?f=364 and gone through the applications?

  9. #9
    mattgoby's Avatar Campidoctor
    Join Date
    Nov 2009
    Location
    Northants england
    Posts
    1,957

    Default Re: How to spawn family members via script.

    WEll im not the mod leader and he is on holiday for awhile and only has internet access from his mums phone so i can actually recrute anyone .
    "some people say the iraq war is unnessasary, however i disagree its good practise in case one comes along that we need to fight, just in case the germans have another go"-AL MURRAY

    "us british our world war champions of the world"-AL MURRAY

  10. #10

    Default Re: How to spawn family members via script.

    Hello all.
    I am currently MED2 Renaissance and I would like to appear with his portrait François 1st.
    However, the script does not start. Do you have any explanation for me?
    Here's the script:

    monitor_event PreFactionTurnStart FactionType france
    and I_TurnNumber = 1
    send_character_off_map Francois du Guesclin
    spawn_army
    faction france
    character Francois du Guesclin, named character, age 16, x 92, y 133, portrait francoisI
    traits LoyaltyStarter 1, ReligionStarter 1, GoodCommander 3, NaturalMilitarySkill 2, Intelligent 1, NightBattleCapable 1
    unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
    unit Arquebusiers exp 0 armour 0 weapon_lvl 0
    unit Lancers exp 0 armour 0 weapon_lvl 0
    end

    terminate_monitor
    end_monitor

    NB. : du Guesclin = " d'Angoulême"

    Thanks

  11. #11
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: How to spawn family members via script.

    I don't think you can change portraits in game

  12. #12

    Default Re: How to spawn family members via script.

    yes, it seam !

  13. #13

    Default Re: How to spawn family members via script.

    Just wondering , will this work in r.t.w. vanilla, B.I. and Alexander , or is it only applicable to later versions , if it works in the older games it will solve a headache I've been having spawning "faces" by script ,( it doesn't cause a crash , but gives an error warning about the "face" not being in the family tree and this being a bad thing ,on shutdown) frustrating as I'm an amateur genealogist!
    thanks a lot for this information , I'm going to try it out and see what happens!

  14. #14

    Default Re: How to spawn family members via script.

    Sorry for answering my own question folks , but "family" seems to work in Alexander , the pesky warning has gone now . Thanks loads for this Officer John and all at Rusichi , The new "Faces" don't seem to always be adopted but it stops the warning.

  15. #15

    Default Re: How to spawn family members via script.

    is it possible to spawn other characters this way, like inquisitors, patriarchs or heretics?

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to spawn family members via script.

    You can spawn agents, but not as family members, examples:

    Code:
            spawn_character    [faction], [name], diplomat, age 40, x 340, y 168
            spawn_character    [faction], [name], merchant, age 40, x 340, y 170
            spawn_character    [faction], [name], spy, age 40, x 340, y 170










  17. #17

    Default Re: How to spawn family members via script.

    yeah, like that. this way i can ''spice-up'' campaign by putting a major heretic in Lithuania or grate inquisitor in Burgundy! thx man

  18. #18
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to spawn family members via script.











  19. #19
    Melvasul's Avatar Biarchus
    Join Date
    May 2012
    Location
    Italy
    Posts
    632

    Default Re: How to spawn family members via script.

    What if I wanted to spawn the faction leader?
    I mean that after a certain event is triggered I want to respawn the faction leader(and do other stuff)
    The problem is that if I kill the faction leader the heir will become the faction leader and so the new spawned one would be the new heir.

    Unless I
    Kill the old Faction Leader (A)
    the old Heir (B) become the new Faction Leader
    I respawn A who becomes the new Heir
    I kill B so A becomes the new Faction Leader
    (and maybe respawn B so it's the new heir)

    could this be done?

  20. #20
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: How to spawn family members via script.

    There will always be a faction leader already in the game and a heir (unless you have only one eligible family member left). Hence the only alternative is the mass murder you describe

    It is however possible to avoid the second murder if you use this method (giving a high level trait as described) when spawning your new leader before killing the old one..










Page 1 of 2 12 LastLast

Posting Permissions

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