Results 1 to 5 of 5

Thread: Very strange problem with kill_character script command

  1. #1

    Default Very strange problem with kill_character script command

    I am working on a background script, one part of which is supposed to invoke the "kill_character" command, when triggered through an event_monitor. The problem is, that command is not invoked all the time, even though I know that the event monitor, which it is inside of, is triggered every time. The relevant code inside the monitor is:
    Code:
    console_command add_money 10000
    campaign_wait 10
    console_command kill_character "Gaius Fabricius"
    campaign_wait 10
    console_command add_money 10000
    campaign_wait 10
    I have the "add_money" commands before and after "kill_character", so that I can observe if the monitor has been invoked (when the first addition of money happens), and when the script inside the monitor has been completed (when the second addition of money happens).


    Unfortunately, if "kill_character" is in the monitor, the first batch of money is added, so I know the monitor is invoked, but the second batch is not, indicating that the script advances no further, because the character to be killed remains there as well, and the second batch of money is not added. The presence of the "kill_character" command in the event_monitor somehow arbitrarily freezes the script engine for that turn, making it unable to do anything else. However, and here's the kicker, if I just keep pressing End Turn, the monitor continues to be triggered every turn, and eventually, at some arbitrary turn later, the "kill_character" does inexplicably go through. For bunches and bunches of turns nothing happens, and then at some random next turn, the script does go through and the character is killed.

    Here's a brief explanation, in pictures.

    The campaign is started anew. My character, the diplomat "Gaius Fabricius", is standing there, and waiting dutifully:


    The script is loaded through the F1 shortcut (thanks go out to Epistolary Richard ):


    Okay, the script is now loaded, the monitor is in the memory, and the character should be killed next turn. The next turn comes:


    Nothing. Maybe next turn? Again, nothing. I keep pressing Next Turn, nothing keeps happening. Many turns later:

    Gaius is still standing there, while the script continues running in the background.

    However, I keep pressing Next Turn, and finally, many turns after the beginning of my experiment, Gaius Fabricius is inextricably killed on that and only that turn, not before:


    Can someone tell me what's going on?

    Here's the entire script that's being loaded from the beginning:
    Code:
    script
    
    	declare_counter loop
    	set_counter loop 0
    
    	monitor_event FactionTurnStart FactionIsLocal
    		;declare_show_me
    		;hide_ui
    		;disable_entire_ui
    		suspend_unscripted_advice true
    
    		console_command add_money 10000
    		campaign_wait 10
    		console_command kill_character "Gaius Fabricius"
    		campaign_wait 10
    		console_command add_money 10000
    		campaign_wait 10
    
    		suspend_unscripted_advice false
    		;enable_entire_ui
    		;show_ui
    	end_monitor
    
    	while I_CompareCounter loop = 0
    	end_while
    
    end_script
    This script, and especially the monitor, is running during each turn. The initial money is added on each turn, but nothing happens otherwise, nor is the second batch added. Then, some arbitrarily many turns later, the monitor starts operation as usual, and actually completes through.

    This is a really strange issue, which I hope someone knows how to deal with. The interesting thing with "kill_character" is that it always works outside of monitors, in direct scripts (start script, do X action, end). That always works. In monitors, the command seems to seriously falter.
    Last edited by SigniferOne; 03-12-2006 at 08:48.

  2. #2

    Default Re: Very strange problem with kill_character script command

    Try taking out the campaign_wait commands. And you can use console_command puppify_my_love to make sure the monitor is being accessed. It's more obvious than adding money.
    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

    Default Re: Very strange problem with kill_character script command

    Did I read somewhere that the cheat code for adding money to your own faction can only be used once per session? Maybe that makes your code bounce out of your monitor after the first add money?
    It's not a map.

  4. #4

    Default Re: Very strange problem with kill_character script command

    nikolai1962 you are both right and wrong at the same time. Its true that when you use add_money command in console you can use it only once, but you can use it inside script freely.

    dsyrow1 your problem are wait commands. We at EB had lot of problems with them.
    Its better not to use them inside monitors. Using them causes many strange behaviors.
    Just drop them and your code should work fine.
    Last edited by LorDBulA; 03-12-2006 at 16:18.

  5. #5

    Default Re: Very strange problem with kill_character script command

    Thanks guys, you were right, but this effect is the most weird thing. In direct (non-monitor) scripting, I've found that not having wait after every console_command introduces weird behavior.

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