PDA

View Full Version : What's different in these two scripts?



Monkwarrior
06-17-2006, 07:24
This is a question for the expert scripters, because I'm unable to find the difference between one working script and one not-working.:help:

First case:
Human player: romans_julii
Objective: simulate the conquest of Saguntum by the carthaginians.
Piece of script:

monitor_event FactionTurnStart FactionType carthage
and I_TurnNumber = 0

console_command control carthage
console_command capture_settlement Saguntum
console_command create_unit Saguntum "carthaginian heavy infantry2" 1
console_command create_unit Saguntum "carthaginian medium cavalry2" 1
console_command create_unit Saguntum "auxiliar ibero" 3
console_command create_unit Saguntum "hondero aux ibero" 2
console_command control romans_julii

terminate_monitor
end_monitor

Result: in the IA turn for carthage, Saguntum rebel garrison is evicted, the settlement is then carthaginian and the units are created. Success!

Second case:
Human player: carthage
Objective: simulate a rebellion in Syracusae. The owners (romans) should be evicted and the city will be greek.
Piece of script:

monitor_event FactionTurnStart FactionType greek_cities
and I_TurnNumber = 0

console_command control greek_cities
console_command capture_settlement Siracusa
console_command create_unit Siracusa "syracusan hoplite" 1
console_command create_unit Siracusa "greek hoplite elite" 2
console_command create_unit Siracusa "greek hoplite" 3
console_command create_unit Siracusa "greek archer" 2
console_command create_unit Siracusa "thorakitai" 2
console_command create_unit Siracusa "ekdromoi" 3
console_command create_unit Siracusa "greek heavy peltast" 2
console_command control carthage
console_command diplomatic_stance greek_cities romans_julii war
console_command diplomatic_stance greek_cities romans_scipii war
set_counter rebelion 12

terminate_monitor
end_monitor

Result: garrison evicted, units created, but the settlement passes to the human player instead of the greeks. I tried also to put some waiting time after console_command control, but the result was the same.

Any idea?

Edit: I didn't remember another positive case. It is in the same campaign as the first case (human playing as romans_julii). Hannibal arrives to Italy and conquest one settlement (to give him one operations base).

monitor_event FactionTurnStart FactionType carthage
and I_TurnNumber = 8

console_command control carthage
console_command capture_settlement Segesta
console_command create_unit Segesta "infanteria gala" 3
console_command create_unit Segesta "caballeria gala" 2
console_command create_unit Segesta "peltasta aux italico" 3
console_command create_unit Segesta "auxiliar italico" 3
console_command create_unit Segesta "cab auxiliar italica" 2
console_command create_unit Segesta "merc samnite" 2
console_command control romans_julii

terminate_monitor
end_monitor

This piece of script also works properly.

Epistolary Richard
06-17-2006, 09:25
Where are the two factions in the turn order? Is greek_cities closer to the beginning than carthage? I'm trying to remember, but I think there was some kind of issue with the faction order when I was making BI All Factions... :thinking:

Monkwarrior
06-17-2006, 11:08
Where are the two factions in the turn order? Is greek_cities closer to the beginning than carthage? I'm trying to remember, but I think there was some kind of issue with the faction order when I was making BI All Factions... :thinking:
Yes, during this time I've been doing tests and it seems that the console_command control always (and only) changes the control to the following faction in descr_strat, except in the case of romans, that are the first factions irrespective of their position in that file.:dizzy2:

That means that this system can only be used for one faction in each campaign, and in case the romans are played by the AI, they will be the only faction possible.:shame:

Myrddraal
06-17-2006, 12:55
This is how the control command works: (passing control from A to B)

It plays the rest of whatever turn it is in as the AI, ends the turn, plays the factions turns between faction A through to faction B, then passes control.

The way around this, as I see you've done, is to call the command on the turn of the faction you want it to change to. If you do this it shouldn't matter in your case what the faction order is.


Here is something else to consider, is greek_cities playable? I'm not sure if that makes a difference but it's worth trying.

Monkwarrior
06-17-2006, 14:33
This is how the control command works: (passing control from A to B)

It plays the rest of whatever turn it is in as the AI, ends the turn, plays the factions turns between faction A through to faction B, then passes control.

The way around this, as I see you've done, is to call the command on the turn of the faction you want it to change to. If you do this it shouldn't matter in your case what the faction order is.


Here is something else to consider, is greek_cities playable? I'm not sure if that makes a difference but it's worth trying.
greek_cities is not playable, but carthage wasn't either. I think this is not the point.

In the case of greek_cities, it seems that the command control is not working, but the other lines are (capture_settlement and create_unit).

If I have time, I'll try with other factions, just to see which ones allow this type of script.