Page 1 of 4 1234 LastLast
Results 1 to 20 of 64

Thread: Concepts and Theories

  1. #1
    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 Concepts and Theories

    Since this class is sooo huge, and since scripting is so flexible, I am creating this thread to answer abstract questions not directly related to the current lesson. For lesson specific questions use the lesson thread. For other thoughts and ideas and "is this possible?" questions post here. Questions related to future lessons I will answer in general form without specific code examples, but things I havent thought of or havent included I will answer to the best of my ability, and some might get included in the upcoming lessons.

  2. #2

    Default Re: Lesson 1

    @GED
    this is your garrison script or at least part of it.
    i need to understand the declare_counter and set_counter , to set a set_counter is it obligatory to add the declare_counter above the monitor_event, in this case for york, london, nottingham, caernarvon and is it York_siege a random name or a requirement like for an example X_siege been X any settlement?

    I am a bit confuse with the condition, events and commands, i am not quite sure where to look for what i am planning to script, i would like to have that freedom of understanding an reading the script by simply watching at it.
    Is there an order like :
    Code:
    command event condition
    command and the parameters
    command
    And if so why is the declare_counter is set above the monitors, i mean being a command it make since but it doesn´t have an event it goes straight away to it parameters( York_siege)

    Code:
    ;;;;;;;;;Pool England-Wales, London, York, Nottingham, Caernarvon;;;;;;;;;;
    declare_counter York_siege
    declare_counter London_siege
    declare_counter Nottingham_siege
    declare_counter Caernarvon_siege
    
    ;;;;;; London ;;;;;;;;;;
    monitor_event CharacterTurnEndInSettlement not IsUnderSiege IsGovernor
         and SettlementName London
         set_counter London_siege 0
    end_monitor
    monitor_event CharacterTurnEndInSettlement IsUnderSiege IsGovernor
         and SettlementName London
         and not FactionIsLocal
         and not FactionType slave
         and I_CompareCounter London_siege = 0
         and SettlementBuildingExists = wooden_pallisade
         create_unit London, Welsh Spearmen Mercs, num 2, exp 0, arm 0, wep 0
         set_counter London_siege 1
    end_monitor
    Lets say that in my campaign_script i only set this code
    Code:
    monitor_event CharacterTurnEndInSettlement not IsUnderSiege IsGovernor
         and SettlementName London
         set_counter London_siege 0
    what will happen? for what i understand in the previous class this should be enough to tell the engine that this settlement in not under siege, but what happen if the value " 0 " was instead a value " 1 " ?

    after that the this code :
    Code:
    monitor_event CharacterTurnEndInSettlement IsUnderSiege IsGovernor
         and SettlementName London
         and not FactionIsLocal
         and not FactionType slave
         and I_CompareCounter London_siege = 0
         and SettlementBuildingExists = wooden_pallisade
         create_unit London, Welsh Spearmen Mercs, num 2, exp 0, arm 0, wep 0
         set_counter London_siege 1
    end_monitor
    tells the engine what will happen after the besiege settlement is true, or we want it to do for us. and i correct?
    but again what does this " = 0 " means?
    Code:
    and I_CompareCounter London_siege = 0
    because if it was a 1 would make more sense to me, than again right after that confuse me to hell this code appear:
    Code:
    set_counter London_siege 1
    but this make more sense than the other ones, i totally confuse.. sorry if my explanation is not clear but i am trying my best with the Lil English i know.

    Contribuitor IBIICB-WOTN-Modeler-Scripter


  3. #3

    Default Re: Concepts and Theories

    Damn!! i have just done that, i have posted a huge question in the lesson 1 , can you move it here. sorry for the inconvenient!
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  4. #4

    Default Re: Concepts and Theories

    I tried to script something simple that would gift a set amount of money to a faction when one of their characters became married, like dowery. It failed however and I wasn't entirely sure why, probably the way I used the CharacterMarries event.

    If i'd got that to work I would have set up a percentage part that would give certain amounts of money based on chance, representing more wealthy families marrying into the royals.

    Just curious as to whether or not you'd think this would be possible.


  5. #5
    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 Icedie of South View Post
    Damn!! i have just done that, i have posted a huge question in the lesson 1 , can you move it here. sorry for the inconvenient!
    Gimme a sec on that.




    Quote Originally Posted by Bucket of Lithium View Post
    I tried to script something simple that would gift a set amount of money to a faction when one of their characters became married, like dowery. It failed however and I wasn't entirely sure why, probably the way I used the CharacterMarries event.

    If i'd got that to work I would have set up a percentage part that would give certain amounts of money based on chance, representing more wealthy families marrying into the royals.

    Just curious as to whether or not you'd think this would be possible.
    It depends if you are trying to move money between factions or not. I dont think most of the marriage stuff exports Target, which is what you would need. You have to detect both sides of the marriage. The one you have to use is InterFactionMarriage.

  6. #6

    Default Re: Concepts and Theories

    I was originally trying it with just the random marriages for characters you get, but I'm going to go and mess around with it and see if I can make it work or if it's impossible. Cheers anyway.


  7. #7
    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

    Counters is the next lesson, but basically all I am doing there is using the counter to keep track of a condition. So every time there is a change in the game, there is a change in the counter value.

    When the settlement is not under siege, the counter is 0. When the settlement is under siege, the counter is 1. After the army spawns then set the counter back to 0 so it doesnt create more than 1 army. That script is probably a bit much to figure out all in one reading, but we will definitely be using counters to keep track of things in the next lesson.

  8. #8
    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 Bucket of Lithium View Post
    I was originally trying it with just the random marriages for characters you get, but I'm going to go and mess around with it and see if I can make it work or if it's impossible. Cheers anyway.
    Its possible, but first you have to define exactly what you want to do.

    Character gets married, what do you want to check, and who do you want to give the money to?

  9. #9

    Default Re: Concepts and Theories

    Sorry i am confuse again, what do you say about this then:
    Code:
    monitor_event CharacterTurnEndInSettlement IsUnderSiege IsGovernor
         and SettlementName London
         and not FactionIsLocal
         and not FactionType slave
         and I_CompareCounter London_siege = 0
    Why is the I_CompareCounter London_siege = 0 ? when the settlement is under siege.
    Code:
    and SettlementBuildingExists = wooden_pallisade
         create_unit London, Welsh Spearmen Mercs, num 2, exp 0, arm 0, wep 0
         set_counter London_siege 1
    end_monitor
    It would be simple to understand if the code was just the one above.

    Maybe this isn´t enough for me to understand scriptting.
    ---------------------------------------------------
    Identifier: I_CompareCounter
    Trigger requirements:
    Parameters: script counter, value
    Sample use: I_CompareCounter blib < 17
    Description: Compare a script counter to a value
    Battle or Strat: Either
    Class: COMPARE_COUNTER
    Implemented: Yes
    Author: Guy
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  10. #10
    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

    Working from memory here but I may have to go open that script.

    Quote Originally Posted by Icedie of South View Post
    Sorry i am confuse again, what do you say about this then:
    Code:
    monitor_event CharacterTurnEndInSettlement IsUnderSiege IsGovernor
         and SettlementName London
         and not FactionIsLocal
         and not FactionType slave
         and I_CompareCounter London_siege = 0
    Why is the I_CompareCounter London_siege = 0 ? when the settlement is under siege.

    If the settlement is under siege, and the counter is currently 0, then we havent performed any commands yet. If the counter is NOT 0 then we already spawned armies.





    Code:
    and SettlementBuildingExists = wooden_pallisade
         create_unit London, Welsh Spearmen Mercs, num 2, exp 0, arm 0, wep 0
         set_counter London_siege 1
    end_monitor
    It would be simple to understand if the code was just the one above.
    After we create the army, set the counter to 1 so that we know we already created an army and the same army doesnt get created again next turn.


    You WILL be able to get this, you just jhappened to pick a huge script to try and figure out. The next lesson is in smaller steps.


    EDIT: Maybe this will help. 1 = true and 0 = false
    Last edited by GrnEyedDvl; June 21, 2009 at 10:36 AM.

  11. #11

    Default Re: Concepts and Theories

    I assume counters also need to be "checked" ? By using 'CompareCounter' i assume ?

  12. #12

    Default Re: Concepts and Theories

    What can we still do with this data except that with the money?

  13. #13

    Default Re: Concepts and Theories

    What do you mean by data ?

  14. #14

    Default Re: Concepts and Theories

    I mean the campaing_script. I've think with this text file you can do other things too.

  15. #15
    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

    You can do all kinds of stuff. Look through things posted by me, or Alpaca, or many other scripters out there for ideas, and we will be doing different kinds of things in the next lessons.

    I posted links to all of my work in a single thread, Alpaca has his Script O Rama, and there are lots of other ideas in the mod workshop.

  16. #16

    Default Re: Concepts and Theories

    Looks really intresting. Maybe i do some of the script and post it here just for fun xD

  17. #17

    Default Re: Concepts and Theories

    Also , read some RTW tutorials (i recommend HouseofHam's) The scripts in RTW are practically the same as in M2TW

    I have some questions : Is it possible in M2TW to script movies ? I know a way-around in RTW , but i don't know 1 for M2TW ..
    Also : I have installed Barebones folder , as i had some probs creating my own modfolder . it has a campaign_script though .. Should i delete all that is inside it ?
    Last edited by Killerbee; June 22, 2009 at 07:43 AM.

  18. #18
    Stephan's Avatar Campidoctor
    Join Date
    Jun 2008
    Location
    Wien
    Posts
    1,575

    Default Re: Concepts and Theories

    is it possible to have an port blocked event, that if a specific port is plocked the faction looses money

    edit: how can i add a message after an event,like the "king is dead" event in ss?
    Last edited by Stephan; June 22, 2009 at 08:44 AM.

    Yes, I know that Ishtar is spelled wrong

  19. #19

    Default Re: Concepts and Theories

    Quote Originally Posted by Stephan View Post
    is it possible to have an port blocked event, that if a specific port is plocked the faction looses money

    edit: how can i add a message after an event,like the "king is dead" event in ss?
    Would be same like garisson script afaik :

    You must use the CharacterTypeNearTile condition , in script this would look like this (watch out ! This is for RTW !) :


    Code:
    if I_CharacterTypeNearTile 'faction' admiral 1 , x, z
    
    console_command add_money 'faction' -1000
    
    end_if
    Some notes :

    the bold 'admiral' defines wich type is near wich tile .. Because it's a ship that blockades a port , it should be admiral , cause only admirals command ships

    The bold 'faction' tells the engine wich faction controls the ships that are close to your port .. if you , for instance , write in your script :

    if I_CharacterTypeNearTile hre ...blah blah...

    and there would be a French ship near your port , then the script will not trigger .

    the bold+underlined 1 tells the engine how many 'tiles' the admiral is allowed to be away from the given coörds , wich should be the coörds of your port .

    , x, z : Needs to be the exact coörds of your port

    faction : defines wich faction looses money .. Should be he faction that controls the port ..


    Note that this solution isn't "waterproof" : If there's an admiral who doesn't want to blockade your port is 1 tile away from your port , the script will still trigger ..

    Here's some info 'bout the condition from docudemons :

    Identifier: I_CharacterTypeNearTile
    Trigger requirements:
    Parameters: faction, character type, distance in squares, x, z
    Sample use: I_CharacterTypeNearTile romans_julii named_character, 10 48,30
    Description: Is a particular character type of a faction near a particular tile?
    edit: how can i add a message after an event,like the "king is dead" event in ss?
    I'm sure we'll see this in later lessons : events and messages
    Last edited by Killerbee; June 22, 2009 at 08:55 AM.

  20. #20
    Stephan's Avatar Campidoctor
    Join Date
    Jun 2008
    Location
    Wien
    Posts
    1,575

    Default Re: Concepts and Theories

    does that mean i have to write a new script for every enemy faction?

    Yes, I know that Ishtar is spelled wrong

Page 1 of 4 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
  •