Results 1 to 8 of 8

Thread: problems with a script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ducenarius
    Join Date
    Nov 2004
    Location
    MA
    Posts
    929

    Default problems with a script

    hi there, i'm trying to make some additions to the show_me_how script for the SPQR mod by LT. i'm running into some problems. wondering if someone here might help me...

    1) what do i have to do to spawn a character whose name doesn't exist for the faction under descr_names.txt? for instance, i wanted to spawn an "Eunus" to simulate a First Servile War on sicily. the name doesn't exist at all in descr_names.txt, so i added it to the surnames available to the slave faction. i then also just tacked it onto the end of descr_names_lookup.txt

    and then there's names.txt in the ...\data\text\ folder. i tried adding it in similar format via notepad, as
    Code:
    {Eunus}			Eunus
    but when the character spawns, the character scroll is completely blank - not even lines that say "traits" or "retinue".

    1a) also, i noticed that the chirugeon never gets added even though i have the line via the console_command option, and if i manually bring up the console the next turn (after the character already spawned) and manually type in "give_ancillary", then the chirugeon can be added. why isn't it working via the script?

    2) i'm trying to simulate revolts to the "rebel roman" (aka scipii faction slot) faction once the roman player reaches a certain number of provinces. but something goes wrong...
    Code:
    monitor_event FactionTurnStart FactionType romans_scipii
    and I_LocalFaction romans_julii
    and I_NumberOfSettlements romans_julii > 48
    and I_TurnNumber = 400
    
    
    if I_SettlementOwner Valencia = romans_julii
    console_command control romans_scipii
    console_command capture_settlement Valencia
    console_command control romans_julii
    
    spawn_army
    faction romans_scipii
    character Quintus Sertorius, named character, age 35, x 64, y 145	
    unit		roman generals guard cavalry			exp 3 armour 3 weapon_lvl 0
    unit		roman light infantry auxillia			exp 3 armour 0 weapon_lvl 0
    unit		roman light infantry auxillia			exp 3 armour 0 weapon_lvl 0
    unit		roman archer auxillia				exp 3 armour 0 weapon_lvl 0
    unit		roman archer auxillia				exp 3 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman legionary cohort i			exp 5 armour 0 weapon_lvl 0
    unit		roman cavalry auxillia late			exp 5 armour 1 weapon_lvl 0
    unit		roman medium cavalry				exp 5 armour 1 weapon_lvl 0
    unit		roman medium cavalry				exp 5 armour 1 weapon_lvl 0
    unit		roman infantry auxillia				exp 4 armour 1 weapon_lvl 0
    unit		roman infantry auxillia				exp 4 armour 1 weapon_lvl 0
    
    console_command give_ancillary "Quintus Sertorius" chirugeon
    console_command give_ancillary "Quintus Sertorius" historian
    console_command give_ancillary "Quintus Sertorius" orator
    console_command give_trait "Quintus Sertorius" GoodCommander 3
    console_command give_trait "Quintus Sertorius" GoodDefender 2
    console_command give_trait "Quintus Sertorius" Brave 1
    console_command give_trait "Quintus Sertorius" PublicFaith 1
    console_command give_trait "Quintus Sertorius" HaleAndHearty 2
    
    console_command create_unit Valencia "roman praetorian cohort urban i" 5,4
    console_command create_unit Valencia "roman light infantry auxillia" 2,2
    console_command create_unit Valencia "roman archer auxillia" 2,2
    console_command create_unit Valencia "roman infantry auxillia" 2,4
    end_if
    
    if I SettlementOwner Tarraco != romans_julii
    console_command control romans_scipii
    console_command capture_settlement Tarraco
    console_command control romans_julii
    
    console_command create_unit Tarraco "roman praetorian cohort urban i" 5,4
    console_command create_unit Tarraco "roman light infantry auxillia" 2,2
    console_command create_unit Tarraco "roman archer auxillia" 2,2
    console_command create_unit Tarraco "roman infantry auxillia" 2,4
    end_if
    
    if I SettlementOwner Carthago_Novo != romans_julii
    console_command control romans_scipii
    console_command capture_settlement Carthago_Novo
    console_command control romans_julii
    
    console_command create_unit Carthago_Novo "roman praetorian cohort urban i" 5,4
    console_command create_unit Carthago_Novo "roman light infantry auxillia" 2,2
    console_command create_unit Carthago_Novo "roman archer auxillia" 2,2
    console_command create_unit Carthago_Novo "roman infantry auxillia" 2,4
    end_if
    
    end_monitor
    so... what happens is that the spawned general (quintus sertorius) somehow spawns twice in the same turn, so there ends up two almost-identical stacks, except the second one gets none of the traits and ancillaries, since the console command lines only recognizes and affects the first one spawned.

    anyone know what i did wrong?

    3) i'd also like to randomize the event some more, so that it won't occur in a fixed date/turn, but that once it occurs, it won't happen again.

    taking a hint from EB's script for the epeiros alliance (see the relevant section in their script, EBBS_SCRIPT.TXT), it seems that they use the presence of a script-constructed building (via "console_command create_building...") as a check for whether the event has or hasn't already occured. for this purpose (and others) they seem to have created an entirely new class of hinterland-type (ie, indesctructible, like farms and roads) buildings for the mod. seeing as i wanted to avoid that level of additional modding, i decided to just use some of the other temples which the romans can't, and have it be generated in the senate capital (Roma) if/when the event occurs.

    however, since it is a religious building, i also added a monitor_event to first make sure rome has already built its native temple (leadership, ie., jupiter) by the turn before the timeframe of the scripted event, otherwise the presence of the other generated temple would prevent the player (AI or human) from ever building/upgrading it unless they first destroy the script-generated temple, which was used as a placeholder to indicate whether or not a certain scipted event had already occured.

    the problem is, this monitor_event (second one below) seems to create something like 15+ identical jupiter shrines in Roma within that one turn.

    (i forget why i chose it to occur during macedon's turn, but i think i remember that it didn't seem to trigger at all when i put "FactionTurnStart slave".)

    i didn't want to try other buildings like taverns, caravans, etc, since that would also involve dealing with trait and ancillary triggers associated with them. although if i can't solve this "building-spamming" problem in my current attempt, i may resort to that after all.

    Code:
    declare_counter Eunus
    
    monitor_event FactionTurnStart macedon
    and SettlementBuildingExists Roma = temple_of_battle_shrine
    set_counter Eunus 2
    end_monitor
    
    
    monitor_event FactionTurnStart macedon
    and I_LocalFaction romans_julii
    and I_TurnNumber = 140
    and not SettlementBuildingExists Roma >= temple_of_leadership_shrine
    
    console_command create_building Roma temple_of_leadership_shrine
    
    end_monitor
    
    
    monitor_event FactionTurnStart FactionType slave
    and I_LocalFaction romans_julii
    and I_CompareCounter Eunus != 2
    and I_NumberOfSettlements romans_julii > 20
    and I_SettlementOwner Taras = romans_julii
    and I_SettlementOwner Messana = romans_julii
    and I_SettlementOwner Syracusa = romans_julii
    and I_SettlementOwner Lilybeon = romans_julii
    and I_SettlementOwner Carali = romans_julii
    and I_SettlementOwner Patavium = romans_julii
    and I_SettlementOwner Mediolanum = romans_julii
    and I_TurnNumber > 140
    and I_TurnNumber < 240
    and RandomPercent < 10
    
    spawn_army
    faction slave
    character Eunus, named character, age 35, x 180, y 112	
    unit		generic rebel general				exp 5 armour 3 weapon_lvl 0
    unit		merc cilician pirate				exp 3 armour 2 weapon_lvl 0
    unit		merc cilician pirate				exp 3 armour 2 weapon_lvl 0
    unit		merc balearic slingers				exp 0 armour 0 weapon_lvl 0
    unit		merc balearic slingers				exp 0 armour 0 weapon_lvl 0
    unit		merc peltast					exp 0 armour 0 weapon_lvl 0
    unit		merc peltast					exp 0 armour 0 weapon_lvl 0
    unit		carthaginian archer				exp 0 armour 1 weapon_lvl 0
    unit		greek hoplite militia				exp 2 armour 0 weapon_lvl 0
    unit		greek hoplite militia				exp 2 armour 0 weapon_lvl 0
    unit		greek hoplite militia				exp 2 armour 0 weapon_lvl 0
    unit		greek hoplite militia				exp 2 armour 0 weapon_lvl 0
    unit		carthaginian infantry				exp 1 armour 0 weapon_lvl 0
    unit		carthaginian infantry				exp 1 armour 0 weapon_lvl 0
    unit		carthaginian peasant				exp 1 armour 1 weapon_lvl 0
    unit		carthaginian peasant				exp 1 armour 1 weapon_lvl 0
    unit		greek peasant					exp 1 armour 1 weapon_lvl 0
    unit		greek peasant					exp 1 armour 1 weapon_lvl 0
    unit		greek medium cavalry				exp 1 armour 1 weapon_lvl 0
    unit		merc samnite					exp 0 armour 0 weapon_lvl 0
    
    console_command give_ancillary Eunus chirugeon
    console_command give_ancillary Eunus historian
    console_command give_ancillary Eunus orator
    console_command give_trait Eunus GoodCommander 2
    console_command give_trait Eunus GoodDefender 1
    console_command give_trait Eunus HatesRomans 1
    console_command give_trait Eunus Brave 1
    console_command give_trait Eunus PublicFaith 1
    console_command give_trait Eunus HaleAndHearty 1
    
    console_command create_building Roma temple_of_battle_shrine
    
    end_monitor
    so... advice and help, anyone? many thanks.

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

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

    Default Re: problems with a script

    First thing IIRC all characters need to have a last name, and second IIRC any name you use has to be valid for the faction/culture they are in (I can't remember which way it is organized).

    For the ancillary not working via script my guess the problem is with the fact that the character doesn't have a last name or doesn't have a valid first name.
    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

  3. #3
    Ducenarius
    Join Date
    Nov 2004
    Location
    MA
    Posts
    929

    Default Re: problems with a script

    i've been able to spawn one-name characters like "spartacus" with no problem.

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

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

    Default Re: problems with a script

    I'm not saying you can't spawn them, I'm saying that because they only have one name it's causing problems. I've never seen any character created by the game (for which the script command work) have only one name.
    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
    Ducenarius
    Join Date
    Nov 2004
    Location
    MA
    Posts
    929

    Default Re: problems with a script

    yes, but i've spawned the spartacus without any problems to my knowledge or recollection. the units in the stack were correct, and he got all the traits and ancillaries (other than the chirugeon, which was also a problem with "full named" characters that i spawned), and they appeared normally when i brought up the character scroll

  6. #6
    Ducenarius
    Join Date
    Nov 2004
    Location
    MA
    Posts
    929

    Default Re: problems with a script

    bump

  7. #7

    Default Re: problems with a script

    Quote Originally Posted by tai4ji2x View Post
    hi there, i'm trying to make some additions to the show_me_how script for the SPQR mod by LT. i'm running into some problems. wondering if someone here might help me...

    1) what do i have to do to spawn a character whose name doesn't exist for the faction under descr_names.txt? for instance, i wanted to spawn an "Eunus" to simulate a First Servile War on sicily. the name doesn't exist at all in descr_names.txt, so i added it to the surnames available to the slave faction. i then also just tacked it onto the end of descr_names_lookup.txt

    and then there's names.txt in the ...\data\text\ folder. i tried adding it in similar format via notepad, as
    Code:
    {Eunus}            Eunus
    but when the character spawns, the character scroll is completely blank - not even lines that say "traits" or "retinue".

    1a) also, i noticed that the chirugeon never gets added even though i have the line via the console_command option, and if i manually bring up the console the next turn (after the character already spawned) and manually type in "give_ancillary", then the chirugeon can be added. why isn't it working via the script?

    2) i'm trying to simulate revolts to the "rebel roman" (aka scipii faction slot) faction once the roman player reaches a certain number of provinces. but something goes wrong...
    Code:
    monitor_event FactionTurnStart FactionType romans_scipii
    and I_LocalFaction romans_julii
    and I_NumberOfSettlements romans_julii > 48
    and I_TurnNumber = 400
    
    
    if I_SettlementOwner Valencia = romans_julii
    console_command control romans_scipii
    console_command capture_settlement Valencia
    console_command control romans_julii
    
    spawn_army
    faction romans_scipii
    character Quintus Sertorius, named character, age 35, x 64, y 145    
    unit        roman generals guard cavalry            exp 3 armour 3 weapon_lvl 0
    unit        roman light infantry auxillia            exp 3 armour 0 weapon_lvl 0
    unit        roman light infantry auxillia            exp 3 armour 0 weapon_lvl 0
    unit        roman archer auxillia                exp 3 armour 0 weapon_lvl 0
    unit        roman archer auxillia                exp 3 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman legionary cohort i            exp 5 armour 0 weapon_lvl 0
    unit        roman cavalry auxillia late            exp 5 armour 1 weapon_lvl 0
    unit        roman medium cavalry                exp 5 armour 1 weapon_lvl 0
    unit        roman medium cavalry                exp 5 armour 1 weapon_lvl 0
    unit        roman infantry auxillia                exp 4 armour 1 weapon_lvl 0
    unit        roman infantry auxillia                exp 4 armour 1 weapon_lvl 0
    
    console_command give_ancillary "Quintus Sertorius" chirugeon
    console_command give_ancillary "Quintus Sertorius" historian
    console_command give_ancillary "Quintus Sertorius" orator
    console_command give_trait "Quintus Sertorius" GoodCommander 3
    console_command give_trait "Quintus Sertorius" GoodDefender 2
    console_command give_trait "Quintus Sertorius" Brave 1
    console_command give_trait "Quintus Sertorius" PublicFaith 1
    console_command give_trait "Quintus Sertorius" HaleAndHearty 2
    
    console_command create_unit Valencia "roman praetorian cohort urban i" 5,4
    console_command create_unit Valencia "roman light infantry auxillia" 2,2
    console_command create_unit Valencia "roman archer auxillia" 2,2
    console_command create_unit Valencia "roman infantry auxillia" 2,4
    end_if
    
    if I SettlementOwner Tarraco != romans_julii
    console_command control romans_scipii
    console_command capture_settlement Tarraco
    console_command control romans_julii
    
    console_command create_unit Tarraco "roman praetorian cohort urban i" 5,4
    console_command create_unit Tarraco "roman light infantry auxillia" 2,2
    console_command create_unit Tarraco "roman archer auxillia" 2,2
    console_command create_unit Tarraco "roman infantry auxillia" 2,4
    end_if
    
    if I SettlementOwner Carthago_Novo != romans_julii
    console_command control romans_scipii
    console_command capture_settlement Carthago_Novo
    console_command control romans_julii
    
    console_command create_unit Carthago_Novo "roman praetorian cohort urban i" 5,4
    console_command create_unit Carthago_Novo "roman light infantry auxillia" 2,2
    console_command create_unit Carthago_Novo "roman archer auxillia" 2,2
    console_command create_unit Carthago_Novo "roman infantry auxillia" 2,4
    end_if
    
    end_monitor
    so... what happens is that the spawned general (quintus sertorius) somehow spawns twice in the same turn, so there ends up two almost-identical stacks, except the second one gets none of the traits and ancillaries, since the console command lines only recognizes and affects the first one spawned.

    anyone know what i did wrong?

    3) i'd also like to randomize the event some more, so that it won't occur in a fixed date/turn, but that once it occurs, it won't happen again.

    taking a hint from EB's script for the epeiros alliance (see the relevant section in their script, EBBS_SCRIPT.TXT), it seems that they use the presence of a script-constructed building (via "console_command create_building...") as a check for whether the event has or hasn't already occured. for this purpose (and others) they seem to have created an entirely new class of hinterland-type (ie, indesctructible, like farms and roads) buildings for the mod. seeing as i wanted to avoid that level of additional modding, i decided to just use some of the other temples which the romans can't, and have it be generated in the senate capital (Roma) if/when the event occurs.

    however, since it is a religious building, i also added a monitor_event to first make sure rome has already built its native temple (leadership, ie., jupiter) by the turn before the timeframe of the scripted event, otherwise the presence of the other generated temple would prevent the player (AI or human) from ever building/upgrading it unless they first destroy the script-generated temple, which was used as a placeholder to indicate whether or not a certain scipted event had already occured.

    the problem is, this monitor_event (second one below) seems to create something like 15+ identical jupiter shrines in Roma within that one turn.

    (i forget why i chose it to occur during macedon's turn, but i think i remember that it didn't seem to trigger at all when i put "FactionTurnStart slave".)

    i didn't want to try other buildings like taverns, caravans, etc, since that would also involve dealing with trait and ancillary triggers associated with them. although if i can't solve this "building-spamming" problem in my current attempt, i may resort to that after all.

    Code:
    declare_counter Eunus
    
    monitor_event FactionTurnStart macedon
    and SettlementBuildingExists Roma = temple_of_battle_shrine
    set_counter Eunus 2
    end_monitor
    
    
    monitor_event FactionTurnStart macedon
    and I_LocalFaction romans_julii
    and I_TurnNumber = 140
    and not SettlementBuildingExists Roma >= temple_of_leadership_shrine
    
    console_command create_building Roma temple_of_leadership_shrine
    
    end_monitor
    
    
    monitor_event FactionTurnStart FactionType slave
    and I_LocalFaction romans_julii
    and I_CompareCounter Eunus != 2
    and I_NumberOfSettlements romans_julii > 20
    and I_SettlementOwner Taras = romans_julii
    and I_SettlementOwner Messana = romans_julii
    and I_SettlementOwner Syracusa = romans_julii
    and I_SettlementOwner Lilybeon = romans_julii
    and I_SettlementOwner Carali = romans_julii
    and I_SettlementOwner Patavium = romans_julii
    and I_SettlementOwner Mediolanum = romans_julii
    and I_TurnNumber > 140
    and I_TurnNumber < 240
    and RandomPercent < 10
    
    spawn_army
    faction slave
    character Eunus, named character, age 35, x 180, y 112    
    unit        generic rebel general                exp 5 armour 3 weapon_lvl 0
    unit        merc cilician pirate                exp 3 armour 2 weapon_lvl 0
    unit        merc cilician pirate                exp 3 armour 2 weapon_lvl 0
    unit        merc balearic slingers                exp 0 armour 0 weapon_lvl 0
    unit        merc balearic slingers                exp 0 armour 0 weapon_lvl 0
    unit        merc peltast                    exp 0 armour 0 weapon_lvl 0
    unit        merc peltast                    exp 0 armour 0 weapon_lvl 0
    unit        carthaginian archer                exp 0 armour 1 weapon_lvl 0
    unit        greek hoplite militia                exp 2 armour 0 weapon_lvl 0
    unit        greek hoplite militia                exp 2 armour 0 weapon_lvl 0
    unit        greek hoplite militia                exp 2 armour 0 weapon_lvl 0
    unit        greek hoplite militia                exp 2 armour 0 weapon_lvl 0
    unit        carthaginian infantry                exp 1 armour 0 weapon_lvl 0
    unit        carthaginian infantry                exp 1 armour 0 weapon_lvl 0
    unit        carthaginian peasant                exp 1 armour 1 weapon_lvl 0
    unit        carthaginian peasant                exp 1 armour 1 weapon_lvl 0
    unit        greek peasant                    exp 1 armour 1 weapon_lvl 0
    unit        greek peasant                    exp 1 armour 1 weapon_lvl 0
    unit        greek medium cavalry                exp 1 armour 1 weapon_lvl 0
    unit        merc samnite                    exp 0 armour 0 weapon_lvl 0
    
    console_command give_ancillary Eunus chirugeon
    console_command give_ancillary Eunus historian
    console_command give_ancillary Eunus orator
    console_command give_trait Eunus GoodCommander 2
    console_command give_trait Eunus GoodDefender 1
    console_command give_trait Eunus HatesRomans 1
    console_command give_trait Eunus Brave 1
    console_command give_trait Eunus PublicFaith 1
    console_command give_trait Eunus HaleAndHearty 1
    
    console_command create_building Roma temple_of_battle_shrine
    
    end_monitor
    so... advice and help, anyone? many thanks.


    Umm... Spartacus is already a name in the game so...

  8. #8
    Ducenarius
    Join Date
    Nov 2004
    Location
    MA
    Posts
    929

    Default Re: problems with a script

    Quote Originally Posted by Roman Clone View Post
    Umm... Spartacus is already a name in the game so...
    my problem wasn't with spartacus' name, but eunus'

    anyway, i solved the problem. when using notepad, some of the files don't seem to like me typing in "tab" on my own. i had to cut-and-paste those from other entries within the same file.

Posting Permissions

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