Page 1 of 2 12 LastLast
Results 1 to 20 of 37

Thread: agent attribute type

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default agent attribute type

    How can I refer to agent level in scripting?

    if Attribute subterfuge = 6

    'Subterfuge' doesn't work so what do I call it instead?

  2. #2

    Default Re: agent attribute type

    Entry from the docudemons:
    ---------------------------------------------------
    Identifier: Attribute
    Trigger requirements: character_record
    Parameters: attribute description, logic token, level
    Sample use: Attribute Management >= 2
    Description: Test a character's attributes or hidden attributes
    Battle or Strat: Either
    Class: CHARACTER_ATTRIBUTE_TEST
    Implemented: Yes
    Author: Lee
    ---------------------------------------------------
    As you can see in the excerpt, Attribute requires a character record to be exported by the current event and is not an independent condition. (A condition that begins with an I_ prefix, generally.) Only independent conditions can be used in if statements. This is the correct usage:

    Code:
    monitor_event CharacterTurnEnd AgentType spy
    and Attribute Subterfuge = 6
      ;do something here
    end_monitor

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

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

    Default Re: agent attribute type

    Thankyou very much that was very informative +rep

    edit:

    Would something like this work?

    Code:
    monitor_event CharacterTurnEnd AgentType spy FactionIsLocal
    	and SpyMission
    	and TargetFactionType england
    	and Attribute Subterfuge = 6
    	and ProbabilitySuccess < 5
    	inc_counter england_points 5
    end_monitor
    I want it to check the agent level and mission difficulty when a spy has a successful mission against a specific faction. This is so that I can have increased gains for more dangerous missions.

    I get the feeling there is a lot I am missing about this scripting stuff and I know of no tutorials or guides. If you could show me how you would implement this idea I would be very grateful.
    Last edited by Taiji; August 18, 2009 at 11:44 AM.

  4. #4

    Default Re: agent attribute type

    No problem Taiji. I like to help new scripters.

    Your code has a few errors in it. Firstly, you forgot to put an "and" before the FactionIsLocal condition. Only one condition can go on the first line. The rest must come on sucessive lines with "and" in front of them. (You probably already knew that. I'm guessing this was just a typo.)

    Also, don't forget to declare counters before you use them. You can sometimes get away with using event counters (as opposed to normal counters) without declaring them, but it is still best to declare them in descr_events.txt just in case.

    You also seem to be using the wrong event for your situation. You don't want to test this monitor each time the turn ends, only when a spy has a successful mission. A better event to use would be MissionFinished. To ensure that the mission was a success, you would also have to use the condition MissionSuccessLevel.

    TargetFactionType is also incorrect. TargetFaction conditions apply to the faction that is at the receiving end of the event, but a faction cannot "receive" a CharacterEndTurn event. A good example of a receivable event would be CitySacked, in which one faction does the sacking and one is target of the sacking. The faction doing the sacking would be represented by FactionType and the fation that is the victim of the sacking would be represented by TargetFactionType. You can also use TargotFactionType with the MissionFinished event since every mission is performed by one faction and directed at another.

    Like TargetFactionType, ProbabilitySuccess soesn't owkr with CharacterTurnEnd, but it does work with MissionFinished.

    Cleaned up code:
    Code:
    declare_counter england_points
     
    monitor_event MissionFinished AgentType spy
    and MissionSuccessLevel > slightly_successful
    and FactionIsLocal
    and SpyMission
    and TargetFactionType england
    and Attribute Subterfuge = 6
    and ProbabilitySuccess < 5
      inc_counter england_points 5
    end_monitor
    There are a couple of good places to learn the basics of scripting. I would start with alpaca's Script-O-Rama. You should also download a copy of the Kingdoms Docudemons, which is the CA released index of all scripting commands, events, and conditions. there is also a Scripting class in progress in the TWC University forums. They're already a few weeks into the course, but they would probably let you start anyway. There isn't too much material about more advanced scripting, though. I think the best way to learn is to read through some of the specialized tutorial threads out there, scan through the codes for some mods, and also to experiment for yourself. I learned most of what I know through experimenting and discovered a couple of scripting tricks that were completely new to the TWC community in the process.
    Last edited by Azim; August 18, 2009 at 03:21 PM.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

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

    Default Re: agent attribute type

    Azim, you've helped me a great deal there, thankyou very much.

    I know virtually nothing about what I am doing and so your example and advice is very valuable and very much appreciated.

    I'll look into the info you've suggested and think some more on this, thanks again!

  6. #6

    Default Re: agent attribute type

    I believe the limit of subterfuge is 5 for a trait or event thing, not sure thoug, so if it doesn't work, that will probably be why.

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

    Default Re: agent attribute type

    So it goes 1 - 5 instead of 1 - 10? Interesting, it must round odds up to evens then I suppose. Thanks for that, Mork

  8. #8

    Default Re: agent attribute type

    no you can give him 10, I think, but you would have to make 2 scripts each giving him 5, I think it can be done that way, not sure though.

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

    Default Re: agent attribute type

    Oh I see what you mean, in the script it's just checking the level of the agent it's not adding anything. But thanks anyway

    edit:

    If anyone is interested, I've had more awesome advice and the state of the monitor/script is now:

    Code:
    	monitor_event MissionFinished AgentType spy
    		and FactionIsLocal
    		and SpyMission
    		and TargetFactionType england
    		and MissionSuccessLevel > partly_successful
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 4
    		and ProbabilitySuccess =< 15
    		and ProbabilitySuccess > 5
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 4
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 5
    		and ProbabilitySuccess =< 15
    		and ProbabilitySuccess > 5
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 5
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 6
    		and ProbabilitySuccess =< 25
    		and ProbabilitySuccess > 15
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 6
    		and ProbabilitySuccess =< 15
    		and ProbabilitySuccess > 5
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 6
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 3
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 7
    		and ProbabilitySuccess =< 25
    		and ProbabilitySuccess > 15
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 7
    		and ProbabilitySuccess =< 15
    		and ProbabilitySuccess > 5
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 7
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 3
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 8
    		and ProbabilitySuccess =< 30
    		and ProbabilitySuccess > 20
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 8
    		and ProbabilitySuccess =< 20
    		and ProbabilitySuccess > 10
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 8
    		and ProbabilitySuccess =< 10
    		and ProbabilitySuccess > 5
    		inc_counter england_points 3
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 8
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 4
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 9
    		and ProbabilitySuccess =< 30
    		and ProbabilitySuccess > 20
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 9
    		and ProbabilitySuccess =< 20
    		and ProbabilitySuccess > 10
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 9
    		and ProbabilitySuccess =< 10
    		and ProbabilitySuccess > 5
    		inc_counter england_points 3
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 9
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 4
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 35
    		and ProbabilitySuccess > 25
    		inc_counter england_points 1
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 25
    		and ProbabilitySuccess > 15
    		inc_counter england_points 2
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 15
    		and ProbabilitySuccess > 10
    		inc_counter england_points 3
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 10
    		and ProbabilitySuccess > 5
    		inc_counter england_points 4
    		end_if
    		if I_EventCounter research_accepted = 1
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 5
    		end_if
    	end_monitor
    As you can see it awards more 'england_points' for higher level spies on more dangerous missions... I'm very happy

    It's part of a system to make researching another faction's units possible... but it seems a nice way to trigger a new trait line for spys succesful on dangerous missions perhaps...
    Last edited by Taiji; August 19, 2009 at 10:42 AM.

  10. #10
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: agent attribute type

    I would simplify the script just to see that it works, and if so, continually add the subsequent If segments one by one.

    Good luck with the interesting script!


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

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

    Default Re: agent attribute type

    Thankyou Mr SignifierOne sir! (to whom I owe my easy entry into the wonderful world of animation tweaking, and for which I still have very much gratitude)

    I do tend to get carried away once I think I see what needs doing, but you are right and I should test small chunks first!

    It certainly doesn't cause any error in launching a campaign but I need to establish that it is working properly.

    You're right and I will do as you suggest, thankyou

    edit: Through testing I discover that it doesn't work... I will try a load of stuff

    edit:

    I did try a load of stuff and found that I get stuck here:

    Code:
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge = 2
    		and ProbabilitySuccess =< 95
    		and ProbabilitySuccess > 5
    		inc_counter england_points 4
    	end_monitor
    That works but I cannot see a way to put an 'if' statement in there. Every line down to 'and ProbabilitySuccess > 5' will not accept another event being between it and SpyMission. Conditions only. I think I tried an if statement a couple of times on these conditions to no avail... I'll try again to make sure...
    Last edited by Taiji; August 19, 2009 at 08:17 PM.

  12. #12
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: agent attribute type

    You can't run any of those in if statements, but I'd consider ways to reduce the need to specify faction or subterfuge level. If you did it for every target and every subterfuge and furthermore a large # of success probabilities, it would be a massive script for a relatively minor purpose I'd say.

    What are the points intended to do exactly?

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

    Default Re: agent attribute type

    OK, this is part of a script that provides the player with a method of researching another faction's technology (units). So I have a counter per faction and different ways to raise points. Eventually the counters fire an event which is used to enable production of new units.

    This part is a chunk of the espionage side of things. I want increasingly hard spy missions to give increasingly great rewards. So it has to track agent level, diffculty and faction.

    Agent level needs tracking from 4 onwards and I'm happy with chunks like 4-5, 6-7, 8-9, 10. Added to that 'difficulty' needs tracking, to enable a greater spread of reward for higher level agents on more difficult missions. So where I may be happy with 2 difficulty leves at level 4-5, I want 5 at level 10. Or roughly '4-5(2), 6-7(3), 8-9(4) and 10(5)' where the number in brackets denotes spread of difficulty.

    It then needs duplicating for each of the 30 factions. Maybe my maths is off but that looks like 420 monitors if I can't find a better way to organise things. I hear event monitors don't impact performance like condition monitors but I'm concerned with this many. Will it actually be a problem?

    But if it's just a problem of increased work for me... I don't mind

    edit:

    I can do something less detailed like 4-6(1), 7-9(2) and 10(3), I suppose (180 monitors...). I could also reduce the amount of factions for which research will be available... but that would be sad

    edit:

    Another thing I could do with some help on is this:
    Code:
    	monitor_event PreFactionTurnStart FactionIsLocal
    		and DiplomaticStanceFromFaction england atwar
    		inc_counter england_points 1
    	end_monitor
    It's supposed to give points for being at war with england but instead it just gives points regardless. Plus it does the same dumb thing when an alliance should be the trigger. It's as if the line 'and DiplomaticStanceFromFaction england atwar' is ignored and I can't see why.

    Code:
    	monitor_event PreFactionTurnStart DiplomaticStanceFromFaction england atwar 
    		and FactionIsLocal
    		inc_counter england_points 1
    	end_monitor
    Perhaps it was silly but I tried that way round also, to no avail - it still gives points and apparently ignores the diplomatic stance.

    PS. this part of the script should (eventually) also vary the amount of points based on another factor: factionstanding. Ideally the player wants an alliance and good relations with the target of their research, a gameplay factor which is then offset by a desire to carry out spy missions that get you into trouble with the faction. This then leads to war being the next logical research step.

    Then in war we can have some different mechanics, killing generals with different levels of 'important documents' ancillaries to yeild different research gains. Fighting enemies in the players own land yielding better results. Winning the battle helps of course. Executing prisoners implies a willingness to torture in order to extract more research points... etc. etc.

    I can see it's feasible to drop the whole spying side of things or simplify it to great degree, there is still much left that is able to provide the general mechanics I want.
    Last edited by Taiji; August 20, 2009 at 08:16 AM.

  14. #14

    Default Re: agent attribute type

    How are you checking the points in that last bit? log_counter? It might be an error in your logging code that is causing the strange output.

    Dominion of the Sword, a Medieval II: Total War Supermod
    Under the patronage of Archaon. Proud member of the House of Siblesz
    My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!

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

    Default Re: agent attribute type

    I'm not sure I understand the question but I see lines in my log like this:

    13:16:18.468 [game.script.exec] [trace] exec <inc_counter> at line 54386 in mods/DLV_ext/data/world/maps/campaign/imperial_campaign/campaign_script.txt
    13:16:18.468 [game.script.counter] [trace] counter <england_points> = 1

    And that tells me what's giving me the points.

    edit:

    I would be happy to use this if the amount of monitors is not likely to be a problem (bearing in mind it's this x30 with all factions included).
    Code:
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 4
    		and Attribute Subterfuge < 6
    		and ProbabilitySuccess =< 40
    		and ProbabilitySuccess > 20
    		inc_counter england_points 1
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 4
    		and Attribute Subterfuge < 6
    		and ProbabilitySuccess =< 20
    		inc_counter england_points 2
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 6
    		and Attribute Subterfuge < 8
    		and ProbabilitySuccess =< 40
    		and ProbabilitySuccess > 20
    		inc_counter england_points 1
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 6
    		and Attribute Subterfuge < 8
    		and ProbabilitySuccess =< 20
    		and ProbabilitySuccess > 10
    		inc_counter england_points 2
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 6
    		and Attribute Subterfuge < 8
    		and ProbabilitySuccess =< 10
    		inc_counter england_points 3
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 8
    		and Attribute Subterfuge < 10
    		and ProbabilitySuccess =< 40
    		and ProbabilitySuccess > 25
    		inc_counter england_points 1
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 8
    		and Attribute Subterfuge < 10
    		and ProbabilitySuccess =< 25
    		and ProbabilitySuccess > 10
    		inc_counter england_points 2
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 8
    		and Attribute Subterfuge < 10
    		and ProbabilitySuccess =< 20
    		and ProbabilitySuccess > 15
    		inc_counter england_points 3
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 8
    		and Attribute Subterfuge < 10
    		and ProbabilitySuccess =< 5
    		inc_counter england_points 4
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 40
    		and ProbabilitySuccess > 30
    		inc_counter england_points 1
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 30
    		and ProbabilitySuccess > 20
    		inc_counter england_points 2
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 20
    		and ProbabilitySuccess > 10
    		inc_counter england_points 3
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge = 10
    		and ProbabilitySuccess =< 10
    		and ProbabilitySuccess > 5
    		inc_counter england_points 4
    	end_monitor
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		and Attribute Subterfuge => 10
    		and ProbabilitySuccess < 5
    		inc_counter england_points 5
    	end_monitor
    Can someone give me an indication of how many event_monitors I can comfortably get away with using?

    Like "you can use X amount of this kind of monitor without performance problems beyond a delay when a player's spy mission takes place".

    If a delay is the only problem then it's not one I care about. But if there are end-turn-time increase issues or a reduction in framerate on the strat map, then I have to pay attention.

    edit:

    Nope that doesn't even work.

    and ProbabilitySuccess =< 10

    That line isn't happy with =< which is not a problem.

    The problem is that this line:

    and Attribute Subterfuge < 10

    Will only accept '= n' and won't be happy with '<' or '>'

    So not only am I possibly unable to add things I want but the thing is getting bigger anyway! (420 is now 690!!!)

    edit:

    OK, so new tack (which spawns new questions...).

    I decide to vary not on agent level, etc. it was a nice idea, but to much code to check through to be as fun as 'my first scripting adventure' should be
    Code:
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and SettlementBuildingExists barracks
    		and FactionBuildingExists military_academy
    		inc_counter england_points 1
    	end_monitor
    In that bit of code I'm trying to specify that the spy should gain points by spying on a settlement with a certain building.

    I see that SpyMission exports a settlement and I wonder whether that means I do not need to specify one in order for SettlementBuildingExists to work.

    And then FactionBuildingExists should refer to the spy's faction but not the target.

    Is it just wishful scripting?
    Last edited by Taiji; August 20, 2009 at 05:01 PM.

  16. #16

    Icon1 Re: agent attribute type

    Code:
    declare_counter local_military_academy
    
    	monitor_event FactionTurnStart FactionIsLocal
    		and FactionBuildingExists >= military_academy
    		and I_CompareCounter local_military_academy = 0
    		set_counter local_military_academy 1
    	end_monitor
    
    	monitor_event FactionTurnStart FactionIsLocal
    		and not FactionBuildingExists >= military_academy 
    		and I_CompareCounter local_military_academy = 1
    		set_counter local_military_academy 0
    	end_monitor
    
    	monitor_event SpyMission FactionIsLocal
    		and MissionSuccessLevel >= slightly_successful
    		and SettlementBuildingExists >= town_watch
    		and I_CompareCounter local_military_academy = 1
    		and TargetFactionType england
    		inc_counter england_points 1
    	end_monitor
    
    	monitor_event CharacterTurnEnd EndedInSettlement
    		and SettlementBuildingExists >= town_watch
    		and I_CompareCounter local_military_academy = 1
    		and AgentType = spy
    		and CharacterIsLocal
    		and InEnemyLands
    		inc_counter england_points 1
    	end_monitor

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

    Default Re: agent attribute type

    Very interesting and helpful TNZ! +Rep

    I particularly like this

    Code:
    	monitor_event CharacterTurnEnd EndedInSettlement
    		and SettlementBuildingExists >= town_watch
    		and I_CompareCounter local_military_academy = 1
    		and AgentType = spy
    		and CharacterIsLocal
    		and InEnemyLands
    		inc_counter england_points 1
    	end_monitor
    Where you are giving points for remaining in the settlement with the correct building, that's awesome. I'd need some way to stop a player from stacking spys in a settlement though, it would unbalance my mechanics...

    But anyway, thankyou! Very useful input!

    edit:

    For anyone that's interested in what happens with the if statement:

    I tried this to see if i_comparecounter might work where i_eventcounter failed:

    Code:
    	monitor_event PreFactionTurnStart FactionIsLocal
    		if I_EventCounter research_accepted = 1
    			set_counter research 1
    		end_if
    	end_monitor
    
    	monitor_event SpyMission FactionIsLocal
    		and TargetFactionType england
    		and MissionSucceeded
    		if I_CompareCounter research = 1
    			and Attribute Subterfuge = 2
    			and ProbabilitySuccess < 99
    				inc_counter england_points 5
    		end_if
    	end_monitor
    But it said this:

    16:27:52.906 [game.script] [error] Script execution error for <if>, at line 54384, in mods/DLV_ext/data/world/maps/campaign/imperial_campaign/campaign_script.txt:
    <character_record> is unavailable from event <>
    when testing <Attribute> condition

    So i_comparecounter makes no difference, same issue as i_eventcounter, with no report provided for attribute to work with....

    (the script works without the if statement and counter where it is, I can stick the counter before the inc_counter line no probs but with lost functionality)

    edit:

    I really hope someone can give me an idea of how many event_monitors I can get away with without causing problems!

    I might get carried away and set up 500 event_monitors, which would be a complete waste of time if someone knows it will fail... on the other hand it would be useful to find out if noone knows.

    edit:

    Also I would like to know why people are suggesting I use 'and MissionSuccessLevel >= slightly_successful' when 'and MissionSucceeded' works... I wonder what I am missing here.

    edit:

    I've had a chance to test TNZ's script now and it works very well - thanks again!

    edit:

    This is where I'm up to at the moment..

    Code:
    ;enabling spying bonuses accrued through building a mil acadamey
    	monitor_event FactionTurnStart FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and FactionBuildingExists >= town_watch
    		and I_CompareCounter local_military_academy = 0
    		set_counter local_military_academy 1
    	end_monitor
    
    	monitor_event FactionTurnStart FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and not FactionBuildingExists >= town_watch
    		and I_CompareCounter local_military_academy = 1
    		set_counter local_military_academy 0
    	end_monitor
    
    ;enabling spying bonuses accrued through building a thieves_guild
    	monitor_event FactionTurnStart FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and FactionBuildingExists >= thieves_guild
    		and I_CompareCounter local_thieves = 1
    		set_counter local_thieves 1
    	end_monitor
    
    	monitor_event FactionTurnStart FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and not FactionBuildingExists >= thieves_guild
    		and I_CompareCounter local_thieves = 0
    		set_counter local_thieves 0
    	end_monitor
    	
    ;spy mission to enter a settlement with the correct building or better
    	monitor_event SpyMission FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and MissionSucceeded
    		and SettlementBuildingExists >= mustering_hall
    		and TargetFactionType england
    		if I_CompareCounter local_thieves = 1
    			inc_counter england_points 4
    		end_if
    		if I_CompareCounter local_thieves = 0
    			inc_counter england_points 2
    		end_if
    	end_monitor
    
    ;spying on a settlement with correct building - DOES NOT WORK needs target faction
    	monitor_event CharacterTurnEnd EndedInSettlement
    		and I_EventCounter research_accepted = 1
    		and SettlementBuildingExists >= town_watch
    		and AgentType = spy
    		and CharacterIsLocal
    		and InEnemyLands
    		if I_CompareCounter local_thieves = 1
    			inc_counter england_points 2
    		end_if
    		if I_CompareCounter local_thieves = 0
    			inc_counter england_points 1
    		end_if
    	end_monitor
    	
    ;capturing a settlement of with correct building or better
    	monitor_event GeneralCaptureSettlement FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and TargetFactionType england
    		and SettlementBuildingExists >= town_watch
    		if I_CompareCounter local_military_academy = 1
    			inc_counter england_points 15
    		end_if
    		if I_CompareCounter local_military_academy = 0
    			inc_counter england_points 10
    		end_if
    	end_monitor
    	
    ;attacking an AI general
    	monitor_event GeneralAssaultsGeneral FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and TargetFactionType england
    		and MissionSucceeded
    		if I_CompareCounter local_military_academy = 1
    			inc_counter england_points 5
    		end_if
    		if I_CompareCounter local_military_academy = 0
    			inc_counter england_points 2
    		end_if
    	end_monitor
    
    ;making a trade agreement
    	monitor_event FactionTradeAgreementMade FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and TargetFactionType england
    		if I_CompareCounter local_thieves = 1
    			inc_counter england_points 3
    		end_if
    		if I_CompareCounter local_thieves = 0
    			inc_counter england_points 1
    		end_if
    		inc_counter england_points 3
    	end_monitor
    
    ;initial declaration of an alliance
    	monitor_event FactionAllianceDeclared FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and TargetFactionType england
    		inc_counter england_points 10
    	end_monitor
    
    ;breaking the alliance more than nullifying the making
    	monitor_event FactionBreakAlliance FactionIsLocal 
    		and I_EventCounter research_accepted = 1
    		and TargetFactionType england
    		inc_counter england_points -15
    	end_monitor
    	
    ;an alliance with good standing	
    	monitor_event FactionTurnStart FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		and DiplomaticStanceFromFaction england > AtWar
    		and FactionStanding > -0.9
    		inc_counter england_points 1
    	end_monitor
    
    ;firing the events needed for recruitment of researched units in the EDB
    	monitor_event PreFactionTurnStart FactionIsLocal
    		and I_EventCounter research_accepted = 1
    		if I_CompareCounter england_points >= 3
    			and I_EventCounter england_level_1 = 0
    			historic_event england_level_1
    		end_if
    		if I_CompareCounter england_points >= 200
    			and I_EventCounter england_level_2 = 0
    			historic_event england_level_2
    		end_if
    	end_monitor
    Balancing the exact values, etc. still needs doing but this
    ;spying on a settlement with correct building - DOES NOT WORK needs target faction
    script, that TNZ has suggested (and that I really like), requires a way to specify the owner of the settlement. I can't be giving england_points for doing it in a french settlement, for example.

    Nothing I have tried has worked, any ideas?

    Oh, and is it a known fact that reports, target factions, etc. can't be moved through IF statements in general or is it just a special case I'm experiencing?
    Last edited by Taiji; August 21, 2009 at 05:31 PM.

  18. #18

    Icon1 Re: agent attribute type

    Taiji: I don’t believe there is a limit to the number of event_monitors you can use. I think it’s more how many event_monitors you can use before it starts to effect the game’s performance.

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

    Default Re: agent attribute type

    Quote Originally Posted by TNZ View Post
    Taiji: I don’t believe there is a limit to the number of event_monitors you can use. I think it’s more how many event_monitors you can use before it starts to effect the game’s performance.
    Yes! That's exactly what I'm asking; how many can I have before it affects performance?

    I do wonder if it's even possible to get a definite answer on that, since which events are being monitored and which conditions checked probably affects the performance impact. But if anyone has ever had a performance problem due to using a large amount of event monitors it might help me to know about it...

    I like the idea about having the building but I can't see how to get it working.

    I'd need to force the AI to build it, destroy it when another faction takes the settlement, etc.

    I'd need some new building trees/lines in EDB and I'm not sure there is space. EDB is still largely a mystery

    But I like the idea, thanks TNZ
    Last edited by Taiji; August 22, 2009 at 08:43 AM.

  20. #20

    Icon1 Re: agent attribute type

    Taiji: if all English settlements had a building unique to their faction, you could just do this:

    Code:
    	monitor_event CharacterTurnEnd EndedInSettlement
    		and SettlementBuildingExists >= uniquely_english
    		and SettlementBuildingExists >= town_watch
    		and I_CompareCounter local_military_academy = 1
    		and AgentType = spy
    		and CharacterIsLocal
    		and InEnemyLands
    		inc_counter england_points 1
    	end_monitor

Page 1 of 2 12 LastLast

Posting Permissions

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