Results 1 to 5 of 5

Thread: automated movement in campaign_script

Hybrid View

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

    Default automated movement in campaign_script

    Hi everyone,

    I'm new both to the forum and to MTW2 scripting. I figured many things out myself, but now I'm stuck with a question concerning the scripting:

    I want to make a scripted move action for the current faction leader on the campaign map in my campaign_script.txt
    So for instance, I have the (simplified) script:

    script


    monitor_event CharacterTurnStart IsFactionLeader
    move_character <factionleader>, 100, 200
    end_monitor



    In this case, the name of the faction leader is not known, so what do I put instead of <factionleader> to address to the character monitored by the CharacterTurnStart?

    Thanks,
    shade1331

  2. #2

    Default Re: automated movement in campaign_script

    For using the move command you need to know the name of the character otherwise it's not worth it.

  3. #3

    Default Re: automated movement in campaign_script

    That's a shame So a scripted move isn't possible when you don't know the name of the specific character?

    Is this also the case with kill_character? Cause it would be fun to script things like :
    "When random factionleader is ill he has a certain chance to die"
    You'll need to be able to refer to the faction leader for this kind of scripting.

    On another topic, I read something about using "this" when using console_commands (e.g. "give_trait this <trait>") to refer to a selected unit, but that didn't seem to work in scripting.

  4. #4

    Default Re: automated movement in campaign_script

    Quote Originally Posted by shade1331 View Post
    That's a shame So a scripted move isn't possible when you don't know the name of the specific character?
    Yes you have the right idea it's not possible without knowing the exact name for it.
    Quote Originally Posted by shade1331 View Post
    Is this also the case with kill_character?
    Yes unfortunately.
    Quote Originally Posted by shade1331 View Post
    On another topic, I read something about using "this" when using console_commands (e.g. "give_trait this <trait>") to refer to a selected unit, but that didn't seem to work in scripting.
    "This" won't work in the campaign_script.txt as for that the character should be selected first.

  5. #5
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: automated movement in campaign_script

    You can use a label instead of the name for the move command. But this probably doesn't help in your case because you can only assign a label when spawning the general (I think).

    labels work with other commands too: kill_character (I think), send_character_off_map, reposition_character, move_character. Probably others.

    "This" won't work in the campaign_script.txt as for that the character should be selected first.
    I think that you could use the select_character command but you need the name for that. And "this" doesn't work with the move command as far as I know, only some console_commands. This post links to an example of using "this" from script.
    Last edited by Withwnar; May 09, 2011 at 05:45 AM.

Posting Permissions

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