Results 1 to 30 of 102

Thread: A Beginner's Guide to Scripting & Scripting "How To"s

Hybrid View

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

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Is it possible to remove random units from an army if it reaches a certain point/region? (In RTW, no expansion)
    And if this is not possible, can you add an army to the slave and make it attack the army (and disappear afterwards)

  2. #2
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Quote Originally Posted by JoristhePagan View Post
    Is it possible to remove random units from an army if it reaches a certain point/region? (In RTW, no expansion)
    not that I know of

    And if this is not possible, can you add an army to the slave and make it attack the army (and disappear afterwards)
    you can spawn a slave army - you can't make it attack unless you know the name of the general of the other army (which is unlikely) - but if you spawn it close to area and its big enough it probably will attack.

    Don't think you can make it disappear exactly - if its leader is still alive after battle you could try using the move character commands to send it off somewhere else... beware of using the non console_command move commands if you don't know if character is alive, trying to apply the other types of commands to a non-existent character can make game CTD

    if you know name of leader you can kill him and hence his bodyguard but I don't know of any way of killing other units by script.
    Not used mods before? Looking for something small and fun?!
    Download the:

  3. #3

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Ok thanks, I'll have to find another way.

  4. #4

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Here's a new idea: Can I make the rebel general invulnerable? that way, I could easily make the army is destroyed and then move it to a save location.

  5. #5

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    I seem to have a wierd problem with the following code:

    Code:
    declare_counter aedui_age
    set_counter aedui_age 11
    
    ;AI - console_command date -300 (BC)
    monitor_event FactionTurnStart Factiontype gauls
    and not I_LocalFaction gauls
    and I_CompareCounter aedui_age >= 10
    and I_TurnNumber > 1
    	set_counter aedui_age 12
    terminate_monitor
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Burdigala
    and I_SettlementOwner Burdigala = gauls
    and I_CompareCounter aedui_age = 12
    and not SettlementBuildingExists = agee2
    	console_command set_building_health Burdigala agee 0
    	console_command create_building Burdigala "agee2"
    end_monitor
    When I am using the faction gauls, the building will be created properly in the settlement.
    The problem only occurs when I am not using the faction gauls, whereby the game will always crash when the turn for the AI faction gauls start after clicking the end turn.
    I initially thought that it may not be possible to create buildings for AI factions... but the code below worked, in which the building agee1 is lower in the hierarchy than agee2 in EDB. So I'm not really sure why the code causes the game to crash and not work as expected.

    Code:
    declare_counter aedui_age
    set_counter aedui_age 11
    
    ;AI - console_command date -300 (BC)
    monitor_event FactionTurnStart Factiontype gauls
    and not I_LocalFaction gauls
    and I_CompareCounter aedui_age >= 10
    and I_TurnNumber > 1
    	set_counter aedui_age 11
    terminate_monitor
    end_monitor
    
    monitor_event SettlementTurnStart SettlementName Burdigala
    and I_SettlementOwner Burdigala = gauls
    and I_CompareCounter aedui_age = 11
    and not SettlementBuildingExists = agee1
    	console_command set_building_health Burdigala agee 0
    	console_command create_building Burdigala "agee1"
    end_monitor
    Next, I tried working around the crash by inserting one additional line to building creation code as shown below. The game did not crash like before, but the building agee2 failed to be created. Then I tested it out with agee6 and it worked only for a certain settlement, i.e. rest of the settlements do not have the building agee6 created despite the code being executed.

    Code:
    monitor_event SettlementTurnStart SettlementName Burdigala
    and I_SettlementOwner Burdigala = gauls
    and I_CompareCounter aedui_age = 12
    and not SettlementBuildingExists = agee2
    	console_command set_building_health Burdigala agee 0
    	console_command create_building Burdigala "agee1"
    	console_command create_building Burdigala "agee2"
    end_monitor
    The building levels are as follows:
    building agee
    {
    levels agee1 agee2 agee3 agee4 agee5 agee6 agee7 agee8
    {
    ...
    Last edited by lim_lucky; 12-31-2009 at 23:26.

  6. #6

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Quote Originally Posted by lim_lucky View Post
    Next, I tried working around the crash by inserting one additional line to building creation code as shown below. The game did not crash like before, but the building agee2 failed to be created. Then I tested it out with agee6 and it worked only for a certain settlement, i.e. rest of the settlements do not have the building agee6 created despite the code being executed.
    ...
    The additional line did not prevent the crashes, instead, it seems like that the game crashed only for some factions. Does someone have any advice? I have tried using factions { all, } in EDB but game still crashed.

  7. #7
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    have you tried it without the

    console_command set_building_health Burdigala agee 0

    line? that doesn't actually destroy the building just damages it 100%
    when you add new building from script it gives settlement both buildings, despite fact they are in same tree. So maybe AI's attempt to repair old building at same time as getting new building is what is causing problem?

    Do you have enough spare building trees to split them up to prevent weirdness in the same tree?

    If its not that and its only related to certain factions / cultures check for missing EB texts for certain factions, or if its related to Carthaginian new building problem.
    Not used mods before? Looking for something small and fun?!
    Download the:

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