Results 1 to 20 of 21

Thread: I_NumberOfSettlements

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default I_NumberOfSettlements

    This is a script:
    PHP Code:
    monitor_event CharacterTurnEnd FactionIsLocal
        
    if FactionIsLocal byzantium

            
    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_if 
    And this is a log:
    PHP Code:
    15:41:22.875 [game.script] [errorScript execution error for <if>, at line 74in mods/oikoumene/data/world/maps/campaign/imperial_campaign/campaign_script.txt
    <
    factionis unavailable from event <>
    when testing <FactionIsLocalcondition 
    i suppose i cannot use I_NumberOfSettlements with. Has someone any idea how to get this problem around?

  2. #2

    Default Re: I_NumberOfSettlements

    Ugh, I thought I had the mistake, then I thought I hadn't and edited my post but I was correct the first time round lol. Me and my rash acts! Either way:

    it's not the "I_NumberOfSettlements" that one is correct.

    but the
    "FactionIsLocal = byzantium" as it needs an export of the monitor and can't be used in an "if" statement
    for use in an "if" statement either use
    "I_LocalFaction == byzantium" or "not I_FactionAIControlled byzantium"
    Last edited by ilmrik; November 23, 2011 at 10:11 AM.

  3. #3

    Default Re: I_NumberOfSettlements

    I have no problem with
    PHP Code:
    if FactionIsLocal byzantium 
    I have problem with
    PHP Code:
    if I_NumberOfSettlements byzantium <= 
    What do you think - may i use "while" loop instead "if"?

  4. #4

    Default Re: I_NumberOfSettlements

    As you suggested I changed
    PHP Code:
    if I_FactionIsLocal byzantium 
    to
    PHP Code:
    If I_LocalFaction == byzantium 
    but log says: "faction type not recognised".

  5. #5
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: I_NumberOfSettlements

    Quote Originally Posted by attyla View Post
    I have no problem with
    PHP Code:
    if FactionIsLocal byzantium 
    I have problem with
    PHP Code:
    if I_NumberOfSettlements byzantium <= 
    What do you think - may i use "while" loop instead "if"?
    You can't have FactionIsLocal in an if statement, as Ilmrik has quite rightly pointed out.

    edit:

    Quote Originally Posted by attyla View Post
    As you suggested I changed
    PHP Code:
    if I_FactionIsLocal byzantium 
    to
    PHP Code:
    If I_LocalFaction == byzantium 
    but log says: "faction type not recognised".

    == should be = with I_LocalFaction.
    Last edited by Taiji; November 23, 2011 at 11:30 AM.

  6. #6

    Default Re: I_NumberOfSettlements

    i replased "==" to "=". No changes. Log still informs that "faction type not recognised".

  7. #7

    Default Re: I_NumberOfSettlements

    My bad, it's without the "=" so maybe try that first.
    Code:
    If I_LocalFaction byzantium  
    If that still refuses to work try the
    Code:
    If not I_FactionAIControlled byzantium  
    I've used it several times and I never had any problems with it tbh. Maybe give the log entry again if this all fails. Since the one in the OP definetly refers to the "if FactionIsLocal" line.

    EDIT: Yes, it's a typo. Woops ^.^
    Last edited by ilmrik; November 23, 2011 at 12:17 PM.

  8. #8
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: I_NumberOfSettlements

    It's doing that for a reason... lol You'll work it out

  9. #9

  10. #10

    Default Re: I_NumberOfSettlements

    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.

  11. #11

    Default Re: I_NumberOfSettlements

    Quote Originally Posted by attyla View Post
    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.
    Last edited by ilmrik; November 23, 2011 at 02:23 PM.

  12. #12
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: I_NumberOfSettlements

    monitor_event CharacterTurnEnd FactionIsLocal
    and FactionType byzantium
    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

  13. #13

    Default Re: I_NumberOfSettlements

    So you say that line
    PHP Code:
    if I_NumberOfSettlements byzantium <= 
    is OK? But the log says that the problem is right there.

  14. #14
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: I_NumberOfSettlements

    I'm saying none of these:

    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

    Can be used in a if statement.

    Whether or not you can use 2 logic tokens (!=<>) with that condition logged is not something I know off the top of my head. Not worth thinking about until you fix the stuff before it though. Check it out.

    edit:

    To explain further, any condition that requires an export from an event cannot be used in an if statement.
    Last edited by Taiji; November 23, 2011 at 01:41 PM.

  15. #15

    Default Re: I_NumberOfSettlements

    I understand nothing from that.
    Perhaps another way: how to make high of charges depend on the size of the fraction? Could you give me an example?
    Last edited by attyla; November 23, 2011 at 02:03 PM.

  16. #16
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: I_NumberOfSettlements

    Quote Originally Posted by attyla View Post
    Perhaps another way: how to make high of charges depend on the size of the fraction? Could you give me an example?
    Size in terms of provinces? This should be fine:

    monitor_event SettlementTurnStart FactionIsLocal
    console_command add_money -20
    end_monitor

    It removes gold for each settlement the player holds.
    Last edited by Taiji; November 23, 2011 at 02:29 PM.

  17. #17
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: I_NumberOfSettlements

    console_command add_money -20

    Needs a faction to give money to

  18. #18
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: I_NumberOfSettlements

    No it doesn't, check it yourself.

  19. #19

    Default Re: I_NumberOfSettlements

    I hope I finally understood
    Great thanks! +rep

  20. #20
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: I_NumberOfSettlements

    Quote Originally Posted by Taiji View Post
    No it doesn't, check it yourself.
    Console command, yeah, that one gives always to the local faction. My fault!

Posting Permissions

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