Page 3 of 4 FirstFirst 1234 LastLast
Results 41 to 60 of 64

Thread: Concepts and Theories

  1. #41
    Romanos IV's Avatar The 120th Article, § 4
    Join Date
    Jun 2008
    Location
    the hell outta here (Athens, European Client State of Greece)
    Posts
    3,882

    Default Re: Concepts and Theories

    Oh, that's interesting, thank you.
    Under the noble patronage of Jimkatalanos

  2. #42

    Default Re: Concepts and Theories

    @GED and AL thank you soooooo much. +rep
    Contribuitor IBIICB-WOTN-Modeler-Scripter


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

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

    Default Re: Concepts and Theories

    To answer the question about why we use == instead of just =, it's programming code tendencies. In many languages the '=' sign is used to assign 'names' to 'values'.

    monkey = jonathan
    jonathan = "Monkey"

    I'm giving the 'name' monkey to the value 'jonathan'. jonathan also happens to be a name, this time though the value is a string. So when I say print monkey it will print Monkey because the 'name' monkey looks for the 'name' jonathan which specifies the string "Monkey" as its value.

    So to differentiate between that use of the equals sign and the use as a logic token, the logic token uses ==. It isn't required you do this in TW scripting, but many people do and it does make it look a bit cleaner in my opinion.

  4. #44

    Default Re: Concepts and Theories

    Is it possible to force diplomacy using the script? I.E., at turn such-and-such these two factions will sign an alliance? Thanks.
    Son of PW

  5. #45
    Dewy's Avatar Something Witty
    Join Date
    Jun 2008
    Location
    Australia
    Posts
    4,697

    Default Re: Concepts and Theories

    In most programming languages include C++ which the game is programmed in. "=" means assign value to the right, to the variable to the left(in most cases).
    Last edited by Dewy; July 04, 2009 at 12:47 AM.
    Oh no the picture of my dog disappeared!

  6. #46

    Default Re: Concepts and Theories

    Something i am playing about with at the moment as a result of this class. I am playing a mod that runs from about 800 AD to 1200AD. In the year 915 AD plague strikes the country but only affects certain cities it runs for 4 turns and many people die then the plague dies out.

    So I was wondering how it is scripted this how i am thinking it is done,

    Historic events.txt
    {PLAGUE_EVENT_BODY} Plague has struck your country.
    {PLAGUE_EVENT_TITLE} Plague is here

    Turn counter campaign_script.txt
    declare_counter TurnNumber
    set_counter TurnNumber 1

    Campaign_script.txt
    monitor_event FactionTurnEnd FactionIsLocal
    inc_counter TurnNumber 1
    end_monitor

    monitor_event FactionTurnEnd FactionIsLocal
    and I_CompareCounter TurnNumber == 50 (a guess)
    historic_event plague
    set_counter TurnNumber 0
    end_monitor

    That would be the first part of the script. The second part of the script would be to do the effects of the plague on the country. I have a some questions,

    Will one timer script work for all historic events that use a timer.
    How would i make it so the event only fired once and not every 50 turns.
    Last edited by Alex-ander; July 07, 2009 at 06:56 AM.

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

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

    Default Re: Concepts and Theories

    There's a condition called I_TurnNumber, you shouldn't need a counter in order to monitor it. You may also be able to just do it through the descr_events.txt file.

  8. #48
    Benz282's Avatar Vicarius
    Join Date
    May 2008
    Location
    East Coast, US
    Posts
    2,955

    Default Re: Concepts and Theories

    I have been conceptulizing a mod for a long time that would use a different recruiting system than is currently in place. Instead of being able to recruit every troop type right out of the barracks, you would train a "Recruit" and then place that unit on a specific tile on the map. Whenever a turn is ended and there is a "Recruit" unit on that tile, it is removed from the map and replaced with the next tier of troop, which would then continue until the highest level of troop is reached, or when the player removes the unit from the tile (this would not work for AI factions, obviously). For example:

    "Peasant" is recruited in London.
    Player moves "Peasant" to the magic tile.
    Player's turn ends.
    Script runs and replaces "Peasant" with "Levy Spearmen".
    Player's turn ends.
    "Town Watch" is replaced with "Sergeant Spearmen"
    Player's turn ends.
    "Sergeant Spearmen" is replaced with "Armored Spearmen"
    Etc,

    1 - Is it possible for scripts to recognize the composition of an army?
    2 - Is it possible for scripts to recognize the presence of an army on a specific tile without a specific named character in the stack?
    3 - Is it possible for scripts to remove specific units from the map?
    4 - Is it possible for scripts to create units into a stack without the presence of a specific named character in that stack?

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

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

    Default Re: Concepts and Theories

    Quote Originally Posted by Benz282 View Post
    I have been conceptulizing a mod for a long time that would use a different recruiting system than is currently in place. Instead of being able to recruit every troop type right out of the barracks, you would train a "Recruit" and then place that unit on a specific tile on the map. Whenever a turn is ended and there is a "Recruit" unit on that tile, it is removed from the map and replaced with the next tier of troop, which would then continue until the highest level of troop is reached, or when the player removes the unit from the tile (this would not work for AI factions, obviously). For example:

    "Peasant" is recruited in London.
    Player moves "Peasant" to the magic tile.
    Player's turn ends.
    Script runs and replaces "Peasant" with "Levy Spearmen".
    Player's turn ends.
    "Town Watch" is replaced with "Sergeant Spearmen"
    Player's turn ends.
    "Sergeant Spearmen" is replaced with "Armored Spearmen"
    Etc,

    1 - Is it possible for scripts to recognize the composition of an army?
    2 - Is it possible for scripts to recognize the presence of an army on a specific tile without a specific named character in the stack?
    3 - Is it possible for scripts to remove specific units from the map?
    4 - Is it possible for scripts to create units into a stack without the presence of a specific named character in that stack?
    Soooo here comes the bad news, which happens quite often in scripting.

    1- Scripts can't recognize a specific unit in an army, unless you are in a historical battle and you label the units so you inherently know which label applies to which unit. There are a few conditions that do this shoddily:

    PercentageUnitCategory
    UnitType
    PercentageUnitAttribute
    TrainedUnitCategory
    TrainedUnitClass
    UnitCategory
    I_UnitExists

    2- Again the options are limited. The following conditions could be workable in a roundabout fashion but there would be loopholes:

    I_FactionNearTile

    3- Yes, but not without player involvement or a character. This command is the only roundabout fashion:

    destroy_units

    4- spawn_army works to spawn a new army on a tile. create_unit works to spawn a unit into an existing settlement or character. So the short answer is no it probably isn't possible.

    ---------------------------------------------------------

    Now... there might be a way to achieve something somewhat similar to what you are looking for. It would require more than you suggest, and would probably be full of loopholes, but it might work. I haven't tried this myself but I'll post my theory:

    1) First create a character. This character should be created through the script and given a script label. Put the character at the location you want the units to spawn. Could give him high loyalty traits and traits that remove all his MP if you like as well. Give him a trait that only he has that he can be identified with, we'll call it "Spawner".

    2) Move the unit you want to replace to join the character. Now in order to insure the unit is with the character, you have to give it an attribute in the EDU that no other units have(or only the other units in the chain). We'll say "gunpowder_unit" for now. Set up a monitor like this:
    Code:
    monitor_event CharacterSelected CharacterIsLocal
        and PercentageUnitAttribute gunpowder_unit > 50.0 ;Only the bodyguard and the special unit
        and Trait Spawner > 0
     set_event_counter spawn_next_unit 1
    end_monitor
    This sets it up so we know the unit is with the character.

    3) The next step is determining what the unit is. We only have one option to determine the exact unit type on the strat map, and that's "UnitType"(assuming it works). Since it only fires off a select few, we need to pick one that fits, so we'll use UnitDisbanded as our event.
    Code:
    monitor_event UnitDisbanded UnitType Peasant
        and I_EventCounter spawn_next_unit == 1
    wait 1
    create_unit label_here, Sergeant_Spearmen, num 1, exp 0, arm 0, wep 0
    set_event_counter spawn_next_unit 0
    end_monitor
    A similar chunk of code would need to be done for each unit type to be replaced. The player would have to manually disband the unit in order for it to fire. Now, there's already one glaring problem, the player could click any unit anywhere since the event counter has already been set. To fix this, we should set up a series of commands to disable the counter to make it impossible for them to reach the disband interface of another unit. Like so:
    Code:
    monitor_event SettlementSelected I_EventCounter spawn_next_unit == 1
     set_event_counter spawn_next_unit 0
    end_monitor
    
    monitor_event CharacterSelected Trait Spawner < 1
        and I_EventCounter spawn_next_unit == 1
     set_event_counter spawn_next_unit 0
    end_monitor
    These two monitors should set the counter back to 0 whenever the player selects any character besides the spawner. Since the spawner also runs on character select, in order to enable it the player just has to select the spawner army again. So to trigger it the player would:

    - Select spawner army
    - Not select any other settlement/character
    - Disband the unit to be replaced located in the spawner army

    Theoretically the above code should function. One problem that may occur is inability to use unit labels with the create_unit command or the create_unit command only working with console_command in front, I'm basing it on the DocuDemons and common sense, but neither of those are always prevailing. You should also be able to do it for more than one unit since as long as only the bodyguard is there besides the replaceable units, the % with the attribute will always be over 50%.

    Now, some problems assuming that code works:

    - There's only so many attributes you can use, and most are useful for all units. "can_sap" is about the only one I remember that isn't all that useful. Finding a different way than attribute to determine that the unit exists in the army is potential and should be explored. You *might* be able to skip on the identification of the army composition altogether with the usage of the CharacterSelected and UnitDisbanded monitors subverting it.

    - There's no delay between the unit arriving and being spawned. What you could do is set a counter timer once the unit has been detected in the selected character, then require the disband event to also require that timer to be a certain number in addition to having selected the spawner character.

    - Monitors that use "Selected" will be firing all the time, so a vast number of them could cause lag.

    Probably other things that would come up. But it's worth a try.
    Last edited by Augustus Lucifer; July 08, 2009 at 11:24 PM.

  10. #50

    Default Re: Concepts and Theories

    Quote Originally Posted by Theodotos I View Post
    Is it possible to force diplomacy using the script? I.E., at turn such-and-such these two factions will sign an alliance? Thanks.
    Just checking to see if this is possible.
    Son of PW

  11. #51
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Concepts and Theories

    Quote Originally Posted by Theodotos I View Post
    Just checking to see if this is possible.
    You can use set_faction_standing but it will change again over time. All factions have a number that they normalize towards that is set in descr_strat.

    So if England and France are set to be enemies all the time, and you force them to get along, over time their relationship will degrade to the point they are at war again.
    Last edited by GrnEyedDvl; July 09, 2009 at 03:38 PM.

  12. #52

    Default Re: Concepts and Theories

    Quote Originally Posted by GrnEyedDvl View Post
    You can use set_faction_standing but it will change again over time. All factions have a number that they normalize towards that is set in descr_strat.

    So if England and France are set to be enemies all the time, and you force them to get along, over time their relationship will degrade to the point they are at war again.
    I see, so no automatic treaties and alliances?
    Son of PW

  13. #53
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Concepts and Theories

    Probably not, though you could set the standing every turn if you needed to.

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

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

    Default Re: Concepts and Theories

    Quote Originally Posted by GrnEyedDvl View Post
    All factions have a number that they normalize towards that is set in descr_strat.
    Which begs the question of not having any value in descr_strat. It doesn't appear necessary for the game to run to have a value in there for every faction for every other faction. So if no number is there would they normalize to 0?

  15. #55
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Concepts and Theories

    That would be my guess.

  16. #56
    Benz282's Avatar Vicarius
    Join Date
    May 2008
    Location
    East Coast, US
    Posts
    2,955

    Default Re: Concepts and Theories

    Quote Originally Posted by Augustus Lucifer View Post
    Soooo here comes the bad news, which happens quite often in scripting.
    That was a very long post; it was enlightening.

    I had another idea on how this could be done, and seeing as both my original plan and your solution seem to be on the impractical side, I think I will go with a tried and proven practice. In Res Gestae, when a Roman player builds a Recruited General, an army composed of the correct units for the period is created in a "Field of Mars" (which is no different than the "magic tile" from earlier). For my mod, I think I will follow the same concept.

    Thank you for your time, though.

  17. #57

    Default Re: Concepts and Theories

    Quote Originally Posted by GrnEyedDvl View Post
    Probably not, though you could set the standing every turn if you needed to.
    Interesting. I'm trying to remember, didn't RTW have console commands that could force diplomacy? Were those taken out of Med2?
    Son of PW

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

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

    Default Re: Concepts and Theories

    Quote Originally Posted by Theodotos I View Post
    Interesting. I'm trying to remember, didn't RTW have console commands that could force diplomacy? Were those taken out of Med2?
    Code:
    diplomacy_costs <receiving_faction> <proposing_faction> <opt:target_faction> <opt:settlement_name> <opt:payment_amount> <opt:payment_years>: displays a list of raw and perceived diplomacy items costs from the perspective of the receiving faction.
    
    diplomacy_mission <ai_faction> <target_faction> <mission_type> <opt:mission_target> : creates a diplomacy mission
    
    diplomatic_stance <faction_a> <faction_b> <allied/neutral/war>: 
    Set the diplomatic stance between the two factions
    
    force_diplomacy <accept/decline/off>: 
    Forces the negotiator to accept or decline a proposition
    Those are the diplomacy-related console commands. There's a few more diplomacy related scripting commands as well.

    Keep in mind that I'm pretty sure "diplomatic_stance" when it says "allied" does not mean give them an alliance. Those three are used in the Campaign AI file and they don't seem to be tied to actual agreements but rather indicative of tendencies.

  19. #59

    Default Re: Concepts and Theories

    Is it possible to script that units attack the walls (in a Historical battle for instance) , like you can script them to attack other units ? Btw , i mean that they'd attack the walls with siege engines or ladders or a ram or so ..
    Last edited by Killerbee; July 26, 2009 at 03:43 PM.

  20. #60

    Default Re: Concepts and Theories

    What's the command for giving a settlement to another faction ? i checked the docudemons , but i couldn't find anything

Page 3 of 4 FirstFirst 1234 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
  •