Results 1 to 19 of 19

Thread: Ask for help

Hybrid View

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

    Default Ask for help

    This is a part of script calling the bulgarian uprising:

    PHP Code:
    monitor_event FactionTurnStart FactionIsLocal
        
    if I_CompareCounter miasto_zdobyte 1
            generate_random_counter bunt_bulgarow 1 6
        end_if
    end_monitor 
    and second one:
    PHP Code:
    monitor_event FactionTurnEnd FactionIsLocal
        
    and I_CompareCounter bunt_bulgarow 1
            
    and I_SettlementOwner Sofia byzantium
                historic_event start_bunt_bulgaria true

        spawn_army
    (...)
        
    end

            siege_settlement Aleksei
    Sofiaattack
            set_counter siege_sofia 1
    end_monitor 
    Log, as usually, says nothing.

    Unfortunately it doesn't work. Historic_event is an indicator of efficiency of the code. I give it for each of levels of the script. If script does work - historic_event shows me an info if doesn't - i have no info.
    In this case i have no info, so i suppose there is a problem connected with exporting the value of the event to the next level of the script.
    I would like to ask someone wise to check it and advise me what need i change to make this script operational.

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

    Default Re: Ask for help

    Remove the true line from the historic event. It gives a yes/no event and that requires IIRC some counters

  3. #3

    Default Re: Ask for help

    Yes/no is not enough for me. As you can see in first part of cited code, the random counter is is from 1 to 6, where each number represents a different region (in this case "1" means Corinth vel Morea, where uprising is going to start).
    Last edited by attyla; November 26, 2011 at 09:32 AM.

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

    Default Re: Ask for help

    Attyla, what is the script supposed to do? (you realise you have a 1 in 6 chance of it firing the event yes?)

    Killersmurf, it generates event counters by itself, all historic events need is text in \text\historic_events.strings.bin

  5. #5

    Default Re: Ask for help

    This part of script should draw the region where the uprising would rise. I'm planning that the uprising should rise in one from six specific regions.
    Last edited by attyla; November 26, 2011 at 10:14 AM.

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

    Default Re: Ask for help

    Killersmurf, it generates event counters by itself, all historic events need is text in \text\historic_events.strings.bin
    So those aren't necessary? Thanks for the info

  7. #7

    Default Re: Ask for help

    So generate_random_counter is not proper command to achieve my goal? What about random_counter_inc?
    I need a command that would choose a random number from the given scope.

  8. #8

    Default Re: Ask for help

    I think "generate_random_counter" sets and "event counter"
    so
    Code:
    monitor_event FactionTurnEnd FactionIsLocal 
        and I_EventCounter bunt_bulgarow = 1 
            and I_SettlementOwner Sofia = byzantium 
                historic_event start_bunt_bulgaria true 
    
        spawn_army 
    (...) 
        end 
    
            siege_settlement Aleksei, Sofia, attack 
            set_counter siege_sofia 1 
    end_monitor  
    Should work,
    few notes though:
    1) Is there a reason you're using 2 ( or 7 depending on how you wrote it) monitors ? You can put it all into 1,
    2) There is nothing to prevent the event from running over and over again.

  9. #9

    Default Re: Ask for help

    I'm completly confused. I didn't know, that there is so big difference between I_CompareCounter and I_EventCounter. Great thanks - it works fine now.

    Ps. Do not worry about looping the script. I use command inc_counter

  10. #10

    Default Re: Ask for help

    Yeah it's a pretty important difference, They are very similar but totally different at the same time

    "counters" have to be declared before you can use any of the command for them;
    declare_counter BlaBla
    and have the following commands:
    I_CompareCounter
    inc_counter
    set_counter

    "event_counters" don't require declaring
    they have following options
    I_EventCounter
    inc_event_counter
    set_event_counter
    generate_random_counter

    They are also the ones you refer to in the EDB etc
    aswel as automatically change when an historic event triggers ( e.g. the historic event GUNPOWDER will increase the event_counter named GUNPOWDER by 1) regardless of how you trigger the event ( via campaign script or vie event.txt

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

    Default Re: Ask for help

    Stick this in there somewhere:

    and ! I_CharacterExists Aleksei

    That should solve it.

  12. #12

    Default Re: Ask for help

    1. Sofia is just one of the possible locations of the uprising.
    2. Aleksei will not "live" forever
    3. i have 5 other places where uprising may rise and 5 other generals who wait to be spawned by this script.

    I thought that command inc_counter increases value of the event by one per turn. Is it true? If it is i'm confused because script doesn't work if i give as a condition the value 2 for example. I thought too that if i will use inc_value, the condition I_EventCounter will find value "1" one only.
    So there is a question: how can i make a condition which lets the script run any command by given value and how can i make a script lets run another script only one time during given account of turns?

  13. #13
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Ask for help

    Nothing built in but you can create a counter in your script and increase it every turn after the event has occurred.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  14. #14

    Default Re: Ask for help

    How to make it? Did you make something like this?

  15. #15

    Default Re: Ask for help

    It's likely that the problem is solved. It was enough to add the line
    PHP Code:
    set_counter miasto_zdobyte 0 
    by line
    generate_random_counter bunt_bulgarow 1 6
    It's time to test it now

Posting Permissions

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