Results 1 to 30 of 82

Thread: alpaca's Script-O-Rama

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Post 2: Scripting Challenges

    Allright people, this post is for now reserved for what I'd like to call scripting challenges.
    I'll issue these from time to time to instigate research and thoughts about certain scripting problems, or simply to show off when I found out something cool and want to tell everyone how good a scripter I am

    Anyways, here we go with the first challenge:

    Scripting Challenge #1: Re-Emergent factions
    issued on May, 20th 2007

    The task is simple: Create re-emergent factions similar to those you know from the original MTW. I didn't try to do that myself, yet, so I'm not sure if it's possible. If you have a proposition, simply post it in this here thread.
    The best one will be put into the script-o-rama, and I will participate, too.

    Solution:
    alpaca


    The solution to this problem involves two basic steps. The first is to make the would-be emergent faction horde, and the second is to spawn it an army.


    1. Hording

    To make a faction horde, all you have to do is open descr_sm_factions and add some entries that look like those of the Mongols or Timurids:
    Code:
    horde_min_units				10
    horde_max_units				20
    horde_max_units_reduction_every_horde 10
    horde_unit_per_settlement_population	250
    horde_min_named_characters	2
    horde_max_percent_army_stack 80
    horde_disband_percent_on_settlement_capture	0
    horde_unit					Mongol Infantry
    horde_unit					Mongol Foot Archers
    horde_unit					Mongol Heavy Archers
    horde_unit					Mongol Heavy Lancers
    horde_unit					Mongol Light Lancers
    horde_unit					Mongol Horse Archers
    These determine what happens after your faction loses their last settlement, and more importantly, allows it to remain in the code after it died. These are pretty self-explanatory, so let's get to step 2:


    2. Army Spawning

    First of all, you'll find a how-to about spawning above, so I won't explain the code here. What you have to do to have a re-emergent faction is to spawn it an army somewhere on the map with a family member which will re-introduce them to the game. You can see a good example of that by looking at how the guys at CA OZ did it for the Mongols and Tims:
    Code:
    spawn_army 
    			faction mongols
    			character	Jebe, named character, age 30, x 292, y 166, family	;command 8, dread 9, loyalty 7, piety 1
    			traits EasternWarlord 3 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 4 , StrategyDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
    			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
    			...
    		end
    Notice the bolded "family" keyword which will allow you to set up a faction tree again.

    Ok, that's basically it. Easy, huh?
    There are two main problems with this: Firstly, you will somehow have to determine where to spawn (or move) the faction, unless you want to always spawn them in the same place and secondly, the family members will always have the same names. You can add a bit of randomization which will of course increase the complexity of the code by a fair margin.

    Well, have fun with your newly re-emerging factions




    Scripting Challenge #2: Attrition
    issued on August, 30th 2007

    This one is a very open challenge. I think a large part of the community is looking for the best way to simulate the effect that prolonged campaigns and diseases have on an army (especially a medieval one which would certainly live off the land in a very ruinous fashion). So, let's hear your suggestions! The best propositions will be put in here and if it makes sense I'll write a how-to or an article about it, combining them in some way.
    Last edited by alpaca; 08-30-2007 at 12:49.

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    From future import content

  3. #3
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Read on, nothing to see here

  4. #4
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Just one more to go...

  5. #5

    Default Re: alpaca's Script-O-Rama

    just an easy thing to do to crank up the early game difficulty a bit. remove stuff from the descr_strat file like buildings and units and then add them back in the campaign_script but AI only e.g

    Code:
            ; ---------------------
            ; start up
    
            freeze_faction_ai aztecs
    
    	if not I_LocalFaction spain
    
    		console_command create_building Leon, farms+1
    		console_command create_building Leon, port
    
    		console_command create_building Castille, garrison_quarters
    		console_command create_building Castille, bowyer
    
    		create_unit Castille, Peasant Archers, num 2, exp 0, arm 0, wep 0
    		create_unit Vaasco, Javelinmen, num 2, exp 0, arm 0, wep 0
    		create_unit Vaasco, Peasant Archers, num 2, exp 0, arm 0, wep 0
    		console_command add_money spain, 6000
    
    	end_if
    similarly add some extra rebel garrison units in the nearest cities for the player faction e.g

    Code:
    	if I_LocalFaction spain
    
    		create_unit Toledo, Peasant Archers, num 2, exp 0, arm 0, wep 0
    		create_unit Extramaduras, Javelinmen, num 2, exp 0, arm 0, wep 0
    
    	end_if
    pretty quick and easy.


    edit: just noticed on my test/mod version that adding the ports this way doesn't seem to work. the building is built in the settlement but no port on the map and no trade. i think this used to work in RTW but it must be different in MTW2. the recruitment buildings work though.
    Last edited by nikolai1962; 04-10-2007 at 07:56.
    It's not a map.

  6. #6
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: alpaca's Script-O-Rama

    Quote Originally Posted by nikolai1962
    i'll add a bit here that i use a lot when i get home :)
    Great, I'll start working on it after I tested 1.2 a bit more thoroughly. Actually primarily wanted to get some comments about the idea while I was doing that ;)

  7. #7

    Default Re: alpaca's Script-O-Rama

    This is the classic spawn_army hint, considering the fact that the docudemon explanation always stumps newbies:

    Code:
    spawn_army 
                        faction romans_julii
                        character	Foedus Chaerea, general, command 0, influence 0, management 0, subterfuge 0, age 20, , x 54, y 124
                        unit		roman generals guard cavalry,				soldiers 20 exp 9 armour 1 weapon_lvl 0
                        unit		roman legionary first cohort ii,				soldiers 40 exp 0 armour 0 weapon_lvl 0
                        unit		roman legionary cohort ii,				soldiers 60 exp 0 armour 0 weapon_lvl 0
                        unit		roman praetorian cohort i,				soldiers 60 exp 0 armour 0 weapon_lvl 0
    end
    What's changed is that there is a comma after every unit name. This comma is absent in docudemon example of spawn_army, thus causing endless crashes and headaches for those starting out.

    Great idea Alpaca, I should have a few more examples soon.
    Last edited by SigniferOne; 04-10-2007 at 22:13.

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