
Originally Posted by
attyla
I'm back

As i said i have no problems with checking who is the local faction. I have problem with I_NumberOfSettlements.
log tells me now that "<character record> is unavailable from event <>" and it applies to line using I_NumberOfSettlements.
Aye it might, still the <character record> is an export of the "event_monitor" so the problem is definitly there. I think the reason that it the logs points you at the line with "I_NumberOfSettlements" is purely because it's directly after the incorrectly used conditions.
The actual line is not important, the text in the log is clearly saying their is a problem with the conditions you used in the if statement.
As Taiji pointed out ( and indeed I missed ) all the conditions in the "if" statement require this export ( not just the FactionIsLocal ).
this piece of script( courtesy of Taiji ) should work.
Code:
monitor_event CharacterTurnEnd FactionIsLocal
and FactionType byzantium
and CharacterIsLocal
and not EndedInSettlement
and not IsBesieging
and not AgentType = admiral
and not AgentType = spy
and not AgentType = diplomat
and not AgentType = assassin
and not AgentType = priest
and not AgentType = princess
and not AgentType = merchant
and InEnemyLands
if I_NumberOfSettlements byzantium <= 5
console_command add_money -100
end_if
if I_NumberOfSettlements byzantium <= 10
and I_NumberOfSettlements byzantium > 5
console_command add_money -200
end_if
if I_NumberOfSettlements byzantium <= 15
and I_NumberOfSettlements byzantium > 10
console_command add_money -300
end_if
if I_NumberOfSettlements byzantium <= 20
and I_NumberOfSettlements byzantium > 20
console_command add_money -400
end_if
if I_NumberOfSettlements byzantium > 25
console_command add_money -500
end_if
end_monitor
I'll try to explain why to clear this up:
From the docudemon "events"
Code:
Identifier: CharacterTurnEnd
Event: A Character has finished its turn
Exports: nc_character_record, character_record, faction, region_id, character_type, settlement
As you can see it has a number of "exports" listed, I highlighted the one of importance in this situation.
Now these exports limit the conditions I can use:
from docudemon "conditions"
Code:
Identifier: AgentType
Trigger requirements: character_record
Parameters: character type (spy, assassin, diplomat, admiral, general, named character, family)
Sample use: AgentType = diplomat
Description: Test to see if a character is of a particular type (spy, admiral, named character &c.)
Battle or Strat: Strat
Class: CHARACTER_TYPE_TEST
So this condition can only be used for monitors that export a character_record.
So
Code:
monitor_event CharacterTurnEnd AgentType = diplomat
...
end_monitor
would work
However "if statements" are different, they don't link to the "exports" of the monitor.
so
Code:
monitor_event CharacterTurnEnd TrueCondition
if AgentType = diplomat
.....
end_if
end_monitor
Won't work since the if statement doesn't have a "character_record" export. That's why only I_CompareCounter, I_NumberOfSettlements ( basically anything with an I_ before it ) can be used in if statements: because
from docudemon conditions:
Code:
Identifier: I_CharacterCanMove
Trigger requirements: No Requirements and so usuable in an if statement!!
Parameters: logic token, level
Sample use: I_CharacterCanMove Gaius Julius
Description: Can the named character move to any square? He may only be able to move in one direction, particularly the one he came from, so don't assume ability to move means he can move usefully.
Battle or Strat: Strat
This is why your script doessn't work ( and what the log is referring to) the only reason it points at the NumberOfSettlements is because it's the first line after a faulty condition ( log is weird like that I guess )
If you look at the script above you'll see that the "if" has been removed so that the conditions can link to the monitor.
Hope that makes sense. Either way the above script should work.