Page 1 of 2 12 LastLast
Results 1 to 30 of 35

Thread: Invisible buildings?

  1. #1
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Invisible buildings?

    Well, I think I read something related to this in another thread, but I'm unable to find it.

    I was thinking in the possibility of defining an "invisible building" (let's say "advanced_technology"), impossible to construct, without card, that doesn't appear in battle map, but that appears through scripting. This would be the requirement for some advanced buildings for barbarian factions, acquired by spying or alliance (I cannot figure out how to make it accessible by shopping).

    Could anybody give me a clue about this question?
    Or any other method to obtain the same effect.

    Thanks in advance.

  2. #2

    Default Re: Invisible buildings?

    I'm not really up on how buildings work, but the impossible to construct thing can be done requiring a hidden resource which isn't anywhere on the map, I don't think buildings just added to edb appear on the battlemap unless you do some other kind of referencing.

    It's the without card thing that's puzzling me. Closest to that is to have a blank, fully transparent card. If no card exists at all you just get the default barracks.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  3. #3
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Invisible buildings?

    Well if you want to make it accessible through shopping, you can do that with a triggered show-me script. If you posted the requirements that shoul exist before it can be bought we could probably help you.
    About the card: If you don't want a card, how would the player know where he has such a building? Maybe you should create an abstract unit card, e.g. a crane to signify the acquisition of new technologies.

  4. #4
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Thanks for your answers.
    You probably are right, and the best way to do with cards is to have one card for the "technology" (invisible building) as the first level of the corresponding real building.
    Example: building barbarian_stone_walls
    levels walls_tech (invisible building) stone_wall large_stone_wall epic_stone_wall

    The first level would require a non-existent hidden_resource, but the building will be created in one of these three occasions:

    1- Shopping: as a request of a barbarian diplomat or as an offer of a "civilized" diplomat (would it be feasible?) The possibility to trigger one offer of this type is also interesting, but I can't imagine the required conditions. Perhaps that the civilized faction construct one level (ex. large_stone_wall), and that one diplomat is near the barbarian faction leader.

    2- Spying: when a barbarian spy is inside a settlement with building_min_level large_stone_wall, there is a probability to get this technology.
    I would prefer that staying several turns (5 for example) in the settlement was the requirement for getting the technology.

    3- Alliance: after some years of alliance between the two factions, there is some probability of getting the technology. Perhaps more complicated requirements would be necessary.

    The problem is: Where would this wall_tech building be created? Is it possible to build this technology in all the settlements of the given faction? What about the new settlements conquered after the event?
    I would prefer some kind of faction_capability only attainable by one of those three methods, but I think they are hard_coded.
    Other possibility is to give some trait to all the generals of that faction, enabling them to construct the building, but I don't know if a trait can be used as a requirement for a building.

    As you can see, there are many doubts about this subject.

  5. #5
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Invisible buildings?

    Hmm I guess this would require quite a lot of rather complex scripting work including a background script and maybe some show_me events.

    I'm rather adept at scripting myself so it's possible my ideas won't work, but I'll try to figure something out:

    1. This is not possible like you want it. You can't edit diplomatic behaviour.

    2. This is probably possible with a show-me script that triggers on CharacterTurnEndInSettlement.

    3. This would be possible using a monitor_conditions checking DiplomaticStanceFromFaction and a monitor_event FactionTurnEnd that counts up a counter.

    I'd suggest something different:
    Check if a spy is in an advanced settlement. If he is, give the game some random percentage to fire a show-me.
    This show-me would offer the player to recruit a special ancillary called "Wall Builder" for some amount of money.
    You'd also run a background script that checks for every character on turn start if he is in a settlement; if he is, and has the "Wall Builder" ancillary, you'd create your building on turn start.
    This would resemble the wall builder teach the locals how stone walls are built, or that he leaves some of his students there.
    The clear downside on this is that you can only transfer this ancillary between spies.
    You could also give the spy a special trait instead of an ancillary so that he becomes the wall engineer himself.
    Last edited by alpaca; 09-28-2005 at 00:34.

  6. #6
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Thanks alpaca.
    I will think about all those possibilities and I'll try some of them in the campaign.
    Of course, I'll report here any advance in this field.

    Cheers.

  7. #7
    Senior Member Senior Member Duke John's Avatar
    Join Date
    May 2003
    Location
    Netherlands
    Posts
    2,917

    Default Re: Invisible buildings?

    BI introduces factionwide checks for traits. So instead of checking each spy just see if an agent has the Has-seen-stone-walls trait exists and if so allow stone walls to be built by building the "invisible" building in all provinces (not exactly invisible since you will have a blank space, which really shows if it's inbetween visible buildings).

    The option suggested by apalca works very neat for humans, but the AI does nothing with it so you are probably better off making it more automatic.

  8. #8
    Member Member Dromikaites's Avatar
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    151

    Default Re: Invisible buildings?

    Quote Originally Posted by Duke John
    BI introduces factionwide checks for traits. So instead of checking each spy just see if an agent has the Has-seen-stone-walls trait exists and if so allow stone walls to be built by building the "invisible" building in all provinces (not exactly invisible since you will have a blank space, which really shows if it's inbetween visible buildings).

    The option suggested by apalca works very neat for humans, but the AI does nothing with it so you are probably better off making it more automatic.
    Yes, I like Alpaca's approach for humans and in the same time for AI this should be automatic.

    Here's how I'd do it (he, he, I might even do it for Imperium: TW, in which case both Monkwarrior and Alpaca will show up on the credits list).

    1. Build a trigger for "stonewall bulider" ancillary, based on the EndedInSettlement and BuildingPresent conditions. We need an ancillary because BI comes with the FactionwideAncillaryExists condition;
    2. Write a piece of code like: monitor_condition FactionwideAncillaryExists stonewall_builder ... end_monitor. If the stonewall builder exists the code takes every city on the map, checks if belongs to the current faction (SettlementIsLocal), if the "invisible building" is not yet present (not BuildingPresent) and if the faction has enough money to pay for the services of the "stonewall builder" (Treasury). If all the conditions are met the "invisible building" is built and the cash is subtracted fromt the treasury.

    To do the same piece of work in RTW automaticly would be a major pain in the butt because each character name would need to be checked to see if he is a spy and has that particular ancillary. Not to mention that if by bad luck we have 2 spies with the same name, the code would check only one of them so it might miss the "stonewall builder".

  9. #9
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Well, I didn't think this discussion could be so interesting.

    In any of your approaches, I find difficult to put the condition "there_is_a_spy_of_this_faction_in_a_settlement_with_large_stone_wall_building_level". Because only the conditions BuildingPresent and/or EndedInSettlement are not enough for my purpose.
    Any suggestion about this?

    About the condition FactionwideAncillaryExists, is it implemented in RTW or must we wait for BI?
    My idea was also to build this invisible building for free, as it is only a technology acquired by spying, given that shopping seems to be unfeasible.
    The other possibility is to gain this ancillary if a settlement with large_stone_wall is conquered by a barbarian faction.

    Regarding the last point of Dromikaites: if the ancillary is given to all the characters and agents, could it be only checked in the FactionLeader? As there is only one, this method would eliminate any problem of double check due to names.

  10. #10

    Default Re: Invisible buildings?

    What about?

    monitor_event CharacterTurnEnd AgentType = spy
    and FactionType britons
    and SettlementBuildingExists = stone_wall
    and RandomPercent < 20
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  11. #11
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Quote Originally Posted by Epistolary Richard
    monitor_event CharacterTurnEnd AgentType = spy
    and FactionType britons
    and SettlementBuildingExists = stone_wall
    and RandomPercent < 20
    Hopefully it is so easy.
    I thought that you should specify in the script:
    - which settlement is that
    - that the spy is there at the moment

    What I understand from that script is:
    - the game check every briton spy
    - the game search for a settlement where the stone_wall exists (irrespective whether the spy is there or not)
    - then the game applies the random percent

    What happens with the spies that are out of a settlement?
    Am I wrong?

  12. #12
    Member Member Dromikaites's Avatar
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    151

    Default Re: Invisible buildings?

    Quote Originally Posted by Monkwarrior
    Hopefully it is so easy.
    I thought that you should specify in the script:
    - which settlement is that
    - that the spy is there at the moment

    What I understand from that script is:
    - the game check every briton spy
    - the game search for a settlement where the stone_wall exists (irrespective whether the spy is there or not)
    - then the game applies the random percent

    What happens with the spies that are out of a settlement?
    Am I wrong?
    Every time the spy enters a city which does not belong to his faction, he fires the SpyMission event. This is the event to be intercepted by the trigger for acquiring the ancillary. According to the documentation the event returns among other parameters the region_id, which means the spy and the city are "tied" to each other.

    Please try to see if it works. I will do it myself this week-end when I have more time and report back, but I guess you need an answer faster than that.

  13. #13
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Only partial success.

    I've created a new trait, wall_builder (useless at the moment) and a new ancillary, wall_builder. These are the entries in export_descr_ancillaries.
    Code:
    ;------------------------------------------
    Ancillary wallbuilder_ancillary
        Image scribe_ancillary.tga
        Description wallbuilder_ancillary_desc
        EffectsDescription wallbuilder_ancillary_effects_desc
        Effect SiegeDefence  1 
        Effect Construction  10 
    
    ;------------------------------------------
    Trigger trigger_wallbuilder_ancillary
        WhenToTest CharacterTurnEnd
        Condition EndedInSettlement
              and SettlementBuildingExists >= stone_wall
              and AgentType = spy
    
        AcquireAncillary wallbuilder_ancillary chance  100
    The effects are only to test the ancillary. The chance 100 is only to speed up the test.
    This is the effect in game.

    On the left, the spy before entering Rome. On the right, the same spy after staying in Rome for a turn.
    Of course, it is necessary to complete also export_descr_ancillaries_enum and export_ancillaries.

    The problem comes from the next step. I tried to trigger a show_me script with an advice about the new technology. These are the entries in export_descr_advice:
    Code:
    ;------------------------------------------ Barbarian Walls advice below		
    AdviceThread Stone_Wall_Technology_Thread		
    	GameArea Campaign	
    
    	Item Stone_Wall_Technology_Text_01	
    		Uninhibitable
    		Verbosity  0 
    		Threshold  1  
    		Attitude Normal
    		Presentation Default
    		Title Stone_Wall_Technology_Text_01_Title
    		Text Stone_Wall_Technology_Text_01_Text1
    
    ;------------------------------------------ Barbarian Walls trigger
    Trigger 3001_Stone_Wall_Technology_Trigger
        WhenToTest FactionTurnStart
    
        Condition FactionIsLocal 
              and FactionwideAncillaryExists wallbuilder_ancillary true               
    
        AdviceThread Stone_Wall_Technology_Thread  0
    Unfortunately the game (still RTW) doesn't seem to recognize the condition FactionwideAncillaryExists, although there is no error message from -show_err.
    As a result, the advice appears just at the start of the campaign.

    I've been thinking about the possible script.
    Do you think that it would be necessary one script per faction and in each script all the settlement must be checked one by one?

    Any idea?

    P.S.: do you think that it would be better to implement this kind of things through a background script?

  14. #14

    Default Re: Invisible buildings?

    Quote Originally Posted by Monkwarrior
    Hopefully it is so easy.
    I thought that you should specify in the script:
    - which settlement is that
    - that the spy is there at the moment

    What I understand from that script is:
    - the game check every briton spy
    - the game search for a settlement where the stone_wall exists (irrespective whether the spy is there or not)
    - then the game applies the random percent

    What happens with the spies that are out of a settlement?
    Am I wrong?
    I've not tested this but here is my logic:

    This is the event:

    ---------------------------------------------------
    Identifier: CharacterTurnEnd
    Event: A Character has finished its turn
    Exports: nc_character_record, character_record, faction, region_id, character_type, settlement
    Class: ET_CHARACTER_TURN_END
    Author: Guy

    Note that the event has a settlement export, that export relates to the specific city that the character is in. That is why you can have SettlementName as in the following example from vanilla prologue

    monitor_event GeneralCaptureSettlement FactionType romans_julii
    and SettlementName Messana

    This monitor fires when the general captures Messana, not when the general captures the city and a city called Messana exists somewhere.

    So:

    monitor_event CharacterTurnEnd AgentType = spy
    ; Check each spy at the end of their turn turn
    and FactionType britons
    ; Check to see if their faction type is Britons
    and SettlementBuildingExists = stone_wall
    ; Check to see if the settlement they're in has a stone wall
    and RandomPercent < 20
    ; Apply random percent

    The only confusion in that script, I think perhaps, will be between whether the agent has to be Britons or whether the settlement has to be Britons. Without testing it, I couldn't tell you how the game is reading it.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  15. #15
    Member Member Dromikaites's Avatar
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    151

    Default Re: Invisible buildings?

    Quote Originally Posted by Monkwarrior
    Unfortunately the game (still RTW) doesn't seem to recognize the condition FactionwideAncillaryExists, although there is no error message from -show_err.
    As a result, the advice appears just at the start of the campaign.
    FactionwideAncillaryExists is not implemented in RTW. It will only become available in BI. What you can do before getting your hands on BI is to test the code with a particular spy (one you know his name, say Burubista). You make Burubista enter a city with stone walls and then check only Burubista's ancillary.

    Since in RTW you need to go through all the possible names, to check if they are spies and then if they have the constructor de murallas (wall builder), the code is a pain in the butt. FactionwideAncillaryExists simplifies the code.

    To me the images show that your code actually works because the dude gets his constructor de murallas. Congratulations!
    Last edited by Dromikaites; 09-29-2005 at 11:43. Reason: Expanding it

  16. #16
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    @E. Richard
    You are probably right, but my idea was to try a more general script, not only for a given faction, if it is possible, of course.
    In fact, the ancillary could be restricted to some factions using the ExcludeCultures command, which is often used in export_descr_ancillaries.
    In any case, I will try a background script with your idea just to test this syntax.

    @Dromikaites
    In the meantime, I will try your idea. As I know that Burubista is the spy I'm using, I will work with this just to see if the script is correct.

    @ Both of you
    I was wondering if we could play a little bit with the faction_capability.
    Would there be any type of capability that we can put as requirement for the first, invisible, building? Could we give this capability to a faction through scripting?
    The problem with the ancillary is that it is given only to the spy. That means that if it is killed in the next turn, the faction losts the ancillary. The capability would be permanent, irrespective of the characters alive in each moment of the campaign.

    Another point is if there is some "general way" to detect the settlements owned by a given faction and to build a building in all of them.
    I didn't find anything like this (all the commands of creation of buildings require the name of the settlement), so the script should contain a check for every settlement in the map.

  17. #17
    Member Member Dromikaites's Avatar
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    151

    Default Re: Invisible buildings?

    Quote Originally Posted by Monkwarrior
    @ Both of you
    I was wondering if we could play a little bit with the faction_capability.
    Would there be any type of capability that we can put as requirement for the first, invisible, building? Could we give this capability to a faction through scripting?
    The problem with the ancillary is that it is given only to the spy. That means that if it is killed in the next turn, the faction losts the ancillary. The capability would be permanent, irrespective of the characters alive in each moment of the campaign.

    Another point is if there is some "general way" to detect the settlements owned by a given faction and to build a building in all of them.
    I didn't find anything like this (all the commands of creation of buildings require the name of the settlement), so the script should contain a check for every settlement in the map.
    faction_capability extends the benefits of a particular building to all the cities belonging to a faction, not to only those having that building present. It turns a building into a wonder.

    So it's not about what a "faction can do" but about "what a building can do for a faction". Of course you can indirectly test the faction_capability by testing if a building that gives such faction-wide benefits is present in any of the faction's cities.

    As for the second question you are in the "pain in the butt" territory: you need to loop through all the settlements on the map, check if they are local (i.e. they belong to the current faction) and then check if they have the building present. If not, build it.
    Last edited by Dromikaites; 09-29-2005 at 12:30.

  18. #18

    Default Re: Invisible buildings?

    Quote Originally Posted by Monkwarrior
    You are probably right, but my idea was to try a more general script, not only for a given faction, if it is possible, of course.
    You can extend it to other factions by duplicating the monitor and replacing britons with gauls, for example.

    You could get rid of the faction requirement altogether, but you need it to be able to determine which faction needs to be able to get the capability.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  19. #19
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Invisible buildings?

    Current status:

    Created a new trait

    Code:
    ;------------------------------------------
    Trait WallBuilder
        Characters spy
    
        Level WallBuilder
            Description WallBuilder_desc
            EffectsDescription WallBuilder_effects_desc
            Threshold  1 
    
    ;------------------------------------------
    Trigger wallbuilder
        WhenToTest CharacterTurnEnd
    
        Condition AgentType = spy
              and FactionCultureType barbarian
              and SettlementBuildingExists >= stone_wall
    
        Affects WallBuilder  1  Chance  100
    Created a background script:
    Code:
    script
    	
    	monitor_event CharacterTurnEnd AgentType = spy
    		and Trait WallBuilder >= 1
    		and SettlementName Patavium
    		console_command create_building Patavium stone_wall_prerequisite
    		console_command add_money -3000
    		terminate_monitor
    	end_monitor
    	
    	while TrueCondition
    	end_while
    
    end_script
    Added the building:
    Code:
    building stone_wall_prerequisite
    {
        levels stone_wall_prerequisite
        {
            stone_wall_prerequisite requires factions { barbarian, } and hidden_resource stone_wall_pre
            {
                capability
                {
                }
                construction 0
                cost  3000
                settlement_min town
                upgrades
                {
                }
            }
        }
    }
    Edited the require clause of the larger walls:
    Code:
     requires factions { ct_carthage, eastern, parthia, egyptian, greek, roman, } or building_present_min_level stone_wall_prerequisite stone_wall_prerequisite
    This works fine so far, I was able to build stone walls in Patavium after changing descr_strat so that it is a city and spying in Rome ;)
    One'd have to do this for every city on the map but that's okay, you can copy&paste and only have to change the settlement name.
    The downside of this is that the player may wonder why he just lost 3000 denarii, I'm planning to advance an advice telling him.

    I haven't done much more testing yet, I'll post another update this evening.

  20. #20
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Great alpaca!
    Thanks a lot!

    I am also working in a background script that doesn't need any new trait or ancillary. I will probably test it this night and I will post it tomorrow.

    I find very interesting the condition for stone_walls. I had never guessed this type of conditional! Barbarians don't appear as required faction, but they can build due to the other requirement.

    I had prepared a new building with three levels: wall_tech (your prerequisite) with the requirement of a hidden_resource but zero cost, stone_wall and large_stone_wall. This was necessary as the barbarians cannot upgrade cities to large_cities, and in this way I can allow the construction of large_stone_wall at a city level (I must still investigate the problem of models for strat and battle maps).

    In any case, I think we are close to the solution.

  21. #21
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Hi again,
    after some attempts with a background script, I mixed mine and alpaca's one in this way:
    Code:
    script
    
    monitor_event CharacterTurnEnd AgentType = spy
    	and FactionType dacia
    	and SettlementBuildingExists >= stone_wall
    
    				console_command create_building Mediolanium wall_tech
    				advance_advice_thread Stone_Wall_Technology_Thread
    
    	terminate_monitor
    end_monitor
    
    while TrueCondition
    end_while
    
    terminate_script
    This is combined with an advice thread and a modification in export_descr_buildings:
    Code:
    building barbarian_defenses
    {
        levels wall_tech stone_wall large_stone_wall 
        {
            wall_tech requires factions { barbarian, eastern, } and hidden_resource muralla
            {
                capability
                {
                }
                construction  0 
                cost  0 
                settlement_min town
                upgrades
                {
                    stone_wall
                }
            }
            stone_wall requires factions { barbarian, eastern, } 
            {
                capability
                {
                    wall_level 2
                    tower_level 1
                    gate_defences 1
                    gate_strength 1
                }
                construction  3 
                cost  1600 
                settlement_min city
                upgrades
                {
                    large_stone_wall
                }
            }
            large_stone_wall requires factions { barbarian, eastern, } 
            {
                capability
                {
                    wall_level 3
                    tower_level 1
                    gate_defences 2
                    gate_strength 2
                }
                construction  5 
                cost  3200 
                settlement_min city
                upgrades
                {
                }
            }
        }
        plugins 
        {
        }
    }
    For the moment, the first problem is that the advice thread is not shown, as the advisor appears and suddenly disappears during the end turn.
    My next step is that the script must check if Mediolanium is still owned by dacia faction, before building the "invisible building". And this must be done with all the settlements in the map, either in the same turn or as an independent event.
    After that, the same must be done with the rest of the "barbarian" factions.

  22. #22
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Hi, script lovers
    I think that I have the correct syntax for a script that allows the espionage of technologies from a more developed civilization.

    This is my currently working script:
    Code:
    script
    
    declare_counter loop
    declare_counter wall_dacia
    set_counter wall_dacia 1
    
    monitor_event CharacterTurnEnd AgentType = spy
    	and FactionType dacia
    	and SettlementBuildingExists >= stone_wall
    
    	set_counter wall_dacia 2
    	console_command toggle_perfect_spy
    
    	terminate_monitor
    end_monitor
    
    monitor_event FactionTurnStart FactionType dacia
    	and I_CompareCounter wall_dacia = 2
    
    	advance_advice_thread Stone_Wall_Tech_Thread no_dismiss
    	campaign_wait 30
    
    	terminate_monitor
    end_monitor
    
    monitor_conditions I_CompareCounter wall_dacia = 2
    	and I_SettlementOwner Mediolanium = dacia
    
    		console_command create_building Mediolanium wall_tech
    
    	terminate_monitor
    end_monitor
    
    monitor_conditions I_CompareCounter wall_dacia = 2
    	and I_SettlementOwner Segesta = dacia
    
    		console_command create_building Segesta wall_tech
    
    	terminate_monitor
    end_monitor
    
    while I_CompareCounter loop = 0
    end_while
    
    terminate_script
    In the test, Mediolanium was owned by dacians, but Segest not. The spy arrived to Rome in the second turn, but there was no message at all. It was at the beginning of the next turn when the advisor appeared. (I think I also succeeded in finding the correct parameters for the advice to appear in each campaign). The prerequisite building was built in Mediolanium, but not in Segesta (toggle_perfect_spy is only to be sure of that point). I gathered an important army and conquered Segesta from the romans hands, and immediately the prerequisite building was there.

    Now it would be necessary to put the monitor_condition for all the settlements in the campaign map. After that it would be necessary to declare one new counter for each faction and repeat the whole thing as many times as factions are in the campaign map.

    At the moment there is only one problem that strikes me:
    the prerequisite building is present in one settlement, but it is the symbol for a technology owned by the faction. However, when the settlement is conquered by other faction, this prerequisite already exists, although this new faction hasn't the technology.
    Could this building be authomatically destroyed if the settlement is lost by the faction?

  23. #23

    Default Re: Invisible buildings?

    Alas, there is no destroy_building command, the closest you can get is the set_building_health console command as documented by The_Mark in the scripting command research thread:
    https://forums.totalwar.org/vb/showthread.php?t=46877

    Unfortunately, setting building health to zero does not destoy the building.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  24. #24
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Hi again,
    this question is for ER or any other experienced scripter.

    All the tests of my script for "technology espionage" have been carried out as a background script from the beginning of the campaign.
    However, I read in the nice tutorial by ER that this type of script can be only launched at the very beginning of the campaign. That means that I must convert this script in a show_me script launchable every time the campaign is loaded.

    Here my question:
    What happens with the counters in a show_me script?

    Example: the dacians have reached the stone_wall technology (counter set to 2) and they have the "invisible" building in each of their settlements. The script is launched after loading the campaign. Would the counter be set at 1 or 2? If it is 1, the dacians will lose the technology every time the game is loaded.
    In such case, I will have to look for another method, different from a counter, to trigger the technology.

  25. #25
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Invisible buildings?

    You might want to do a check at the beginning of the script execution whether a faction has the invisible building in its settlements or the faction-wide ancillary if you have BI.
    If it does, you set the counter to 2, if it doesn't, you set it to 1.

    Counters are not saved so you have to use other means of persisting them.

  26. #26

    Default Re: Invisible buildings?

    Just to be clear - the two different types of script are referring to as:

    1) campaign scripts - activitated through the bottom line of descr_strat (and with the save/load prohibition)
    2) show_me scripts - activitated through export_descr_advice

    Show_me scripts are further divided into event scripts (that only run for a few moments and then terminate, such as the Client Kingdoms scripts) and background scripts (which should be running for the entire game and must be activated at the beginning - potentially through a terminating campaign script - and after a reload).

    Anyway, as to your question:

    When you start the script up again after a reload the script should run from the beginning - the first command it will see regarding the counter will be to set it to 1. If there's nothing to set the counter it will automatically set it to 0.

    What you need to do is to make some kind of physical change to the game that will be saved within the save game that the script can then use to determine if the Dacians have got that technology or not.

    In this case you're already making a physical change by adding the walls_tech building - so all you need to do is add a monitor that checks the Dacian settlements to see if walls_tech exists in any of them. If it does, then you know they have the technology, so you can set the counter to 2.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  27. #27
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Well, this post is to look for a solution for the last (I hope ) problem of this script. From your explanations, ER, I've been transforming the campaign script into a background show_me script.
    I remember the origin of the script: a spy is able to obtain a technology for his faction. I create a counter, which launches the construction of a "phantom building". This is the part of the script
    Code:
    script
    
    declare_counter loop
    declare_counter wall_spain
    
    set_counter wall_spain 1
    
    monitor_event CharacterTurnEnd AgentType = spy
    	and FactionType spain
    	and SettlementBuildingExists >= large_stone_wall
    	and RandomPercent < 20
    
    	set_counter wall_spain 2
    
    	terminate_monitor
    end_monitor
    
    monitor_event FactionTurnStart FactionType spain
    	and I_CompareCounter wall_spain = 2
    
    	advance_advice_thread Stone_Wall_Tech_Thread no_dismiss
    	campaign_wait 30
    
    	terminate_monitor
    end_monitor
    
    monitor_conditions I_CompareCounter wall_spain = 2
    	and I_SettlementOwner Scallabis = spain
    
    		console_command create_building Scallabis wall_tech
    
    	terminate_monitor
    end_monitor
    
    while I_CompareCounter loop = 0
    end_while
    
    terminate_script
    The creation of the building is repeated with all the settlements in the map (76) and the same script is repeated for all the "barbarian factions" I have in the campaign (9). This means that I have 9x76 conditions. My idea was to use the same method for 6 technologies = 9x76x6 conditions.

    And here comes the problem. The counter cannot be saved, so a new initial condition must be included. I considered the possibility that the script looks for this "phantom building" and if it founds one for the faction, the counter is set to 2. This is the piece of script:
    Code:
    monitor_event SettlementTurnStart FactionType spain
    	and SettlementBuildingExists >= wall_tech
    
    	set_counter wall_spain 2
    
    	terminate_monitor
    end_monitor
    But in that case, when the script is launched in a saved game, A SECOND BUILDING IS CONSTRUCTED IN ALL THE SETTLEMENTS WHERE IT ALREADY EXISTED. And, of course, if the script is launched a third time, a third building is constructed.
    I tried to solve using this other condition for each settlement:
    Code:
    monitor_conditions I_CompareCounter wall_spain = 2
    	and I_SettlementOwner Segesta = spain
    	and not SettlementBuildingExists = wall_tech
    
    		console_command create_building Segesta wall_tech
    
    	terminate_monitor
    end_monitor
    However the script doesn't recognize this line and no building is constructed in any settlement. The initial condition works and the counter is set to 2, given that the advice is shown, but there is no bulding. What is wrong i that line?

  28. #28

    Default Re: Invisible buildings?

    Ah, the reason this does not work is that the SettlementBuildingExists condition requires an import (trigger requirement):

    Code:
    ---------------------------------------------------
    Identifier: SettlementBuildingExists
    Trigger requirements: settlement
    Parameters: building description, logic token, test level
    Sample use: SettlementBuildingExists = governors_house
    Description: Test to see if the settlement has a building at a particular level
    Battle or Strat: Strat
    Class: SETTLEMENT_BUILDING_LEVEL_EXISTS_TEST
    Implemented: Yes
    Author: Guy
    Unfortunately monitor_conditions does not provide one. So if you're using a monitor_conditions all the subsequent conditionals have to not require imports (ie, be I_ conditions), which is why the I_SettlementOwner condition works:
    Code:
    ---------------------------------------------------
    Identifier: I_SettlementOwner
    Trigger requirements: 
    Parameters: settlement name, logic token, faction type
    Sample use: I_SettlementOwner Segesta = romans_julii
    Description: Is this settlement owned by this faction?
    Battle or Strat: Strat
    Class: SETTLEMENT_OWNER
    Implemented: Yes
    Author: Guy
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  29. #29
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Invisible buildings?

    Thanks ER,
    unfortunately this explains why this method doesn't work but I cannot figure out any other system to do it.

  30. #30
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Invisible buildings?

    You could use a monitor_event SettlementTurnEnd which exports settlement information:

    monitor_event SettlementTurnEnd
    and SettlementName = Segesta
    and I_CompareCounter wall_spain = 2
    and I_SettlementOwner Segesta = spain
    and not SettlementBuildingExists = wall_tech
    Last edited by alpaca; 10-14-2005 at 10:50.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO