Results 1 to 12 of 12

Thread: Scripting character attack settlement?

Hybrid View

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

    Default Scripting character attack settlement?

    Is it possible for someone to show me how to set a character spawned as part of an emergent faction to attack a specific settlement?
    Eg; emergent faction norway, character Haakon Haakonsson, to attack Oslo.
    Any help very welcome.

  2. #2
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting character attack settlement?

    Code:
    siege_settlement
    attacking_character, settlement_name [,maintain|attack]
    Instruct the character to siege the settlement
    siege_settlement Gaius Julius, Rome, attack
    SIEGE_SETTLEMENT

  3. #3

    Default Re: Scripting character attack settlement?

    I've got this working a treat now, thanks GrnEyedDvl! Norway emerge near Oslo, first army beseiges and second assaults, Fantastic!
    + rep
    For my next step I would like the Tuetonic Order to emerge when the first crusade is called. Any more guidence?

  4. #4
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Scripting character attack settlement?

    Note that if the faction is hording it won't necessarily settle down after capturing the settlement (this is slightly irrelevant to this topic but it should be here for people searching the forums I think).

    As for your second question: Make a monitor_event which triggers on the CrusadeCalled event, spawn the teutons like normal, then terminate_monitor in the last line of the monitor (terminate_monitor removes the thing from the memory so it won't trigger again for each crusade)

    No thing is everything. Every thing is nothing.

  5. #5

    Default Re: Scripting character attack settlement?

    Thanks alpaca, I'm using the declare_counter declarar_guerra I found in another tutorial, and although I've got this working perfectly, I must confess that I dont actually understand the second part 'declarar_guerra'. I would be gratefull if someone could explain the meaning of the term.

  6. #6
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting character attack settlement?

    Its just a variable name. A counter is a place to store a numeric value and reference it later. You can name them whatever you want.

    declare_counter new_counter
    declare_counter pick_a_name

    This tells the game you are creating new counters, one called new_counter, one called pick_a_name.

    set_counter new_counter 5
    set_counter pick_a_name 10

    This tells the game to change the value of new_counter to 5 and the value of pick_a_name to 10.

    Then you can compare the values of the counters.

    if I_CompareCounter new_counter = 5
    and I_CompareCounter pick_a_name = 10
    do some stuff
    end_if

  7. #7

    Default Re: Scripting character attack settlement?

    That helps a lot. But I'm struggling to get the TO to emerge when the crusade is called. Could you scripting guru's check out where I'm going wronge?
    Spoiler Alert, click show to read: 

    monitor_event crusade_called

    add_events
    event emergent_faction teutonic_order
    date 0
    region Halych_Province
    end_add_events
    spawn_army
    faction teutonic_order
    character Gunther von Schwarzenburg, named character, age 37, x 390, y 149, family, portrait gunther,
    traits GoodCommander 2 , PublicFaith 1 , BattleChivalry 4 , ReligionStarter 1
    unit TO Bodyguard exp 3 armour 0 weapon_lvl 0
    unit Order Spearmen exp 0 armour 1 weapon_lvl 0
    unit Order Spearmen exp 0 armour 1 weapon_lvl 0
    unit Clergymen exp 0 armour 1 weapon_lvl 0
    unit Clergymen exp 0 armour 1 weapon_lvl 0
    unit Christ Knights exp 0 armour 0 weapon_lvl 0
    unit Prussian Archers exp 0 armour 1 weapon_lvl 0
    unit Prussian Archers exp 0 armour 1 weapon_lvl 0
    end
    spawn_army
    faction teutonic_order
    character Maximillian, named character, age 21, x 390, y 150, family, portrait maximillian,
    traits LoyaltyStarter 1 , GoodCommander 1 , HaleAndHearty 1 , ReligionStarter 1
    unit TO Bodyguard exp 1 armour 0 weapon_lvl 0
    unit Order Militia exp 0 armour 1 weapon_lvl 0
    unit Order Militia exp 0 armour 1 weapon_lvl 0
    unit Order Militia exp 0 armour 1 weapon_lvl 0
    unit Peasant Archers exp 0 armour 1 weapon_lvl 0
    unit Peasant Archers exp 0 armour 1 weapon_lvl 0
    end
    console_command diplomatic_stance teutonic_order lithuania war
    terminate_monitor
    end_monitor

  8. #8
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting character attack settlement?

    You dont have a condition after your event.
    Code:
    monitor_event crusade_called
    You need to have a condition as well.
    Code:
    monitor_event CrusadeCalled TargetSettlementName Jerusalem

  9. #9

    Default Re: Scripting character attack settlement?

    This is still giving me problems...
    Spoiler Alert, click show to read: 

    monitor_event CrusadeCalled TargetSettlementName Vilnius
    add_events
    event emergent_faction teutonic_order
    date 0
    region Halych_Province

    end_add_events

    spawn_army
    faction teutonic_order
    character Gunther von Schwarzenburg, named character, age 37, x 390, y 149, family, portrait gunther,
    traits GoodCommander 2 , PublicFaith 1 , BattleChivalry 4 , ReligionStarter 1
    unit TO Bodyguard exp 3 armour 0 weapon_lvl 0
    unit Order Spearmen exp 0 armour 1 weapon_lvl 0
    unit Order Spearmen exp 0 armour 1 weapon_lvl 0
    unit Clergymen exp 0 armour 1 weapon_lvl 0
    unit Clergymen exp 0 armour 1 weapon_lvl 0
    unit Christ Knights exp 0 armour 0 weapon_lvl 0
    unit Prussian Archers exp 0 armour 1 weapon_lvl 0
    unit Prussian Archers exp 0 armour 1 weapon_lvl 0
    end

    spawn_army
    faction teutonic_order
    character Maximillian, named character, age 21, x 390, y 150, family, portrait maximillian,
    traits LoyaltyStarter 1 , GoodCommander 1 , HaleAndHearty 1 , ReligionStarter 1
    unit TO Bodyguard exp 1 armour 0 weapon_lvl 0
    unit Order Militia exp 0 armour 1 weapon_lvl 0
    unit Order Militia exp 0 armour 1 weapon_lvl 0
    unit Order Militia exp 0 armour 1 weapon_lvl 0
    unit Peasant Archers exp 0 armour 1 weapon_lvl 0
    unit Peasant Archers exp 0 armour 1 weapon_lvl 0
    end

    console_command diplomatic_stance teutonic_order lithuania war

    terminate_monitor
    end_monitor


    Now I'm getting a CTD when the event should trigger. unspecified error...

    #Edit. Ok I removed the add_event and it worked fine. I assumed the emergent_faction was generic and could be used by any faction.

    PS is there any way to change the condition so that any crusade target will set the trigger?
    Last edited by Eothese; July 23, 2008 at 03:05 PM.

  10. #10
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Scripting character attack settlement?

    You have to set the faction as emergent in descr_sm_factions I think.

    Try:
    monitor_event CrusadeCalled TrueCondition

  11. #11

    Default Re: Scripting character attack settlement?

    Quote Originally Posted by GrnEyedDvl View Post
    You have to set the faction as emergent in descr_sm_factions I think.
    That makes perfect sense, but caused a CTD when I tried it.

    The TrueCondition works though.

    Thanks!

  12. #12

    Default Re: Scripting character attack settlement?

    Quote Originally Posted by GrnEyedDvl View Post
    You have to set the faction as emergent in descr_sm_factions I think.
    Ok I've got this working, you dont need the faction set as spawned on event, but you do need the appropriate entry in the text/historic_events.txt

    Its good to finally get things straight.

Posting Permissions

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