Results 1 to 3 of 3

Thread: spawn_character

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default spawn_character

    Greetings,

    I've been trying to get this one to work properly but something seems to elude me.

    EXCERPT MONGOL INVASION
    Code:
     monitor_event EventCounter EventCounterType mongols_invasion
      and EventCounter > 0
      if I_EventCounter mongols_invasion == 1
       add_events
      ;;; SCOUTING INVASION
        event emergent_faction mongols
        date 0
    ;     region  Tbilisi_Province
    ;    region  Yerevan_Province
    ;    region Bulgar_Province
        region Sarkel_Province
        region  Baghdad_Province
        movie event/mongols_invade.bik
        ;ADD MONGOL INVASION 1
        event counter mongols_invasion
              date 2
       end_add_events
      end_if
            if I_EventCounter mongols_invasion == 2
     
       ;Sarkel
       if I_CharacterTypeNearTile mongols named_character, 30 258, 134
        set_counter mongols_sarkel 1
       end_if
       ;Tbilisi / Yerevan
    ;   if I_CharacterTypeNearTile mongols named_character, 20 278, 101
    ;    set_counter mongols_yerevan 1
    ;   end_if
       ;Baghdad
       if I_CharacterTypeNearTile mongols named_character, 30 291, 70
        set_counter mongols_baghdad 1
       end_if
     ;;; MONGOL INVASION 1 SCRIPT
      spawn_army 
       faction mongols
       character Jebe, named character, age 30, x 292, y 166, family ;command 8, dread 9, loyalty 7, piety 1
       traits EasternWarlord 3 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 4 , Energetic 2 , StrategyDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3 ;command 8, dread 9, loyalty 7, piety 1
       unit  Mongol Bodyguard  exp 6 armour 0 weapon_lvl 0
       unit  Mongol Infantry   exp 6 armour 0 weapon_lvl 0
       unit  Mongol Infantry   exp 6 armour 0 weapon_lvl 0
       unit  Mongol Infantry   exp 6 armour 0 weapon_lvl 0
       unit  Mongol Infantry   exp 6 armour 0 weapon_lvl 0
       unit  Mongol Infantry   exp 6 armour 0 weapon_lvl 0
       unit  Mongol Foot Archers  exp 6 armour 0 weapon_lvl 0
       unit  Mongol Foot Archers  exp 6 armour 0 weapon_lvl 0
       unit  Mongol Foot Archers  exp 6 armour 0 weapon_lvl 0
       unit  Mongol Foot Archers  exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
       unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
      end
        spawn_character mongols, Yesuk, spy, age 20, x 289, y 165
        console_command give_trait Yesuk NaturalSpySkill 3
        console_command give_trait Yesuk GoodSpy 4
      
      ;;; move them to location of first invasion
      if I_CompareCounter mongols_sarkel = 1
       reposition_character Jebe, 280, 136
       reposition_character Aradai, 277, 133
       reposition_character Bayan, 278, 131
       reposition_character Abadhun, 276, 132
       reposition_character Bavdai, 276, 133
       reposition_character Yesuk, 276 134
      end_if
    ;  if I_CompareCounter mongols_yerevan = 1
    ;   reposition_character Jebe, 291, 109
    ;   reposition_character Aradai, 289, 108
    ;   reposition_character Bayan, 291, 107
    ;  end_if
      if I_CompareCounter mongols_baghdad = 1
       reposition_character Jebe, 292, 58
       reposition_character Aradai, 290, 60
       reposition_character Bayan, 293, 63
       reposition_character Abadhun, 290, 61
       reposition_character Bavdai, 290, 63
       reposition_character Yesuk, 289, 60
      end_if
    This is an excerpt from my campaign_script. Runs fine and doesn't seem to encounter problems except for the spawning part in game.

    Yesuk the spy is spawned, but nameless. He has all the traits he should have and can be reset and moved around the map via console just fine as if the game knows his name. It just isn't displayed.
    When he spawned nameless, the mongols camped outside Sarkel endlessly until the Timurids spawned and Yesuk finally got his name displayed.

    EXCERPT TIMURID INVASION
    Code:
     monitor_event EventCounter EventCounterType timurids_invasion
      and EventCounter > 0
      if I_EventCounter timurids_invasion == 1
      ;;; SCOUTING INVASION
       add_events
        event emergent_faction timurids
        date 0
    ;     region  Tbilisi_Province
    ;    region  Yerevan_Province
    ;    region Bulgar_Province
        region Sarkel_Province
        region  Baghdad_Province
        movie event/timurids_invade.bik
        ; ADD TIMURID INVASION 1
        event counter timurids_invasion
        date 2
       end_add_events
      end_if
      if I_EventCounter timurids_invasion == 2
      
       ;Sarkel
       if I_CharacterTypeNearTile timurids named_character, 30 258, 134
        set_counter timurids_sarkel 1
       end_if
       ;Tbilisi / Yerevan
    ;   if I_CharacterTypeNearTile timurids named_character, 20 278, 101
    ;    set_counter timurids_yerevan 1
    ;   end_if
       ;Baghdad
       if I_CharacterTypeNearTile timurids named_character, 30 291, 70
        set_counter timurids_baghdad 1
       end_if
      ;;; TIMURID INVASION 1 SCRIPT
       spawn_army 
        faction timurids
        character Timur, named character, age 30, x 292, y 166, family ;Command 9 Dread 9 Loyalty 6 Piety 4
        traits EasternWarlord 3 , GoodCommander 4 , Bloodthirsty 2 , Energetic 3 , BattleDread 3 , StrategyDread 2 , PublicFaith 4 , Loyal 1 , ContentGeneral 3 ;command 9, dread 9, loyalty 6, piety 4
        unit  Mongol Bodyguard  exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Lancers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
        unit  Mongol Heavy Archers exp 6 armour 0 weapon_lvl 0
        unit  Sabadar Militia   exp 6 armour 0 weapon_lvl 0
        unit  Sabadar Militia   exp 6 armour 0 weapon_lvl 0
        unit  Sabadar Militia   exp 6 armour 0 weapon_lvl 0
        unit  Sabadar Militia   exp 6 armour 0 weapon_lvl 0
        unit  ME Halberd Militia exp 6 armour 0 weapon_lvl 0
        unit  ME Halberd Militia exp 6 armour 0 weapon_lvl 0
        unit  Elephants exp 6 armour 0 weapon_lvl 0
        unit  Elephants    exp 6 armour 0 weapon_lvl 0
        unit  Elephants    exp 6 armour 0 weapon_lvl 0
        unit  Elephant Artillery  exp 6 armour 0 weapon_lvl 0
        unit  Elephant Artillery  exp 6 armour 0 weapon_lvl 0
       end
        spawn_character mongols, Yegu, spy, age 20, x 289, y 165
        console_command give_trait Yegu NaturalSpySkill 3
        console_command give_trait Yegu GoodSpy 4
      
       ;;; move them to location of first invasion
       if I_CompareCounter timurids_sarkel = 1
        reposition_character Timur, 280, 136
        reposition_character Husayn, 277, 133
        reposition_character Umar_Shaykh, 278, 131
        reposition_character Miran, 277, 136
        reposition_character Ghunan, 277, 135
        reposition_character Illugei, 277, 137
        reposition_character Yegu, 276, 137
       end_if
    ;   if I_CompareCounter timurids_yerevan = 1
    ;    reposition_character Timur, 291, 109
    ;    reposition_character Husayn, 289, 108
    ;    reposition_character Umar_Shaykh, 291, 107
    ;    reposition_character Miran, 288, 106
    ;   end_if
       if I_CompareCounter timurids_baghdad = 1
        reposition_character Timur, 292, 58
        reposition_character Husayn, 290, 60
        reposition_character Umar_Shaykh, 293, 63
        reposition_character Miran, 290, 65
        reposition_character Ghunan, 290, 61
        reposition_character Illugei, 290, 63
        reposition_character Yegu, 289, 63
       end_if
    The Timurid spy (well actually mongol, because in this iteration I forgot to change the second spawn's faction to timurid) was nameless now though, but both Mongols and Timurids immediately went into full attack mode.

    So what I want to know is why do the characters appear nameless until spawn_character is run again? When I did the initial test using england and spawning a spy for myself, it worked just fine, but in this expanded spawn code it doesn't.

    I've been thinking that maybe an "end" is needed after spawn_character, but alpaca's Script-O-Rama doesn't seem to suggest that one is needed or indeed should be there.

    Thanks for the help you can supply.
    (M2TW Links outdated, sorry)
    Want gunpowder, mongols, and timurids to appear when YOU do?

    Click here to read the solution
    Annoyed at laggy battles? This has all you need
    Got low fps in siege battles in particular? This tutorial is for you
    Want to play M2TW as a Vanilla experience minus annoying bugs? Get VanillaMod Visit the forum Readme
    Need improved and faster 2H animations? Download this!

  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: spawn_character

    The fault is in the comma:
    spawn_character mongols, Yegu, spy, age 20, x 289, y 165
    From the DocuDemon:
    spawn_character faction character_name, type, command 0, influence 0, management 0, subterfuge 0, age 20, x 54, y 124
    Hope that helped.










  3. #3

    Default Re: spawn_character

    Ahhhhh thanks a lot, I didn't notice that!
    (M2TW Links outdated, sorry)
    Want gunpowder, mongols, and timurids to appear when YOU do?

    Click here to read the solution
    Annoyed at laggy battles? This has all you need
    Got low fps in siege battles in particular? This tutorial is for you
    Want to play M2TW as a Vanilla experience minus annoying bugs? Get VanillaMod Visit the forum Readme
    Need improved and faster 2H animations? Download this!

Posting Permissions

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