Page 3 of 3 FirstFirst 123
Results 61 to 82 of 82

Thread: alpaca's Script-O-Rama

  1. #61
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: alpaca's Script-O-Rama

    Maybe you have some more ingenious idea's Alpaca, I'm "thinking" about adding some sort of "check up starting factions capital and spawn reinforcements if under siege/lost settlement"

    but the lack in at least seeing a decent method is preventing me from putting much effort into it.

    I'd like to check up on a siege, but thats lacking as spies/siege-engines can prevent any turns on siege, I mean the player has the ability to take settlements within the same turn as he/she started the siege.

    Doing it with settlementcaptured has the problem (afaik!) of needing the other 2 commands as well (sacked/exterminated) in order to be truely able to tell if a settlement is taken.

    Last would possibly be to just have an event+monitor to check up on the ownership of a settlement, this would imo be the way to go, but than again the method I'd favour least as it could mean I'm just spawning a "late army" (I'd rather have them spawn in before the settlement is lost and than prevent a second spawning untill at least no earlier than next siege, terminating the monitor if the settlement is ever lost)

    any thoughts or suggestions?


    G

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

    Default Re: alpaca's Script-O-Rama

    I'm not exactly sure what you'd like to do. The "canonical" way to make a garrison script is using monitor_conditions I_SettlementUnderSiege

  3. #63
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: alpaca's Script-O-Rama

    was assuming that that might be bypassed by using like a spy and have hime open the gates within the turn you start the siege, guess I'll have to play a bit more with the commands ..:)


    G

  4. #64
    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 Red Spot
    was assuming that that might be bypassed by using like a spy and have hime open the gates within the turn you start the siege, guess I'll have to play a bit more with the commands ..:)


    G
    No, monitor_conditions are "real-time", i.e. they have a kind of heartbeat which calls them every so and so often (some fraction of a second usually). So it'll trigger immediately when you initiate the siege, spy or no spy.

  5. #65
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: alpaca's Script-O-Rama

    have started an effort in making some sort of garrison-script, but stumbled upon a few problems ..

    -settlementturnstart/end doesnt just trigger once per turn it seems, more like 5 times a turn (rather annoying, but can be avoided)

    more of a problem;
    -create unit is rather bugged, in that if you spawn more units than the settlement can hold it no longer works, but there is no way (that I know of) to check up on the existing garrisons size or free slots


    do you by any chance have encountered this as well Alpaca, perhaps have a solution for it
    I know the AI generally has few enough units in a settlement to easilly be able to spawn a few units but without checking up on it knowing it can bugger up my game I'd rather not do it at all ...


    edit;
    I've created a bit of a work around that also doesnt make my campaign-script less .. er .. "spawn-ish" .. :)

    It simply sets an event counter if a faction is under siege somewhere and than give them some additional recruitment pools when the event is triggered, hopefully making it look more as if a faction rallies additional troops in defence of the besieged settlement.
    You'll see the player also gets this ability the first time he/she is besieged for a single turn, this is just cause I like to terminate unused monitors instead of leaving them idle :)
    Code:
    	monitor_event FactionTurnStart FactionType england
    		and I_EventCounter faction_england_besieged == 0
    		and I_FactionBesieged england
    
    		set_event_counter faction_england_besieged 1
    
    		if I_LocalFaction england
    			terminate_monitor
    		end_if
    	end_monitor
    
    	monitor_event FactionTurnEnd FactionType england
    		and I_EventCounter faction_england_besieged == 1
    		and not I_FactionBesieged england
    
    		set_event_counter faction_england_besieged 0
    
    		if I_LocalFaction england
    			terminate_monitor
    		end_if
    	end_monitor

    G
    Last edited by Red Spot; 08-30-2007 at 12:37.

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

    Default Re: alpaca's Script-O-Rama

    Why do you want to spawn more than a full garrison? That's a bit much if you ask me
    Checking the number of units in a garrison won't work well unfortunately as you'd have to check every unit type in each settlement separately.

    SettlementTurnEnd triggers once for each settlement, when it ends its turn (which is just before the FactionTurnEnd).

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

    Default Re: alpaca's Script-O-Rama

    A new challenge has been called:


    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.

  8. #68
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: alpaca's Script-O-Rama

    just spawning 3 units, but was testing "what would happen if .." scenario's.

    figured there might always be the odd chance of somehow you overspawning a bit, of if 1 unit/turn is spawned in a sieged settlement but the siege takes 8-ish turns ... etc etc ...


    turns out, as fas as I've tested, that that specific monitor adjusts the spawning to a number of units it can spawn.
    so if you set a monitor to spawn a full 20 unit army at an empty settlement it would fully spawn, but with 10 units garrisoned it will only spawn 10 units, if you now would remove all 20 units (10 + 10spawned), the monitor adjusted the command and will now even though it can spawn 20 units only spawn 10 units
    leave like 15 units and the monitor wont only spawn only 5 units but again adjust itself to max 5 units, it will go down but wont go back up!!

    Edit;
    in reply to your challange, I've set up a chain of plague event throughout my campaign, not like the mayor one in vanilla but a sweaping sort of plague that every 5-6 years (10-12turns) causes one in a settlement like 3 regions away from the previous outbreak, causing mayor powerswings and such
    Imo does somewhat what your asking for, but has little to do with scripting.


    G
    Last edited by Red Spot; 08-30-2007 at 12:56.

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

    Default Re: alpaca's Script-O-Rama

    That so?

    Anyways, if you don't want the player to get the thing at all, you can use the terminate_monitor before executing any code. On termination, the monitor will immediately break and not finish to execute iirc.

    Edit:
    in reply to your challange, I've set up a chain of plague event throughout my campaign, not like the mayor one in vanilla but a sweaping sort of plague that every 5-6 years (10-12turns) causes one in a settlement like 3 regions away from the previous outbreak, causing mayor powerswings and such
    Imo does somewhat what your asking for, but has little to do with scripting.
    I wouldn't exactly call that an attrition script. It doesn't specifically affect armies and in fact does quite the opposite: encourage the player to stay outside the settlement.

    Edit2: Funny discovery about the create_unit. In that case you probably want to use a number of different create_unit commands which only spawn one unit each.
    Last edited by alpaca; 08-30-2007 at 13:05.

  10. #70
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: alpaca's Script-O-Rama

    I've tried that, got the impression you where saying that a create unit command with amount "1" wouldnt be adjusted downward, but that doesnt seem the case.

    I've thought about making a monitor for each of my "armour era's" (in my game every level of armour has to be invented like gunpowder) but all that means is that after 20-ish turns in a new era the reinforcements may spawn again..

    Anyway I've got some other way of working slightly around the situation and have also found out that reloading the campaign(save) "fixes" the monitor again ...


    G

  11. #71
    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 Red Spot
    I've tried that, got the impression you where saying that a create unit command with amount "1" wouldnt be adjusted downward, but that doesnt seem the case.

    I've thought about making a monitor for each of my "armour era's" (in my game every level of armour has to be invented like gunpowder) but all that means is that after 20-ish turns in a new era the reinforcements may spawn again..

    Anyway I've got some other way of working slightly around the situation and have also found out that reloading the campaign(save) "fixes" the monitor again ...


    G
    Yeah I was thinking just that. Weird stuff. Maybe the console_command create_unit works better? I think it uses almost the same syntax (but probably also the same code).

    create_unit <settlement/character_name> <unit_id> <opt:how_many> <opt:exp/armour/weapon>

  12. #72
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: alpaca's Script-O-Rama

    so basicly just add "console_command" in front of it ..??

    from;
    create_unit London, Armored Sergeants, num 2, exp 0, arm 0, wep 0

    to;
    console_command create_unit London, Armored Sergeants, num 2
    (to start without armour/weapon upgrades)

    will try, thanks ;)

    ps; something that might be interesting, nothing special may just save others the time to test it, a little code for being able to set a flag in EDB when crusades are active;
    Code:
    	monitor_event CrusadeCalled IsCrusade
    
    		set_event_counter crusade_active 1
    	end_monitor
    
    	monitor_event CrusadeEnds IsCrusade
    
    		set_event_counter crusade_active 0
    	end_monitor
    (change "IsCrusade" to "IsJihad" for Jihads ...)


    Edit;
    just tried the console command thingy, worked like a charm!!

    the formatting is diffirent;
    console_command create_unit London "Feudal Knights" 8 1 1 1

    numbers represent the same as with the regular command, though the number of units, in the example 8, is capped at 5 units
    the good thing is that it does not adjust itself downwards, it spawns what it can and than when it can again the full number (of max 5 units)


    G
    Last edited by Red Spot; 08-31-2007 at 13:29.

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

    Default Re: alpaca's Script-O-Rama

    Ok good, one problem less.

    As for the current challenge: Don't try anything with reduce_unit_strength. Unfortunately it freezes the game.

  14. #74

    Default Re: alpaca's Script-O-Rama

    The only idea I recall being mooted to represent Attrition was to make every unit a general's bodyguard (i.e. add the general_unit attribute to them in edu) as the size of bodyguards can be controlled in the trait files.

    The drawbacks to such an idea though are heavy as you would lose the unit picture, and as soon as each unit 'captain' died the entire unit would be gone. Might work for a small scale mod with not many units, but a lot of 'character', but certainly not suitable for the standard, larger scale mods people make.
    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

  15. #75
    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 Epistolary Richard
    The only idea I recall being mooted to represent Attrition was to make every unit a general's bodyguard (i.e. add the general_unit attribute to them in edu) as the size of bodyguards can be controlled in the trait files.

    The drawbacks to such an idea though are heavy as you would lose the unit picture, and as soon as each unit 'captain' died the entire unit would be gone. Might work for a small scale mod with not many units, but a lot of 'character', but certainly not suitable for the standard, larger scale mods people make.
    Hey ER, nice of you to stop by

    Aye, I pondered the option, too. In addition to what you mentioned I imagine it would seriously slow the game down because triggers like CharacterTurnEnd would have to be checked for each unit on the map (which is about the number of characters times 20)

    The current "canonical" way of doing it is like in EB to limit movement rates and morale.

    I had a quite nice idea what could be done but what I mentioned above kind of ruined it. You could still randomly kill off whole units but that's not a very attractive option, either.

  16. #76
    EB Traitor Member BozosLiveHere's Avatar
    Join Date
    Jan 2006
    Location
    Uqbar, Tlön
    Posts
    3,662

    Default Re: alpaca's Script-O-Rama

    ER said that there is a destroy_unit command in Kingdoms, maybe now the problem will become trivial.

  17. #77
    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 BozosLiveHere
    ER said that there is a destroy_unit command in Kingdoms, maybe now the problem will become trivial.
    Which problem? Being able to destroy buildings doesn't help us in the least with attrition

  18. #78

    Default Re: alpaca's Script-O-Rama

    destroy_unit - but as you mentioned that takes out an entire unit rather than reducing the number of men in a unit (which would be the desired result).
    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

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

    Default Re: alpaca's Script-O-Rama

    Whoops sorry I was overjoyed at the prospect of being able to destroy buildings so I misread it

  20. #80

    Default Re: alpaca's Script-O-Rama

    Re-Emergent factions
    I realize this thread (on this site at least) is pretty much dead, but I figured I'd still put this out there.

    A problem (depending on the intentions of the script writer of course) with your solution is that a random horde will spawn when the last city is captured if any family member still lives.

    If you only want your scripted army to appear at your designated time change
    horde_min_units 10
    horde_max_units 20
    horde_max_units_reduction_every_horde 10
    horde_min_named_characters 2
    to
    horde_min_units 0
    horde_max_units 0
    horde_max_units_reduction_every_horde 0
    horde_min_named_characters 0
    I'm not sure if they all have to be 0, but I know this works.
    This way the faction will die normally, but still remain in the code to be revived at a later date.

    This will record as an error in the log
    14:56:45.739 [script.err] [error] Script Error in medimod/data/descr_sm_factions.txt, at line 22, column 32
    file: "descr_sm_factions.txt": horde_min_units should be nonzero!
    but otherwise causes no problems.

    It is also a good idea to script in neutrality with all factions at the point of death as, because they are still present, thier relations (stance and faction standing) prior to death is still remembered by other AI factions. Thus, if you kill a factions you will always be considered 'AtWar' with them even though they are dead. This also causes some complications on re-birth as the horde AI is uncontrolable and will not consider previous relations until a setlment is occupied.

  21. #81
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: alpaca's Script-O-Rama

    Just in case it is useful for somebody, I report here a method to start the campaign in the middle of the initial year, instead of at the beginning.

    Let's say we want a 12 turns per year campaign, but it must start in September of 1212.

    We use alpaca's script modified in this way:
    Code:
    declare_counter season_counter
    		set_counter season_counter 9
    
    monitor_event FactionTurnStart FactionIsLocal
    	inc_counter season_counter 1
    	
    	; 0 equals winter
    	if I_CompareCounter season_counter == 0
    		console_command season winter
    	end_if
    	if I_CompareCounter season_counter > 0
    		console_command season summer
    	end_if
    	; Reset the counter on the autumn turn so that it'll be 0 next turn
    	if I_CompareCounter season_counter == 11
    		set_counter season_counter -1
    	end_if
    end_monitor
    But the year (seen using show_hud_date = true configuration option) will change in turn 12, not in turn 4. For this purpose we must add new options:
    Code:
    declare_counter season_counter
    		set_counter season_counter 9
    declare_counter year_counter
    		set_counter year_counter 0
    
    monitor_event FactionTurnStart FactionIsLocal
    	inc_counter season_counter 1
    	
    	; 0 equals winter
    	if I_CompareCounter season_counter == 0
    		console_command season winter
    	end_if
    	if I_CompareCounter season_counter > 0
    		console_command season summer
    	end_if
    	; Reset the counter on the autumn turn so that it'll be 0 next turn
    	if I_CompareCounter season_counter == 11
    		set_counter season_counter -1
    	end_if
    
    		if I_CompareCounter season_counter == 0
    			inc_counter year_counter 1
    		end_if
    
    		if I_CompareCounter year_counter == 1
    			console_command date 1213
    		end_if
    
    		if I_CompareCounter year_counter == 2
    			console_command date 1214
    		end_if
    ; more lines are needed depending on the duration of the campaign.
    
    end_monitor
    I've used this system in the first tests of a campaign with 50 turns per year, beginning in the 34 turn of the first year, and it works (only tested the first "New Year Event").

  22. #82
    Member Member anweRU's Avatar
    Join Date
    Jan 2009
    Location
    Bangor, ME
    Posts
    342

    Default Re: alpaca's Script-O-Rama

    I'd like to set a script similar to the very first script in this thread, i.e. adding money to a faction that captures a settlement. However, I want to add a different set of conditions:

    For example, consider Jerusalem:
    If a Catholic faction captures Jerusalem from a Muslim faction, it gets bonus money.
    Otherwise, it doesn't.
    If a Muslim faction captures Jerusalem from a Christian faction, it gets bonus money.
    Otherwise, it doesn't.

    So I need to check the faction that owned the settlement before its capture. Also, would I need to repeat this script for every faction, i.e. Moors, Egypt & Turks for the Muslims, and England, etc. for the Catholic?
    Ancestry: Turkish & Irish. Guess my favorite factions!

Page 3 of 3 FirstFirst 123

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