PDA

View Full Version : problems with a script



tai4ji2x
06-20-2007, 07:51
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... :help:

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


{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...

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.



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.

Atilius
06-21-2007, 02:24
1), 1a) Try Eunus as a character name not a surname. I believe a character name is necessary, I know a surname is not.

2) I suspect your use of control [faction] is causing problems here. You should avoid doing it more than once in a turn. Probably would be best not to shift control from the romans_julii during the romans_julii turn.

3) This event monitor has serious problems:


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

You need FactionType between FactionTurnStart and macedon.

SettlementBuildingExists requires a settlement as a trigger; it does not accept a settlement as a parameter.

tai4ji2x
06-21-2007, 10:38
1), 1a) Try Eunus as a character name not a surname. I believe a character name is necessary, I know a surname is not.

i put Eunus under the "names" list for slave faction in descr_names.txt. slave faction has no surnames list. as for descr_names_lookup.txt and \data\text\names.txt, i couldn't find anything to distinguish surnames from given names, so i simply just added Eunus.



2) I suspect your use of control [faction] is causing problems here. You should avoid doing it more than once in a turn. Probably would be best not to shift control from the romans_julii during the romans_julii turn.


i thought i was doing it during the scipii turn?



SettlementBuildingExists requires a settlement as a trigger; it does not accept a settlement as a parameter.

so i'm guessing i'll need to use "monitor_event SettlementTurnStart SettlementName" ?

PS - oh, and i know there were some typos in my original post: "I_SettlementOwner" sometimes didn't have the underscore. and also, all the != 's ("and not's") should have been plain equal signs. i changed them to the opposite for testing and forgot to change them back when copy+pasting here

tai4ji2x
06-23-2007, 05:37
post-database-recovery bump :juggle2:

tai4ji2x
06-25-2007, 18:26
bump...

Atilius
06-26-2007, 07:21
What is it that you want? You say that your code isn't giving you the results you are looking for, but also that the code you've posted isn't the code you're running. It isn't clear to me that you necessarily found all the typos either. I'm at a loss to see how anyone can assist you.

tai4ji2x
06-26-2007, 15:11
What is it that you want? You say that your code isn't giving you the results you are looking for, but also that the code you've posted isn't the code you're running. It isn't clear to me that you necessarily found all the typos either. I'm at a loss to see how anyone can assist you.

1) well, i'm still wondering about what to do with the name issue - why can't i get a character named "Eunus" to spawn without problems.

1a) still confused about why chirugeons don't appear when given via script, yet can still be given manually via the console/shell.

2) ok, if you want to see, this is how i tested this part of the script for turn 0 (and yes, this time i believe i've caught the typos):

monitor_event FactionTurnStart FactionType romans_scipii
and I_LocalFaction romans_julii
and I_TurnNumber = 0


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" historian
console_command give_ancillary "Quintus Sertorius" orator
console_command give_ancillary "Quintus Sertorius" chirugeon
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

is there a reason why Quintus Sertorius' army is still spawning twice?

3) i figured this part out. thank you for pointing out to me the correct syntax for SettlementBuildingExists.

Monkwarrior
06-26-2007, 18:28
I would try two things for the problem of two spawning armies:

- Put a line with the word "end" just after the last unit of this army. I thought it was necessary.

- Finish the script with:
terminate_monitor
end_monitor

end_script

tai4ji2x
06-26-2007, 19:32
I would try two things for the problem of two spawning armies:

- Put a line with the word "end" just after the last unit of this army. I thought it was necessary.

- Finish the script with:
terminate_monitor
end_monitor

end_script

thanks, the addition of terminate_monitor was enough. :2thumbsup:

although i'm still having all the other problems i described in my previous post :sad:

tai4ji2x
06-26-2007, 21:32
whoops, it's not the chirugeon which is missing. it's whatever the first "give_ancillary" command gives which never appears (in this case, the historians). this problem is solved, as you suggested, by adding a line with "end" after the unit list of the spawned army. :2thumbsup:

tai4ji2x
06-26-2007, 21:45
ok... so now onto testing why i can't get a proper spawning of "Eunus"... :dizzy2:

EDIT - ok, nm i think i figured it out. with \data\text\names.txt, i need to make sure i use tabs to align the columns