Results 1 to 22 of 22

Thread: Ways to make CTD with script ?

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

    Default Ways to make CTD with script ?



    I've had an occasional late game (100 plus turns running on auto) CTD which I think is probably due to script but can't find.

    Have been through large chunk of script setting all the spawns and create_units to definitely happen within first 6 turns in hope of finding problem. Now have an occasional CTD happening at about turn 11 - which would be useful finding except I didn't set anything to happen that late

    I know spawns can put two armies on same square, but when I've seen it happen its not been problem, apart from getting hold of your army to select it has to be done via the army list.

    Does anyone have any idea if that could be causing random CTD on ai turn?

    Also any other ideas what can cause CTD from script, only ones I've found so far and typo'd unit names, general names, or named_general without, command etc in a spawned army. Can misused conditions or counters do anything to it?
    Not used mods before? Looking for something small and fun?!
    Download the:

  2. #2

    Default Re: Ways to make CTD with script ?

    Quote Originally Posted by Makanyane
    Have been through large chunk of script setting all the spawns and create_units to definitely happen within first 6 turns in hope of finding problem. Now have an occasional CTD happening at about turn 11 - which would be useful finding except I didn't set anything to happen that late
    Was the script the only thing you changed? If so, could you post it or, better yet, can you make a separate txt from it to download?

    I'm no expert but I'll be glad to help.

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

    Default Re: Ways to make CTD with script ?

    Thanks for the offer

    The script was the only thing that I changed that moved the date of the CTD (changes also made it more frequent). I've got as far as narrowing it down to a set of spawns for one of the factions (by deleting big chunks of the script so that's all that's in it and its still crashing) it definitely doesn't occur on the exact turn they spawn but a while afterwards, so I think my hypothesis about it relating to getting two armies on same spot and problems when AI moves them might be right. Think I'm getting close to answer so will keep testing for a bit (then probably ask for help again!).
    Not used mods before? Looking for something small and fun?!
    Download the:

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

    Default Re: Ways to make CTD with script ?

    Very much simplified script - simple three spawns on same tile on subsequent turns results in randomly occuring CTD a random number of turns after last spawn. Can't duplicate reason when playing one of the spawned factions but stopping them spawning on same spot seems to stop problem (so far so good).

    So need to try and add a check to see if anyone is on tile before spawning:

    Code:
      if whatever_conditions
    
    ;sets counter to stop spawn
       if I_CharacterTypeNearTile alemanni general, 0 97,121
    	set_counter nospawn 2
       end_if
       if I_CharacterTypeNearTile alemanni family, 0 97,121
    	set_counter nospawn 2
       end_if
    
    ;only triggers if army not on tile
    	if I_CompareCounter nospawn < 2
             spawn_army
                faction slave
                character Moireabh, named character, command 1, influence 1, management 1, subterfuge 0, age 23, x 97, y 121
                unit souleatergeneral, exp 1 armour 0 weapon_lvl 0
             end
            end_if
    
    ;reset for other if/monitors
        if I_CompareCounter nospawn = 2
           set_counter nospawn 0
        end_if
    
    ; terminate_monitor
     end_if
    seems to work to just stop them spawning on exact same tile as alemanni, but would need same entry for all factions, luckily I haven't got full set of factions in use, but wonder if anyone knows of way of wording that for 'any faction' on tile that's shorter....?

    Any other advice on lines of 'Scripters Guide to CTD's' might also be useful in-case there is anything else causing problem.
    Not used mods before? Looking for something small and fun?!
    Download the:

  5. #5
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Ways to make CTD with script ?

    Maybe use true_condition?

    Just a wild guess

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

    Default Re: Ways to make CTD with script ?

    I did try TrueCondition at one point and it show_err'd unknown faction - though I might have missed correct way of phrasing...

    anyway, I changed all spawns so they can't occur on occupied tile, which fixes the problem I induced by making all possible spawns happen in first few goes.
    It doesn't however fix my random late stage CTD when used in script with proper triggers reinstated..

    Trying to isolate it is driving me slightly barmy.. Script is split basically into 5 sections with garrison and spawns for areas of map occupied by four main factions and then section for slave areas. If I run full script it CTD's fairly regularly somewhere around 150 turns in when playing via year jump started as two of the factions.

    So I think ahha remove one of the 5 sections relating to specific area of map completely and test.... lo, it doesn't CTD, so I make revised version of script with just the one suspect section I just removed in it, so I can proceed to isolate problem further..... but, the one suspect section on its own doesn't CTD either.

    If you don't see me for a while its because I've thrown something heavy at computer



    Does anyone have any experience or any ideas at all about obscure hard to find ways of making script crash game???
    Last edited by Makanyane; 12-11-2007 at 00:47.
    Not used mods before? Looking for something small and fun?!
    Download the:

  7. #7
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: Ways to make CTD with script ?

    Turn back from the Dark Side, Mak. Event scripts are evil....it's not too late...turn back now...or EoD will never be stable again...
    "One of the most sophisticated Total War mods ever developed..."

  8. #8
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: Ways to make CTD with script ?

    Silly question, but you're only checking for generals and family could other character types be causing the problem? If so maybe just check for the character type all.

    As for the factions have you tried all for the factions you want to catch instead of doing it one faction at a time. Incidentally I have no idea if all would work or not, but it might be worth a try.

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

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

    Default Re: Ways to make CTD with script ?

    DG, I've been on the dark side for a Long time :P

    Squid thanks for the idea but it doesn't accept all for either of those, I get faction type or character type not recognised message if I try, would have been useful if it had. I could try adding for other types specifically, still trying to work out why it seems happy to run any combination of four of my script sections just falls over (occasionally) when I have all five together ........
    Not used mods before? Looking for something small and fun?!
    Download the:

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

    Default Re: Ways to make CTD with script ?

    Update no.MMCXXVII for anyone I've been boring with this!

    I did test and it didn't seem to mind having armies spawned on same square as agents. (it would be a lot more of a fluke for that to happen as well)


    Anallein reminded me about problem with spawned_armies for human player - if they spawn outside your FOW they don't reset the FOW and you can't select them from campaign map. I'm not sure if that affects the AI when AI faction armies spawn or not but am back to testing script with a lot of spawns deliberately induced at start of game.

    Getting a mixture of armies slave and faction spawned on first turn, some of which won't be visible from settlements/existing armies does indeed produce a random crash on some runs about 10/20 turns later.


    Was trying to see if making the army spawn with a general instead of named character makes any difference and found it won't accept a spawned slave army with a general (though same one as named character works fine). Has anyone got any ideas on why that is, or if spawning slave armies by script is perhaps just a bad idea anyway?????

    Other question is should you ensure that all spawns take place in area within line-of sight of settlement owned by spawning faction? In case AI does get version of the FOW problem....
    Last edited by Makanyane; 12-31-2007 at 15:11.
    Not used mods before? Looking for something small and fun?!
    Download the:

  11. #11
    Honorary Argentinian Senior Member Gyroball Champion, Karts Champion Caius's Avatar
    Join Date
    Aug 2006
    Location
    I live in my home, don't you?
    Posts
    8,114

    Default Re: Ways to make CTD with script ?

    If you are getting a CTD in the same turn with the same faction, is there any chance that faction is having the problem?

    I'm a n00b at modding, but I'll help.




    Names, secret names
    But never in my favour
    But when all is said and done
    It's you I love

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

    Default Re: Ways to make CTD with script ?

    Thanks Caius, its good to see more people willing to help

    unfortunately this one's not that simple. Definitely isn't same turn, lots of times it will run through 200 turns without problem. Damn thing has never done it when I can see it either, only has happened when running campaign under ai command using -ai on shortcut or when using year jump script, all with FOW on so I can't see if its any particular faction.

    Attempts to watch it with FOW off (which takes a lot longer for it to go through) have so far resulted in either, it not crashing or me getting bored and looking away just before it happens.....


    Having spawned armies for non-slave factions use generals and not named characters seems promising so far. My test script with a lot of armies spawned on turn one crashes about every other run through with named characters but not so far with generals.

    The crashes happen quite a long while after the spawned armies have been placed and test script has terminated, so it seems there is some long term after effect to do with what happens to the spawned armies / characters later in the game..... umm, possibly..... I've been through quite a few theories on this already, and am about to go off and celebrate New Year.


    Happy New Year all
    Not used mods before? Looking for something small and fun?!
    Download the:

  13. #13

    Default Re: Ways to make CTD with script ?

    I'm interesting to know if you have discovered something new about this ctd caused by scripted army spawns.
    We are using in lotr-tw a lot of army spawns, mostly using generals (not family memebers) and we do have some random ctds during ai turn that could be caused by the scripts. I'd like to know if it could be related to the command spawn army.

    These are the only ctd causes that I have noticed using "spawn army":
    -wrong general name (or not allowed for this faction)
    -wrong unit name (or unit not allowed to this faction)
    -it seems it is not possible to spawn naval units with this command: when you choose character type=admiral, and general unit=naval unit, and the position= sea tile, the army is still spawned as a land unit and this will cause ctds when some other army tries to attack it.

    -once, we found a ctd caused by a wrong name in the names.txt that became much more frecuent when we used the scripts: since the scripts creates a lot of armies and the ai tends to split them, they need to use a lot of random names from the name pool of the faction and the ctds are more often if there is a misspelled name in the names.txt.
    Maybe you have some kind of similar ctd here ??.
    Last edited by Bardo; 01-31-2008 at 18:12.

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

    Default Re: Ways to make CTD with script ?

    I'm afraid I got very fed up with testing it so didn't come up with anymore of a conclusive answer. It seems happy with the version with spawns not using named characters, is released and I'm not getting any reports of random looking CTD's.


    Dol Guldur did spot for me later that I had some duplicate names for trait triggers which might have been adding to problem. Though I can't think of logical reason why it would only have crashed with script due to those.....

    bad name, again I would expect to crash occasionally without script and I did spend hours/days running the damn thing with/without script and it refused ever to CTD without.


    The suggestion Anallein made to me which made me consider again the spawns being possible source of problem was to do with the FOW problem you get if your faction acquires a spawned army for your faction out of your line of sight. The new army doesn't reset the FOW and is only selectable via the army list and not on the map. I was wondering if that might form some part of problem for AI, or whether spawned characters that don't get added to family tree can cause confusion later.


    Does yours go frequently enough that you can get any sort of with / without scripted spawns comparison on -ai ?
    (can't remember if you can get year-jump to work on Alex, that's faster if you can)
    Not used mods before? Looking for something small and fun?!
    Download the:

  15. #15
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: Ways to make CTD with script ?

    Question about the possible fow issue, first if my knowledge isn't totally wrong you should be able to turn it on and then off again in your script, if you can do that and you do that does it correctly set the FOW for out of sight spawned armies?

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

  16. #16

    Default Re: Ways to make CTD with script ?

    Afaik resetting the FOW does not help with the problem.
    The scripted armies also seem to 'swallow up' the FOW under certain conditions (to long ago to remember it all - will need to try out again) - for example if a scripted army was inside a city which was not 'lighted up' by a surrounding city or real army then the city itself becomes unavailable to select as well via the campaign map.

  17. #17
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: Ways to make CTD with script ?

    Well, there are two orders in which you can do the turn on, turn off of the FoW, and you might get different behaviour.

    1) Spawn Army
    Turn FoW Off
    Turn FoW On

    2) Turn FoW Off
    Spawn Army
    Turn FoW On

    I'd figure the second way wouldn't cause any problems, because there would be no FoW to 'swallow up', and then putting it back 'should' not cause any problems.

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

  18. #18

    Default Re: Ways to make CTD with script ?

    Vaya! I didn't know anything about this problem between spawned armies and the FOW.
    Squid's solution looks ok, but I have never noticed this bug so I don't think I'll be able to verify the solution.
    Just one think, this method would let the player to see all the map for a moment everytime the script spawns a new army, doesn't it?. I wonder if it would be enough to use the command "reveal_tile x,y" with the same tile than the spawned army. Do you know if the bug is related to the "fog of war" of the player or if it is related to the "field of view" of the faction that receives the army?


    Does yours go frequently enough that you can get any sort of with / without scripted spawns comparison on -ai ?
    I have used the comparison with -ai hundreds of times, but the results has changed with the diferent versions of the mod.
    I have been using spawned armies since the beginning (2 years ago) and then I was able to play hundreds of turn without any ctd, so I'm almost sure that spawned armies can be used without causing ctds. These are things that I'm sure you can do without ctds:
    -to use spawned armies including named characters (I have been using this to respawn the Nazguls for long time without any ctd).
    -to spawn armies for the ai, out of the FOW of the player, and then these armies are properly used by the AI without ctds.
    But I'm not sure if I have ever spawned armies out of the field of view of the faction who receives the army.

    Currently, we have some random ctds, and they appear both with and without scripts activated, so I can't help much with testing. But it seems than the frecuency of our ctds are slightly more often with scripts (about 1 ctd every 50 turns or so). However, we use a big ammount of scripts, so there are many possible causes, I'm just trying to reduce the possibilities.

  19. #19
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: Ways to make CTD with script ?

    I had missed reveal_tile, but you may still have the same problem because depending on where an army is spawned as to how many times would need to be revealed. As for the player being able to see the entire map every time FoW was toggled, I'd think the toggle should happen quick enough that at most you'd see a flicker, but probably nothing at all.

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

  20. #20

    Default Re: Ways to make CTD with script ?

    For the FOW issue it seems that after the character has been activated and moved he seems to be able to remove the FOW and become clickable via the strat map as well.

    Here is an example script of how it works fine to spwan an army for the player and not to have the FOW problem.
    Code:
    monitor_event FactionTurnStart FactionType Spain
    and I_TurnNumber = 1
    		spawn_army
    			faction spain
    			character Esugenos, named character, command 0, influence 0, management 0, subterfuge 0, age 40, , x 45, y 32
    			unit generic rebel general, exp 2 armour 0 weapon_lvl 0
    			unit aor caetrati falcata, exp 2 armour 0 weapon_lvl 0
    			unit aor caetrati falcata, exp 2 armour 0 weapon_lvl 0
    			unit aor caetrati falcata, exp 2 armour 0 weapon_lvl 0
    			unit aor caetrati falcata, exp 2 armour 0 weapon_lvl 0
    			unit aor caetrati falcata, exp 2 armour 0 weapon_lvl 0
    			unit aor caetrati falcata, exp 2 armour 0 weapon_lvl 0
    			unit rtr keltoi ambacti, exp 2 armour 0 weapon_lvl 0
    			unit rtr keltoi ambacti, exp 2 armour 0 weapon_lvl 0
    			unit rtr keltoi swordsmen, exp 2 armour 0 weapon_lvl 0
    			unit rtr keltoi swordsmen, exp 2 armour 0 weapon_lvl 0
    			unit aor iberian cavalry, exp 2 armour 0 weapon_lvl 0
    			unit aor iberian cavalry, exp 2 armour 0 weapon_lvl 0
    			unit aor iberian cavalry, exp 2 armour 0 weapon_lvl 0
    			unit aor iberian cavalry, exp 2 armour 0 weapon_lvl 0
    		end
    move Esugenos, 45, 33
    move Esugenos, 45, 32
    replenish_action_points Esugenos
    	terminate_monitor
    end_monitor
    And 2 pics to show the effects of adding the movement and not:
    https://i138.photobucket.com/albums/...oremovefow.jpg
    https://i138.photobucket.com/albums/...ues/Solved.jpg

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

    Default Re: Ways to make CTD with script ?

    Reading up on this topic and seeing M2's campaign-scripts ... I'd almost call a few things "obvious" (though they arent in my scripts either ... )

    Like making a character move after spawning solves the issue of FOW/not moving, M2's scripts move men around when spawned wich always has looked a bit odd to me, to script it as such, now it does ring a bell ...


    Nice to know that moving people around after spawning has a purpose ... :)


    G

  22. #22

    Default Re: Ways to make CTD with script ?

    Great work on that Anallein!

    Norman Invasion - The fate of England lies in your hands...

    Viking Invasion II - Unite Britain in the best TW campaign ever!

    Gods and Fighting Men: Total War - Enter the Mists of Myth in Ancient Ireland

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