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

Thread: Factions dying on shortage of FM, trials to solve the glitch

Hybrid View

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

    Default Factions dying on shortage of FM, trials to solve the glitch

    I have been thinking on this glitch after seeing a thread somewhere, and tried a few things when time allow. I know it's rare but considering the limited numbers of factions, it's still a glitch if it happen when a faction is otherwise healthy enough.
    A few notes first:

    1, I thought it could happen as well if a leader and heir were dying simultaneously, but tests proved me wrong. As long that one or more adult FM IN the family tree are there to take over, the glitch won't happen.
    2, named character outside the family tree are the real buggers, as you will see.
    3, You never know what sort of strange things can happen in ai factions family tree, especially during long campaigns with characters living a lot of turns.

    My beginning of 'salvation', not so complicated and working surprisingly well, except for one annoying shortfall with possible named characters outside the family tree:

    Code:
    monitor_event CeasedFactionLeader
    
    
    if I_NumberOfHeirs mongols < 1
    and I_NumberOfSettlements mongols > 0
    
    
        spawn_army
        faction mongols
        character random_name, named character, age 41, x 95, y 88, family
        traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
        unit        Boii_Bodyguard_Cavalry                exp 6 armour 1 weapon_lvl 1
        end    
    end_if
    
    
    if I_NumberOfHeirs ellenobaktrioi < 1
    and I_NumberOfSettlements ellenobaktrioi > 0
    
    
        spawn_army
        faction ellenobaktrioi
        character random_name, named character, age 41, x 292, y 54, family
        traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
        unit        Bactrian_Bodyguard                exp 6 armour 1 weapon_lvl 1
        end    
    end_if
    ;;;ect, ect
    end_monitor
    
    
    monitor_event CeasedFactionHeir
    
    
    if I_NumberOfHeirs mongols < 1
    and I_NumberOfSettlements mongols > 0
    
    
        spawn_army
        faction mongols
        character random_name, named character, age 34, x 93, y 87, family
        traits Factionheir 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
        unit        Boii_Bodyguard_Cavalry                exp 6 armour 1 weapon_lvl 1
        end    
    end_if
    
    
    if I_NumberOfHeirs ellenobaktrioi < 1
    and I_NumberOfSettlements ellenobaktrioi > 0
    
    
        spawn_army
        faction ellenobaktrioi
        character random_name, named character, age 34, x 299, y 73, family
        traits Factionheir 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
        unit        Bactrian_Bodyguard                exp 6 armour 1 weapon_lvl 1
        end    
    end_if
    ;;;ect, ect
    end_monitor
    If there are no adult FM in family tree at death of a faction leader or heir to take over, these two monitors will spawn new ones, depending on which died or if both died prior to the entire faction turning rebels, preventing the glitch.
    But there is the possibility of some named character outside the family tree:
    1, by recruitment, which I don't personally use for numbers of reasons.
    2, by descr_strat at start, which I won't use anymore for this reason.
    3, by spawn, which I use and need on occasions for some features. Even if you spawn them with the family tag, there is the chance of no open slot, and if you spawn them within a hidden faction before giving them to a real faction, they won't make it in this faction family tree.

    Let's quote the thread on non working scripts terms, or not working like they should:
    I_NumberOfHeirs - seems to be a count of ALL named characters (family or otherwise) including the leader. Teutonic trees too. Does NOT count off map characters.

    That disapointing description is 100% true, and if one non-family named character exist within the concerned factions when the script above fire, it won't work because of this.

    I can think of ways to further limit the risks with my spawns, maybe, but it's not the point of this thread.
    The point would be, how could we replace I_NumberOfHeirs in this kind of failsafe script? Short on ways to force adoptions or marriage, or other simple conditions to check the health of a family tree?

    All I could think so far would be a ancillary granted to Coming of age, adoption and marriage, plus starting family in descr_strat, then a script with a counter and FactionwideAncillaryExists to set this counter or not...
    Problem: this appear to require at least 30 monitors, maybe short but still, one by faction, and even so, what event to use in order to anticipate any instance of the glitch before using the counter in the Ceased failsafe?
    I have ideas coming and going but no time to fully experiment for such a rare, but killer glitch if it happen.

    Any ideas, thoughts?

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    I_NumberOfHeirs - it's indeed a misleading condition name. 'NamedCharactersOthenThenFL' would have nailed it.

    You can work around your 30 monitor problem with a fairly standard script practice - set up faction counters (at the top of the script). Which will also help with bug hunting as it provides a log entry at start and end of a faction's turn. You can also incorporate check for AI or player control.

    Code:
        monitor_event PreFactionTurnStart FactionType [faction name]
            if I_IsFactionAIControlled [faction name]
                set_event_counter [faction name]_IsAI 1
            end_if
            set_event_counter [faction name]_turn 1
            log always Turn Start [faction name]
        end_monitor
        monitor_event FactionTurnEnd FactionType [faction name]
            set_event_counter [faction name]_turn 0
            log always Turn End [faction name]
        end_monitor
    You can now test for I_EventCounter instead of 'FactionType of current player\AI' and use IF to wrap all monitors into one:

    Code:
        monitor_event FactionTurnStart TrueCondition
            if I_EventCounter [faction name]_turn > 0
                and not FactionWideAncillaryExists [ancillary name]
                if I_EventCounter [faction name]_revive < [value]   ; how many times will we rescue the faction?
                    do your stuff for [faction name]
                    inc_event_counter [faction name]_revive 1
                end_if
            end_if
    
            mo' factions
            
        end_monitor
    I would suggest to consider adding the max count condition loop - else you may just string a faction along.
    Last edited by Gigantus; January 18, 2018 at 01:59 AM.










  3. #3

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    I have a doubt. I thought about event_counter but it still don't cover each possible instance of the glitch with faction turn start and end. What in the likely case where the faction loose it's last leader/heir when it's not it's turn? And for what you describe, I would still need 60 new short monitors to set the counters, and I still coudn't compress the rest in one since a 'if' require every condition starting by I_.

    In that case, I might as well try something like this:

    Code:
    monitor_event CeasedFactionLeader FactionType mongols
    and not FactionWideAncillaryExists family
    
    set_event_counter mongols_no_family 1
    end_monitor
    Then retake the failsafe script and replace I_NumbersOfHeirs by I_EventCounter, maybe it's not so bad if it work, I will have to test first. It's not a emergency though so I will still think about it. Thanks, my old friend Gigantus.
    I didn't say my last word on it.

  4. #4
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    The initial 60 monitors will vastly reduce the number of multiple faction specific monitors, but as you observe correctly it requires I_xyz conditions within the if loops. Which I neglected when coding the second monitor, it should have been thus (using the CeasedFactionLeader event):

    Code:
        monitor_event CeasedFactionLeader TrueCondition
            and not FactionWideAncillaryExists [ancillary name]
            if I_EventCounter [faction name]_turn > 0
                and not FactionWideAncillaryExists [ancillary name]
                if I_EventCounter [faction name]_revive < [value]   ; how many times will we rescue the faction?
                    do your stuff for [faction name]
                    inc_event_counter [faction name]_revive 1
                end_if
            end_if
    
            mo' factions
            
        end_monitor










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

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    I don't think I've ever used CeasedFactionLeader/Heir but I would assume that CeasedFactionHeir would fire not only when the heir dies but also when the leader dies - because the heir, by becoming leader, has stopped being heir. If that's true then CeasedFactionHeir would be enough; no need for a CeasedFactionLeader monitor as well.

    The mod I'm working on uses an IsFamily hidden trait which everybody in the family tree is given and new family members acquire.

    Code:
    declare_counter family_on_map_count
    
    monitor_event PreFactionTurnStart
    	set_counter family_on_map_count 0
    end_monitor
    
    monitor_event CharacterTurnStart Trait IsFamily > 0
    	inc_counter family_on_map_count 1
    end_monitor
    Then at turn start, a monitor per faction which spawns a family member if that counter is below a certain number. Or just one monitor if Gigantus' trick is used.

    We also send a family member off map as he can't be killed there. But he will die of old age eventually so it's not a permanent solution, unless script sends somebody else off map to replace him. He'll also quite possibly become heir/leader while off map which means in-game the AI faction seems to have no heir/leader which can be strange for a player trying to find them.

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    In 1648 we kept the initial heir in a confined spot on the map for AI factions. Considering that we had 12tpy and the heirs were around 20 that would be good for an average of 200 turns. Any faction not making it after that isn't really worth the effort in my mind. Same reason why we terminate garrison scripts around that time.

    Edit: some thought - if there is no family ancillary then it's too late anyhow and the faction is defeated. Rather use the hidden trait and test for < 2 numerical condition like you did, I would however prefer using event_counters (I have that thing about declaring counters....)

    The first monitor can be incorporated into the basic faction monitors, which means other then the one time faction monitors you have only two additional monitors.

    Code:
       ;--- Standard Faction Monitor ---
        monitor_event PreFactionTurnStart FactionType [faction name]
            if I_IsFactionAIControlled [faction name]
                set_event_counter [faction name]_IsAI 1
            end_if
            set_event_counter [faction name]_turn 1
            set_event_counter family_on_map_count 0
            log always Turn Start [faction name]
        end_monitor
    
       ;--- Counting presence of trait ---
        monitor_event CharacterTurnStart Trait IsFamily > 0
            inc_event_counter family_on_map_count 1
        end_monitor
    
       ;--- Triggering action based on trait count, with cut-out after certain count of actions ---
        monitor_event FactionTurnEnd I_EventCounter family_on_map_count < 2
            if I_EventCounter [faction name]_turn > 0
                and I_EventCounter [faction name]_revive < [value]   ; how many times will we rescue the faction?
                do your stuff for [faction name]
                inc_event_counter [faction name]_revive 1
            end_if
    
            mo' factions
    
        end_monitor
    Last edited by Gigantus; January 18, 2018 at 10:58 PM.










  7. #7

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    The problem is, CeasedFactionLeader/Heir is the only event catching the exact moment where the faction in danger can turn rebels, and that I see no way to make up a accurate I_EventCounter/CompareCounter that mean exactly: I_IsFaction Y (that losted it's last leader without possible heirs)

    monitor_event CeasedFactionLeader TrueCondition
    and not FactionWideAncillaryExists family
    ;; or
    and I_CompareCounter family_hidden trait < 1


    if I_IsFaction mongols ;;; The I_ that would be perfect
    and I_NumberOfSettlements mongols > 0


    spawn_army
    faction mongols
    character random_name, named character, age 41, x 95, y 88, family
    traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
    unit Boii_Bodyguard_Cavalry exp 6 armour 1 weapon_lvl 1
    end
    end_if
    ;;;ect ect
    A Counter set on turn or character start isn't good enough, a leader can get killed on any faction turn, before the right counter has been calculated. I_LocalFaction or I_IsFactionAIControlled is of no use here either.
    I_NumberOfHeirs would be perfect if it didn't count outsiders to the family tree, since it target one faction at the time.

    I don't see a way out of making 30 CeasedFactionLeader monitor here, either to set the factionY_no_family counters at the exact timing, or/and directly make the spawns in them.

    I might come to this. Unless I didn't think of something else?

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    and not FactionWideAncillaryExists family

    There is your problem - it will require you to remove the ancillary from the current heir once he has become the heir, else this will only fire when the faction is already dead, eg there was no heir to start with. And removal of ancillaries without knowing names of characters is a .

    The CeasedFactionHeir\Leader will not work with my last monitor as this event can happen when it is not the faction's turn. In fact there is no way around creating one monitor per faction if you use that event.

    Chances of a faction getting defeated within one turn after the last family member becomes leader are fairly slim: taking the last settlement is fatal under any circumstance which leaves death in battle or because of old age. The latter is role of the dice anyhow, in one game he lives for another 10 turns, in a reload he croaks the next round.

    As to turning rebels: never seen that happen unless the faction is actually defeated, eg death of last FM before taking of last settlement. The tendency of turning rebel can otherwise be countered by changing values in descr_campaign_db.










  9. #9

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    If I use a ancillary, I will use it on every FM in family tree, including the FL/FH, then limit to CeasedFactionLeader and therefore the script should fire when there is no more leader nor any valid candidate to take over, right before it's settlements and other characters turn rebels, replacing the I_NumberOfHeirs.

    I know it's rare that a faction end up without family member and die of it(turning rebels while still having settlements), but I thought it would be interesting to try to prevent it. Especially on long campaigns, or even in short, I saw it happen with enough harassment from the player for instance.
    The first script in the op would do just fine in all cases if I_NumberOfHeirs was faithful to it's name.

    CeasedFactionLeader being the only event catching the exact right timing to prevent the glitch in all odds, I will make a exception with 30 monitors and if I ergonomize well the rest of scripting when possible, it shoudn't impact performances. More trials will tell when testing further I suppose.

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    If I use a ancillary, I will use it on every FM in family tree, including the FL/FH, then limit to CeasedFactionLeader
    I am afraid I am not understanding what you mean by that.

    If every FM has that ancillary then the 'not factionwideancillaryexists' condition will only be true if
    a) there is no more FM - which means the faction is already defeated and the spawn will not work
    b) the ancillary gets removed from the current heir when he becomes heir (and no further FM exists) - which is a pain to remove if you don't know the name of the character

    Regrettably we have already established that I_NumberOfHeirs returns not only the number of potential heirs in the family tree but includes all named characters, else it would be ideal.










  11. #11

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    I just tried and you are right. My reasonning was that as long that the condition was on the CeasedLeader event, the script would fire before it being destoyed.
    But, I was wrong. So I can forget the FactionWide condition.
    To quick test, I also tried a CompareCounter to replace the I_NumbersOfHeirs:

    Code:
    monitor_event FactionTurnEnd FactionType mongols
    
    
    kill_character Budic
    kill_character Cynan
    end_monitor
    
    declare_counter mongols_family_trait
    
    monitor_event CeasedFactionLeader FactionType mongols
    ;;and not FactionwideAncillaryExists FamilyTree;;; Not good then
    
    
    if I_NumberOfSettlements mongols > 0
    and I_CompareCounter mongols_family_trait < 1
    
    
        spawn_army
        faction mongols
        character random_name, named character, age 41, x 95, y 88, family
        traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
        unit		Boii_Bodyguard_Cavalry				exp 6 armour 1 weapon_lvl 1
        end
    end_if	
    end_monitor
    It work, sure, I can even compress all that part on one monitor again. But it take us back on how to set that counter right at any moment of the game. The danger is during battles that aren't on the faction turn, basically.
    I could work something out if there was a FactionWideTraitExists since trait are more easily removable... Got to think of something else, somehow.

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    Scripting is fun, ain't it?

    If you use faction specific family traits (so far we talked about a global trait) then you only reset them at pre-start of that particular faction - which would mean the count remains valid during other faction's turns, making it possible to use the 'ceased' event and using a trait count condition. You are however back to one monitor per faction as you will need to establish the faction of the killed leader\promoted heir and cannot use the faction monitor counter to do that if the event occurs during another faction's turn.
    Last edited by Gigantus; January 20, 2018 at 09:41 AM.










  13. #13

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    Oh, scripting is more fun than some other modding activities if you ask me. That being said, I am not sure of something.

    Having factions turns event_counter sound like a good idea for other things, I started but do I really have to have the 60 initial monitors? I tried to compress but I can't think of a way? Is it forced, you think?

    About the trait, I think of a global hidden trait too, the above was just a test example.

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

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    One PreFactionTurnStart monitor which sets all counters to 0, then one PreFactionTurnStart per faction that sets that faction's counter to 1 would achieve the same result. And make sure they're at the top of the script, in case any other PreFactionTurnStart monitor ever needs to use these counters - if it's above these then the counters will be wrong when it fires.

  15. #15

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    Thanks, Withwnar. For the TrueCondition details too.

    Quote Originally Posted by Gigantus View Post
    I would suggest to consider adding the max count condition loop - else you may just string a faction along.
    I forgot, what is this max count condition? Can't find it in docudemon?
    Last edited by selv; January 21, 2018 at 01:15 AM.

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    My faction monitors are a bit more elaborate then what withnwhar suggests as I was interested to catch the individual faction's turn start and turn end in the log. The principle is the same.

    I was referring to this if loop:
    Code:
                if I_EventCounter [faction name]_revive < [value]   ; how many times will we rescue the faction?
                    do your stuff for [faction name]
                    inc_event_counter [faction name]_revive 1
                end_if
    Last edited by Gigantus; January 21, 2018 at 02:00 AM.










  17. #17

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    Yes, I thought of catching individuals turns after, so no way around the 60 monitors I guess. Thanks, colleagues.
    I will post again when I decide something on how to proceed with the subject of the thread.

  18. #18

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    Up, after spending the better part of yesterday on this. I didn't plan to but some 'bright' ideas came to me while doing something else. Nope, they didn't work as planned. The best and simplest was probably this one:

    Code:
    monitor_event BecomesFactionLeader FactionType mongols
    set_event_counter mongols_leader 1
    end_monitor
    
    monitor_event CeasedFactionLeader
    
    
    campaign_wait 0.01
    
    
    
    
    ;            ; while-loop pauses the monitor
    ;            while I_NumberOfSettlements mongols > 0
    ;                and I_EventCounter mongols_leader < 1
    ;            end_while
    
    
    ;;if I_NumberOfHeirs mongols < 1
    if I_NumberOfSettlements mongols > 0
    and I_EventCounter mongols_leader < 1
    ;;and I_FactionLeaderTrait mongols FLA < 1
    
    
        spawn_army
        faction mongols
        character random_name, named character, age 41, x 95, y 88, family
        traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , BattleDread 1 , StrategyDread 2 , ReligionStarter 1 , LoyaltyStarter 1
        unit        Boii_Bodyguard_Cavalry                exp 6 armour 1 weapon_lvl 1
        end    
    end_if    
    end_monitor
    Sorry about the commented out parts for other trials but I am keeping them for references. At first there were no campaign_wait or while loop (They serve the same purpose here) and the script was firing at each CeasedFactionLeader, without taking in account if a heir was there to take over. Withwnar gave me the idea to use them while reading one of his tutorials, and the script does take the brief time of checking the BecomeFactionLeader event_counter, not spawning a replacement when a new leader is already there.

    But then by the processing turn of events process, when a heir become leader, the brief window while a faction without leader is alive on CeasedFactionLeader is already over and the faction die before spawning a replacement.
    I tried other things with hidden traits to keep the all crucial time on CeasedFactionLeader, and then some more event_counter tricks but I coudn't figure how to make this a real failsafe at anytime, and firing only when it is really needed.

    Spawning new characters randomly or each time is not good enough, it would increase the already existing chance of crowding the family tree, leaving no room for the factions to keep a decent family by themself, and create useless confusing non-family characters walking around.

    So I am thinking that maybe I looked at this the wrong way. Maybe there is simpler. First, sending a young bogus FM off-map, preferably with a trait just for him that keep him at low authority or the like. What Withwnar wrote in one of his posts above. One in-game lifetime assurance. Then spawn him a successor that get send off map as well and so on.
    Since off map require the characters name, just like the kill command, I could kill them when they are at old age and spawn the new one at the same time.

    Two possible shortfall in the off map successors.
    Risk that they don't end up in the family tree, however since we speak of one spawn by lifetime, I think it's a acceptable risk. At worst the faction would be at the same risk that if he wasn't there.
    And I can't spawn these characters with the unique name hidden faction pool method, because of the family thing. That's my biggest worry, I have yet a limited knowledge of labels, didn't think I would need them in scripts before, and I understand one label can't be used more than once?

    So I need to look more at labels it seem, but the all matter of this thread must wait for my other tasks to get near their end, unless it can be figured quickly enough before. Hope you don't mind me keeping my thoughts in order (or trying to) via this thread, my list of private modding journals is already crowded.

    edit, not directly related but thanks again, Gigantus. With your method of checking factions turns by event counter, my turns time are litteraly flying around by now for most part.
    Last edited by selv; May 22, 2018 at 11:28 AM.

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    I didn't see a reset of the mongol_leader counter. But I guess this is besides the point as you found out.

    Rather approach it from the I_NumberOfHeirs angle - when a BecomesFactionLeader event takes place simply check how many heirs are still around. I believe the condition checks all eligible male family members, hence checking if there are less then 2 and then spawn a family member might work.










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

    Default Re: Factions dying on shortage of FM, trials to solve the glitch

    campaign_wait 0.01
    I thought that 0.1 was the shortest time that may be used with that command. 0.01 is the same as 0.0 (no wait at all), or so I believed. Not sure if that has any impact on your script, just sayin.

    So you're trying to spawn a new family member when the final one dies? Hmm, yeah, that sounds risky. Gigantus' approach would be safer: spawn when they're running low.

    I understand one label can't be used more than once?
    Sad but true. Not on named characters, no. You'll get a "label already used" error if you try and he won't spawn. Even if the old character with that label is now dead.

    One approach would be a counter that remembers which spawn number you're up to. Then use that to work out what label name to use next time.

    e.g.

    Code:
    declare_counter spawn_count
    
    if I_CompareCounter spawn_count = 0
      spawn_army
        ...
        character ... label xyz1
        ...
      end
      inc_counter spawn_count 1
    end_if
    
    if I_CompareCounter spawn_count = 1
      spawn_army
        ...
        character ... label xyz2
        ...
      end
      inc_counter spawn_count 1
    end_if
    
    if I_CompareCounter spawn_count = 2
      spawn_army
        ...
        character ... label xyz3
        ...
      end
      inc_counter spawn_count 1
    end_if
    It means there's a limit on how many spawns it can do, but the number is up to you: how many times you can be bothered to duplicate that IF block.

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
  •