Page 1 of 2 12 LastLast
Results 1 to 20 of 33

Thread: Bonus when army reaches a specific location

  1. #1
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Bonus when army reaches a specific location

    Is it possible to grant + experience for troops or randon retinues/traits to generals just by placing them somewhere in the sratmap? (could be in a settlement)

  2. #2

    Default Re: Bonus when army reaches a specific location

    Yes. You create a new trait or retinue and put in the trigger conditions that the General neeeds to be in the settlement you want or (I'm not sure about this one) near a certain title.

  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    That's the 'IsPositionInRect' condition if you want to specify a target area.










  4. #4
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    Ok thanks for the answer.

    Now I need some help to develop new features Im creating. The questions are only the ones in the red text, the blue text is only for explaining what Im trying to create.

    FEATURE 1
    I implemented small settlements (villages) in the game and called them temples. One can't build enything inside them but they already have an undestroyable building in it that will grant certain global bonuses to specific factions. This is already made, quite easy to do via export_descr_buildings. Now I also want the general that enters this temple to be blessed (and so receive a trait with bonus for him)

    So I need a script that will grant a specific trait for a general when he reaches a specific settlement.

    Conditions are:

    1 - A general can receive the trait only ONCE.

    2 - Only generals from specific factions will get the trait when they reach the settlement. So for example, an english general will get the trait if he enters the settlement but a french general will get nothing if he enters the same settlement.


    FEATURE 2
    I will spread ruins locations in the strap map. They will not be settlements but forts and its stratmap description will be something like: ancient ruins - enter here with a general if you want to look for treasures, but be warned about the risks...) Maybe Im going to place some monsters like giant spiders and werewolves inside the ruins, not sure yet.So this is why I need a script that will grant a random bonus for a general from any faction when he enters the fort.

    Bonus are:

    -
    Death - The general intantly dies in a trap (IMPOSSIBLE)
    - Curse - The general receives some bad trait from some bad magic.
    - A random retinue. The general finds some treasure
    - Money. The genetal finds a safe.
    - Siege weapons units.
    - maps (map information - can it be given via script?)
    - Poison (plague). The general (or the entire army) gets poisoned.
    - More suggestions are welcome from you guys.

    Any general from any can get the bonus.

    I have the following conditions in mind (you guys tell me which ones are possible to make and please suggest what you think is better):

    First option is:
    The ruin (fort) can be explored again and again (I dont think someone will keep risking so many times due to the possible bad bonuses...)


    Second option is:
    The ruin (fort) bonus capability will refresh each 15 turns or so.

    Is it possible to add/remove forts via script?

    battles to happen in these places will be very simple to implement. Just spawn rebel armies there that will be needed to be defeated by the general looking for the treasure in the ruins before he enters it. So this is no problem for my feature.



    By the way, I searched for a list of traits/retinues and found this, can I use it to choose the bonus I want?
    Last edited by leo.civil.uefs; August 23, 2019 at 08:48 PM.

  5. #5
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    1) That would be your regular 'EndedInSettlement' condition together with a building present test.
    Code:
    Trigger [trait name]_trigger
    	WhenToTest CharacterTurnEndInSettlement
    	Condition SettlementBuildingExists >= [lowest level of building]
    		and FactionType [faction]
    		and not Trait [trait name] > 0
    Affects [trait name]  1  Chance  100
    2) You can't kill a character without knowing his name, so that's out.
    Adding units to an army requires the name of the general, same.
    I have no idea how you can make use of the custom tile in your case, isn't it that a battle needs to be triggered on that tile? It would require the spawn of an immobile army that the player can the attack as you can only script an attack if you know the name of both attacked and target.










  6. #6
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    Quote Originally Posted by Gigantus View Post
    1) That would be your regular 'EndedInSettlement' condition together with a building present test.
    Code:
    Trigger [trait name]_trigger
    	WhenToTest CharacterTurnEndInSettlement
    	Condition SettlementBuildingExists >= [lowest level of building]
    		and FactionType [faction]
    		and not Trait [trait name] > 0
    Affects [trait name]  1  Chance  100
    2) You can't kill a character without knowing his name, so that's out.
    Adding units to an army requires the name of the general, same.
    I have no idea how you can make use of the custom tile in your case, isn't it that a battle needs to be triggered on that tile? It would require the spawn of an immobile army that the player can the attack as you can only script an attack if you know the name of both attacked and target.
    You say I can only kill a general using his name, but what about using his location?

    As for adding units to an army, Im quite sure it can be done simply via spawn army command. Using the fort location coordinates in the map. Once the attacking general wins the battle and take place inside the fort, the units are spawn in this location. No need to identify the general by its name.


    Yes, rebel army inside the fort will cause the battle to happen when the general attacks it.

    I decided to use forts after all. And added some new bonuses. Check the original comment with the concept. I edited it.

  7. #7
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    Quote Originally Posted by leo.civil.uefs View Post
    You say I can only kill a general using his name, but what about using his location?
    See my tutorial. This is the basic command: kill_character [name\label]. His location is only a condition.


    Quote Originally Posted by leo.civil.uefs View Post
    As for adding units to an army, Im quite sure it can be done simply via spawn army command. Using the fort location coordinates in the map. Once the attacking general wins the battle and take place inside the fort, the units are spawn in this location. No need to identify the general by its name.
    There is no problem to spawn a separate army with those bonus units, directly adding units to an army however requires the general's name - that's what I took you meant.


    Quote Originally Posted by leo.civil.uefs View Post
    Yes, rebel army inside the fort will cause the battle to happen when the general attacks it.
    I decided to use forts after all. And added some new bonuses. Check the original comment with the concept. I edited it.
    The fort should keep the target army in place, I would however suggest to think about a removal of that spawn (like garrison units) via a yes\no event in case the general cannot\doesn't want to attack.










  8. #8
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    Quote Originally Posted by Gigantus View Post
    See my tutorial. This is the basic command: kill_character [name\label]. His location is only a condition.
    OK no way then.



    Quote Originally Posted by Gigantus View Post
    There is no problem to spawn a separate army with those bonus units, directly adding units to an army however requires the general's name - that's what I took you meant.
    U talk about some kind of command like "add unit to that army"? Or are u talking about simply spawing units OVER an army, like in the same location. Because if spawing units over an army can do the trick and merge both armies together, then its enough for me.



    Quote Originally Posted by Gigantus View Post
    The fort should keep the target army in place.
    To keep the rebel army in place I could simply use the "LOCKED" trait.

    Quote Originally Posted by Gigantus View Post
    I would however suggest to think about a removal of that spawn (like garrison units) via a yes\no event in case the general cannot\doesn't want to attack.
    What do you mean with the general cannot/does not want to attack? I dont get this part.
    I want The rebel army to stay inside the fort until someone attacks and destroys it.

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    Can be forts created directly via script? If not, is it possible then to spawn an rebel general and make him create a fort via script?
    Last edited by leo.civil.uefs; August 22, 2019 at 08:30 AM.

  9. #9
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    Spawning an army on top of another does not merge them - it simply 'slides' off into one of the available spots next to the other army.
    Adding units to an army is done via the 'create_unit' command which, like the killing command, requires a label\name. Can also be used to add a garrison to a settlement.

    The 'locked' trait reduces movement points to a minimum but does not totally stop movement, approximately one movement point per 4 rounds I think. Sticking rebels\slaves into a fort however in most cases stops them from wandering around.

    Forts cannot be created via script, either directly or indirectly.

    As to the last bit: what I had in mind is a vicinity check of a general (let's say two steps) from the fort. This then triggers a historic yes\no event with the question if he wants to explore\join battle. If yes then the rebels get spawned and a battle can take place and if won a reward gets granted. If no, then nothing happens. Should the battle get lost or no attack takes place (existence check of the rebel general) then the rebel army gets disbanded.
    If memory serves then spawning the rebels directly into the fort is not possible, they will 'slide' off and need to be 'moved' into the fort after the spawn.










  10. #10
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    Quote Originally Posted by Gigantus View Post
    Spawning an army on top of another does not merge them - it simply 'slides' off into one of the available spots next to the other army.
    seems good enough for me.


    Quote Originally Posted by Gigantus View Post
    The 'locked' trait reduces movement points to a minimum but does not totally stop movement, approximately one movement point per 4 rounds I think. Sticking rebels\slaves into a fort however in most cases stops them from wandering around.
    thats also good enough since I dont want them enywhere out of the fort.

    Quote Originally Posted by Gigantus View Post
    As to the last bit: what I had in mind is a vicinity check of a general (let's say two steps) from the fort. This then triggers a historic yes\no event with the question if he wants to explore\join battle. If yes then the rebels get spawned and a battle can take place and if won a reward gets granted. If no, then nothing happens. Should the battle get lost or no attack takes place (existence check of the rebel general) then the rebel army gets disbanded.
    If memory serves then spawning the rebels directly into the fort is not possible, they will 'slide' off and need to be 'moved' into the fort after the spawn.
    I guess you consider this method better because you cant spawn armies directly inside forts. But you actually can. I just did it via descr_strat.txt

  11. #11
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    Positioning in descr_strat (never referred to as spawning) will always work. Spawning is creating an army\character\agent via script, and there you can't spawn into a settlement\fort directly.










  12. #12
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    Quote Originally Posted by Gigantus View Post
    Positioning in descr_strat (never referred to as spawning) will always work. Spawning is creating an army\character\agent via script, and there you can't spawn into a settlement\fort directly.
    Oh, now I get it. Thats a problem since I would need the army to be respawn from time to time inside the settlement and this can only be made via script.
    But I guess that spawing the army in a tile right beside the fort is enough, being a rebel army, they will conquer the fort in the next turn if there is no one inside it. And I can make the script to spawn the rebel army only if there is no one inside the fort.

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

    Default Re: Bonus when army reaches a specific location

    You can't spawn into a fort/settlement but you can spawn nearby and walk them in: use "move" command with his name/label and the fort/settlement coordinates as the target location.

    Usual limitations apply: labels can't be re-used and names are generally unsafe because somebody else might have that name so he moves instead of the proper guy; the Unique Names method solves that. You might need to spawn two tiles away - spawning adjacent sometimes fails to move them inside, no idea why, but only AI has this problem.

  14. #14
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    deleted, see next reply.
    Last edited by leo.civil.uefs; August 24, 2019 at 02:41 PM.

  15. #15
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    Quote Originally Posted by Lusitanio View Post
    Yes. You create a new trait or retinue and put in the trigger conditions that the General neeeds to be in the settlement you want or (I'm not sure about this one) near a certain title.
    Quote Originally Posted by Gigantus View Post
    That's the 'IsPositionInRect' condition if you want to specify a target area.
    Like this in export_descr_ancillaries.txt?

    Code:
    Trigger chop_block2    WhenToTest PostBattle
        Condition WonBattle
              and IsGeneral
              and CultureType middle_eastern
          and PercentageEnemyKilled >= 90
              and IsPositionInRect x y coordinates to make sure the ancillaries will be only give for a general who won a battle in this exat location
    
    
        AcquireAncillary chop_block chance  5
    This way I will block ancillaries from being acquired after battles elsewhere and set them to be acquited only in the locations I want, right?

    I would like to make them exclusively acquired in my forts via the script Im trying to develop here.

    The problem is that I want the ancillary to be given not only in 1 coordinate but in many because I have many different locations in my stratmap where this should happen. (By the way they are all forts, any problem with this?)

    So is it possible to use something like:

    IsPositionInRect x y coordinates
    or IsPositionInRect x y coordinates
    or IsPositionInRect x y coordinates...

    ?

    Or would I need to repeat every ancillary entry with new coordinate for every location I want?


    Quote Originally Posted by Gigantus View Post
    1) That would be your regular 'EndedInSettlement' condition together with a building present test.
    Code:
    Trigger [trait name]_trigger
        WhenToTest CharacterTurnEndInSettlement
        Condition SettlementBuildingExists >= [lowest level of building]
            and FactionType [faction]
            and not Trait [trait name] > 0
    Affects [trait name]  1  Chance  100
    Here's what I made.

    Code:
    Trigger PublicFaith_trigger    WhenToTest CharacterTurnEndInSettlement
        Condition SettlementBuildingExists >= evil_temple
            and FactionType portugal
            and not Trait PublicFaith > 0
    Affects PublicFaith  1  Chance  100
    .

    Not working.
    The trait is given, but not the one I wrote in the script. Actually, the game gives 2 traits to the characters, and none of them are the one I chose.
    Besides, the game gets messes, the turns pass fast, the next turn I get izarre recruitment reports, and normal scripts are not being read.

    Weird.
    Last edited by leo.civil.uefs; August 24, 2019 at 02:45 PM.

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    The general can only be in the square after he won the battle. The trigger however will remain active so you may have to use an event_counter condition as well. Switch it on with your event preceeding the battle and switch it off at the faction's turnend.
    ------
    You cannot use or - you will need to write a trigger each.
    Is evil_temple the first level of the building tree? You need to use a level name, not the tree name.
    Inactive script (the reason for fast processing) - certainly an error in the script or descr_strat. The latter prevents the script from being called.
    ------
    For testing purposes use a clean EDCT with only your trait and triggers. The trait should appear at the start of the next round, provided the character remained in the qualifying settlement at the end of his turn.
    Last edited by Gigantus; August 24, 2019 at 09:52 PM.










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

    Default Re: Bonus when army reaches a specific location

    IsPositionInRect needs sm_position which only three events export. PostBattle isn't one of them. The log would surely be saying so.

    Maybe if the fort was on a resource then the OnResource condition could be used. I don't know if that still works when the resource is underneath settlements/forts. And you'd need to ensure that no other resources in that region can be stood upon or are underneath other settlement/forts, to avoid your trigger happening in the wrong locations.

  18. #18
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    A fort on top of a resource is actually the old resource fort exploit

    And you are right, IsPositionInRect is unsuitable as it will only define in which area a tile can be when it is seen, I must have thought of I_CharacterTypeNearTile which again is too ambiguous and has it's own pitfalls.

    GeneralCaptureResidence could work as it exports a region and together with a event counter set at start of the battle could work. Rough doodle:

    What character event might be suitable....
    I_CharacterTypeNearTile (next to fort)
    AgentType named character (no low generals, please...)
    historic_event ruin_battle true
    while I_EventCounter ruin_battle_accepted = 0
    and I_EventCounter ruin_battle_declined = 0
    end_while
    if accepted > 0
    do stuff
    end_if
    if declined > 0
    do nothing?
    reset event counters
    end_if
    end_monitor

    event GeneralCaptureResidence
    and I_event_counter ruin_battle > 0
    do the trait or whatever stuff
    reset event counters
    end_monitor

    In case the guy looses you also need a counter reset (all three) at the faction's turn end. A cool down is also advisable else the guys will have the event the next turn again.
    Last edited by Gigantus; August 25, 2019 at 08:03 AM.










  19. #19
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Bonus when army reaches a specific location

    OK.

    What about a even more simple solution?

    I could create a new rebel faction, make script spawn its armies in the coordinates I want, and then use a condition for the ancillaries to be given every time a general win a battle against this faction.

    What do you think?

    I've checked the docudemons for the conditions and I see some possibilities, though I'm not sure which one is the best.

  20. #20
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Bonus when army reaches a specific location

    Another rebel faction will create problems because of the special faction entry in descr_sm_faction. Using a 'regular' faction however should not be a problem. In fact you could use as 'script' faction which has a number nifty uses, withnwar has a number of tutorials regarding the use of a faction like that (non playable, only used for script purposes), eg unique character names.










Page 1 of 2 12 LastLast

Posting Permissions

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