you might want to go with Mak's method if you do end up using one, I'm tempting to change my script as well, it causes of lot of "sally out" scenarios ... a bit more than I actually like ...
G
you might want to go with Mak's method if you do end up using one, I'm tempting to change my script as well, it causes of lot of "sally out" scenarios ... a bit more than I actually like ...
G
Thanks Bardo![]()
I did in the end use some events with the ScrollOpened seige_scroll event as well (though with terminate_monitor), and some done the way it works in LotR so you get garrison when siege lasts over turn, just to vary things for some cities to make result not as predictable for end user.
If anyone's trying to use anything similar for M2TW its worth noting that, thankfully that does have an I_SettlementBesieged type condition (you'll need to check syntax) which removes the need for all the army placement checks. The little darlings also corrected the spelling of seige_scroll to siege_scroll, which was nice of them, but got me in trouble with friend who I gave text of RTW version to as an example, he figured out why it wasn't working after about 3 hours testing.![]()
Not used mods before? Looking for something small and fun?!Download the:
*bumps old thread* - am still trying to sort out possible script induced CTD mentioned in other thread.... in effort to try and simplify things I wondered
should everything that works as an
and....
condition work as an
if ....
end_if
condition?
have got
and SettlementBuildingExists > militia_barracks
which works and detects building present or not correctly but stops event firing if put as
if SettlementBuildingExists > militia_barracks
...
end_if
does that show that there is something dodgy about it? Or are there types of things you can't use in 'if'
EDIT: that also only seems to work if its outside an 'if' as part of basic conditions for event and not as an 'and' inside an if clause. Using SettlementBuildingExists with = has exactly same problem.
Last edited by Makanyane; 12-18-2007 at 20:33.
Not used mods before? Looking for something small and fun?!Download the:
In an other scripting-language you'd be absolutelly correct, though in this game as you noticed it doesnt work that way ..
Rome's scripting-engine doesnt work with variables, so everything that needs a "reference" needs to be in some sort of "export of data" that contains both refrence as any data that you want available to you, or at least the coders once wanted available ..
In the case of the condition "SettlementBuildingExists" you need the refrence [settlement] and get an "export of data" that is linked to/contains the settlement, the building data, and anything else you have available on the settlement, to get this "export of data" you connect the [setlement] to a command to get the export, in this case likelly the "SettlementTurnStart/End" events.
G
I'd realised a while ago about needing the export from SettlementTurnEnd (had temporarily forgotten - been round in so many circles)
but same thing applies to that so if its
it worksCode:monitor_event SettlementTurnEnd SettlementName Rajah and I_CompareCounter Rajah = 1 and GarrisonSettlementRatio < 0.8 and not SettlementBuildingExists > militia_barracks if I_SettlementOwner Rajah = vandals and I_FactionBesieged vandals set_counter Rajah 2 console_command add_money vandals, 1000 console_command create_unit Rajah "semin" 1 terminate_monitor end_if end_monitor
with building check moved inside 'if' doesn't work - so 'if' statement breaks link to the returned information from the event????Code:monitor_event SettlementTurnEnd SettlementName Rajah and I_CompareCounter Rajah = 1 and GarrisonSettlementRatio < 0.8 if I_SettlementOwner Rajah = vandals and not SettlementBuildingExists > militia_barracks and I_FactionBesieged vandals set_counter Rajah 2 console_command add_money vandals, 1000 console_command create_unit Rajah "semin" 1 terminate_monitor end_if end_monitor
if that is general principle it might help explain other problems, as I've probably got ifs checking a lot more that they are meant to be, I was trying to reduce monitors by having more things as ifs inside, might not be the way to go!
Not used mods before? Looking for something small and fun?!Download the:
Yes. The information returned by the event is only used by the conditions of the event (the main condition plus the additional "and" lines).'if' statement breaks link to the returned information from the event?
With "if" statments you can only use conditions that starts by "I_", because they do not need any reference.
I agree it seems you win some efficiency in the scripts when you reduce the monitor conditions by using "ifs" instead, because the "if" is only checked when all the other conditions are true.
However, I guess that the conditions of the monitor are also checked in order, I mean that the 2nd condition should not be checked if the first is already false (this is how they usually work in other programing languages). If this is true, I suggest to place the conditions that are easy to check first, and conditions harder to be checked at the bottom. Although I have not verified it.
Not quite, most programing/scripting language make a choice about they want their language to "shortcut" and/or connectors by default, which only evaluate extra conditions if required.
Take VB for example it doesn't use shortcut connectors if you use a simple OR between condition, you need to use ORELSE in order for it to shortcut the condition after it. Meanwhile c/c++ users are typically taught to use the shortcut && and || by default. So really it may or may not be impelemented as a shortcut connector and unless you check you really don't know.
Bookmarks