Results 1 to 9 of 9

Thread: Now it works, now it doesn't?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Now it works, now it doesn't?

    This is one for the puzzle friends:

    The problem
    A command (add_event with historic) refuses to fire in a particular mod set up

    The irritant
    The very same command fires in any other mod. The army spawns, the tile gets uncovered, the radar restriction gets removed. If I use the historic_event method (remmed out here) it works.
    For this particular event I need the locator button, historic_event does not allow that.

    The progress so far
    I checked the script by copying it into my Bare Geomod set, adjusting coordinates and unit names, adding the historic_event file. Works like a charm.
    Then I replaced all files in Bare Geomod with files from the mod (inclusive the original script), added descr_mount and modeldb for playability. Script doesn't work

    Possible source of problem
    The mod in question has other peculiar problems as well. The SD files do not generate properly (had to generate them using Bare Geomod). Very high rate of artifacts on the strat map when scrolling (rivers had to be removed in map_features). My fear is, that the size of the map (max size) is the root of all these problems. But on the other hand that should only apply to the artifact problem, not to the SD and script problem.

    The script
    Spoiler Alert, click show to read: 
    Code:
    script
    
        restrict_strat_radar false
    
    monitor_event FactionTurnStart FactionIsLocal
            and I_TurnNumber > 0 ;5
    
            campaign_wait 1
    
            add_events
                event    historic    schwed_statisch_movie
                date    0
                position    299, 368
                movie    event/schwed_statisch_movie.bik ;same name as text in historic_events
            end_add_events
    
    ;        historic_event    schwed_statisch_movie    event/schwed_statisch_movie.bik
    
            reveal_tile 299, 368
    
            spawn_army 
                faction england
                character    random_name, named character, age 45, x 299, y 368
                traits GoodCommander 2 , Intelligent 1 , ReligionStarter 1 
                unit        1648 Bodyguard        exp 0 armour 0 weapon_lvl 0
    ; removed 19 units for display's sake
            end
    
        terminate_monitor
    end_monitor
    
    wait_monitors
    
    end_script


    The plea
    Any input or idea is welcome on how to approach the problem.
    This is a WIP of an unreleased mod, so a link to the modified Bare Geomod setup can be given to the serious problem solvers with the request of keeping details of the setup confidential.
    Last edited by Gigantus; December 06, 2010 at 10:45 PM.










  2. #2

    Default Re: Now it works, now it doesn't?

    Gig why not split the script in half while the other half is executed via counter when the first one fires.
    I say this coz of multiple commands being fired in one small script.
    Just a thought.

  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Now it works, now it doesn't?

    I can try that, but my hopes are not high due to the fact that it fires without problem in a regular mod.

    To test your theory all I have to do is to remove all the other stuff (army, radar, tile) and simply run it.

    Edit: One step closer! The script below works, but is of no use as I can't set a condition.

    Code:
    script
    
        restrict_strat_radar false
    
    monitor_event FactionTurnStart FactionIsLocal
    
            add_events
                event    historic    schwed_statisch_movie
                date    0
                position    299, 368
                movie    event/schwed_statisch_movie.bik ;same name as text in historic_events
            end_add_events
    
        terminate_monitor
    end_monitor
    
    wait_monitors
    
    end_script
    - Adding the condition: and I_TurnNumber > 0 stops the event from executing (radar restriction disappears)

    - Replacing the monitor_event line by: monitor_conditions I_TurnNumber > 0 stops the event from executing (radar restriction disappears)
    Last edited by Gigantus; December 07, 2010 at 02:35 AM.










  4. #4

    Default Re: Now it works, now it doesn't?

    Have you tried it with,
    monitor_event PreFactionTurnStart FactionIsLocal ?
    and then add your condition...

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

    Default Re: Now it works, now it doesn't?

    I think FactionIsLocal is not needed if your event fires for all factions.

    Maybe try:

    monitor_event FactionTurnStart I_TurnNumber => 1

    Quote Originally Posted by Gigantus View Post
    Possible source of problem
    The mod in question has other peculiar problems as well. The SD files do not generate properly (had to generate them using Bare Geomod). Very high rate of artifacts on the strat map when scrolling (rivers had to be removed in map_features). My fear is, that the size of the map (max size) is the root of all these problems. But on the other hand that should only apply to the artifact problem, not to the SD and script problem.
    Umm.. Is this like 'extreme modding'? Just thinking perhaps you could do with fixing the problems, or starting again, before adding anything Your choice though
    Last edited by Taiji; December 07, 2010 at 01:32 PM.

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Now it works, now it doesn't?

    Quote Originally Posted by Taiji View Post
    Umm.. Is this like 'extreme modding'? Just thinking perhaps you could do with fixing the problems, or starting again, before adding anything Your choice though
    It is 'extreme modding' - I could do a simple workaround by using the historic_event way and use a Yes\No event that asks if you want to go to the event location, but that is not the idea behind the thread.

    My question simpler put: does anyone have an idea what might cause the problem of this mod? The initial script works in any other mod, just not in this one. The mod is nearly finished, so changing the size of the map (happily I can wash my hands of this one) would mean endless hours of script work. (250 armies, 500 resources, script co-ordinates)

    I will still try all suggestions.


    Edit: results so far
    It appears that as long as there is no additional condition or command the add_event command fires correctly. I will try to use I_CompareCounter in the monitor line - that way I can still use the add_event command (simply create the counter condition first in another monitor).

    Edit2: I_CompareCounter doesn't work either in the monitor line

    Code:
    declare_counter sample_counter
    set_counter sample_counter 1
    
    monitor_event FactionTurnStart I_CompareCounter sample_counter > 0
    
            add_events
                event    historic    schwed_statisch_movie
                date    0
                position    299, 368
                movie    event/schwed_statisch_movie.bik
            end_add_events
    
        terminate_monitor
    end_monitor
    Guess it will have to be the hard way: Yes/No historic_event with snap to the co-ordinates on 'Yes'
    Hopefully I can find a workaround for the other add_event entries (haven't checked yet, maybe they work, pleeeease....)


    Edit3: the final (?) solution

    Code:
    script
    
        restrict_strat_radar false
    
    monitor_event FactionTurnStart FactionIsLocal
        and I_TurnNumber => 0
    
            campaign_wait 1
    
            historic_event    schwed_statisch_movie    true    event/schwed_statisch_movie.bik
    
            reveal_tile 299, 368
    
            spawn_army 
                faction england
                character    random_name, named character, age 45, x 299, y 368
                traits GoodCommander 2 , Intelligent 1 , ReligionStarter 1 
                unit        1648 Bodyguard        exp 0 armour 0 weapon_lvl 0
            end
    
        terminate_monitor
    end_monitor
    
    monitor_event EventCounter EventCounterType schwed_statisch_movie_accepted
        and I_EventCounter schwed_statisch_movie_accepted == 1
    
            snap_strat_camera 299, 368
    
        terminate_monitor
    end_monitor
    
    wait_monitors
    
    end_script
    It has a small drawback: the window disappears when you click either of the options.

    .
    Last edited by Gigantus; December 07, 2010 at 11:22 PM.










  7. #7
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Now it works, now it doesn't?

    As an afterthought: do I need an add_event thingy for the accept and decline counters? The above (last) script would suggest not.
    Those are the only other add_event entries that I have. Something like the example below shouldn't be necessary, or?

    Code:
    if I_CompareCounter russia_turn == 1
                        add_events
                        event event_counter accept_decline_krabat_accepted
                        event event_counter accept_decline_krabat_declined
                        date 0
                        end_add_events
            campaign_wait 1
            historic_event accept_decline_krabat true
    end_if
    Last edited by Gigantus; December 07, 2010 at 11:33 PM.










  8. #8

    Icon1 Re: Now it works, now it doesn't?

    Gigantus: You should only need to do this:
    Code:
    if I_CompareCounter russia_turn == 1
            historic_event krabat true
    end_if
    Code:
    	monitor_event FactionTurnStart FactionIsLocal
    		and I_TurnNumber => 0
    		campaign_wait 1
                    historic_event schwed_statisch_movie true event/schwed_statisch_movie.bik
            	reveal_tile 299, 368
            spawn_army 
                faction england
                character    random_name, named character, age 45, x 299, y 368
                traits GoodCommander 2 , Intelligent 1 , ReligionStarter 1 
                unit        1648 Bodyguard        exp 0 armour 0 weapon_lvl 0
            end
        	terminate_monitor
    	end_monitor
    
    	monitor_conditions I_EventCounter schwed_statisch_movie_accepted = 1
           	 	snap_strat_camera 299, 368
        	terminate_monitor
    	end_monitor

  9. #9
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Now it works, now it doesn't?

    Thanks for confirming my suspicion, guess that was a left over from my starting days as a scripter.
    In case you were wondering about the 'campaign_wait' entry --> I do that before an event message in case the regular events pile up in the game. That way I can be assured that my custom event gets displayed properly.










Posting Permissions

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