Jump to content
Sign in to follow this  
Rejn

Possible CTD on a gamelogic

Recommended Posts

Ok I have a city combat mission.

1) Units have random waypoints and domove commands assigned to them via scripts to gamelogic locations.

2) Units spawn at specified gamelogic locations via the creatunit scripts.

3) Variables which caused savegame load crashes for me if in to larger quantity have been kept at a minimum.

4) each squad spawns at gamelogic such and such. Half way through the mission the units game logics are reassigned.

Forexample where units spawned at Spawn1 I have a trigger that sets the unit gamelogic spawn to another gamelogic spawn via the following command:

spawn1=spawn2

both spawn1 and spawn 2 are preplaced gamelogics.

I can play the mission fine without crash . But when I load the savegame and play after a short while my game crashes.

I have a looped script running in the background to check wether each individual squad has 0 men in it at which point it will launch the appropriate script to respawn the squad.

One squad is checked every 10 seconds. Markers are also positioned at the squads location every 90 seconds via the same script.

Can having gamelogic1=gamelogic2 for spawns cause a CTD when one reloads the savegame?

I need to find out wether the crash happens only halfway through the mission or not. Will report my findings when I have them...

Thankyou for any assistance.

Share this post


Link to post
Share on other sites

in addition.. I have about 80-90 spawned units running around the map... each squad respawns when there are 0 units in it.

Share this post


Link to post
Share on other sites

Only thing I can think of is to reduce the number of variables. If you can keep them all in one (or a few) large arrays, then it will help. An array only counts as one variable, no matter how big it is.

About how many variables have you got so far?

I was hoping this old OFP bug would be fixed confused_o.gif

Share this post


Link to post
Share on other sites

well theres the waypoint vairables which total 18, thats 2 per squad. Vairable names on waypoints are recycled.

I initially had 118 vairables on waypoints but managed to decrease it to 18, each waypoint has a waypoint statement.

Each unit has an array + eventhandler...

Here is a script for one of the squads:

Quote[/b] ]

"SquadLeaderG" createUnit [position at2, def5,"",0.75, "SERGEANT"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergg" createUnit [position at2, def5,"",0.6, "corporal"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergg" createUnit [position at2, def5,"",0.6, "corporal"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergb" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergat" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergat" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergb" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergmg" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergmedic" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

"soldiergat" createUnit [position at2, def5,"",0.5, "private"]

this addEventHandler ["killed", {_this select 0 exec "hide2.sqs"}]

this domove (position ref2)

~1

def5 setbehaviour "aware"

def5 setcombatmode "yellow"

def5 setspeedmode "full"

def5 allowfleeing 0

def5 enableattack false

~1

deletewaypoint [def5,1]

deletewaypoint [def5,2]

deletewaypoint [def5,3]

?(ret1):goto "sweb1"

~1

goto "sweb2"

#sweb1

[]exec "g1_2.sqs"

goto "sweb3"

#sweb2

[]exec "g1.sqs"

#sweb3

exit

position at2=gamelogic

def5=group (I have def5=creategroup resistance in an init of one of the starting units)

I have the squad delete 3 waypoints although there should only be one sometimes the units complete a waypoint without reaching it and / or rack up two waypoints so I just delete 3 incase.

Should I perhaps put the evenhandlers in the init to test?

EDIT: oh and i have 5 enemy sqads including this one which are the same and 4 friendly squads of roughly the same number men.

Share this post


Link to post
Share on other sites

18 variables doesn't sound like much, so that can't be the problem.

In your first post:

Quote[/b] ]But when I load the savegame and play after a short while my game crashes.

So after you load the save, it still lets you play for a while? Are you sure it's related to loading the save then?

Also, are you sure that the crash isn't just ArmA? Since 1.08 the game seems to crash a lot, I can't play for very long now until I get a crash confused_o.gif

Maybe something isn't being saved properly. Or it could just be a script error somewhere.

And lastly, what is the size of the save file when you do a savegame about halfway during you mission? If it's much larger than normal, it could indicate a problem with your scripts, maybe things being created and not being deleted properly, causing a memory leak.

Welcome to the world of scripting, expect many more headaches like this tounge2.gif

Share this post


Link to post
Share on other sites

Well i can play the map from beginning to end just fine without crash. Its when I quit arma and resume a saved game that the problem is encountered.

At one point I saved the game just before the crash and then couldn't load the save anymore as it would be instant crash.

I believe its an event.. ive had the same crash a few times and I did a test. I would reload and the crash would end up happening again after a breif period.

The same thing happened with v1.05 and I had good stability there. 1.08 has its share of problems but im convinced the problem lies ealsewhere.

I've noticed some of the enemy units walking through buildings in east carazol... which btw is where the second half of the mission takes place and where the crashing seems to occur. Im going to test first half of the mission to see if that works but previously ive managed to reload and then the crash would take place when the fighting moves to east carazol....

Im pretty much at a loss. D:

Im going over all the scripts...

I also have a tank that spawns with crew in this mission and when its crew dies the tank's dammage is set to 1, then deleted after 20 secs, the group which the crew is assigned to is deleted (for waypoint reasons) and then re-created. This script is in effect up until the second half of the mission where the crashing seems to occur..

The savegames are (the ones thats crashing after a short while) 7.041megs for the auto saves and 7.5megs for the usersaves.

which seems about right.

Btw these units respawn continously everytime the squads reach 0 until 180 casualties have been reached...

Loosing hairs over this lol...

I also have a sapper that detonates satchel charges at the beginning of the mission and a mortar script running. I'll try and get rid of those and see how that works... sigh... :/

Share this post


Link to post
Share on other sites

got rid of unessacary gamelogics, removed the sappers, used markers for unit spawns and instead of spawn1=spawn2 method used setmarkerpos command.

Played, saved, exited arma and managed to resume and play to end without CTD...

fingers crossed... smile_o.gif

Thanks for your help Matt. Now for beta testing heh...

Share this post


Link to post
Share on other sites
got rid of unessacary gamelogics, removed the sappers, used markers for unit spawns and instead of spawn1=spawn2 method used setmarkerpos command.

Played, saved, exited arma and managed to resume and play to end without CTD...

fingers crossed... smile_o.gif

Thanks for your help Matt. Now for beta testing heh...

If that really fixed it, well I find that strange crazy_o.gif

Well hopefully it worked.

Share this post


Link to post
Share on other sites

Its to early to tell really, perhaps the CTD conditions were not fullfilled. Im to tired to beta test further tonight. But have sent the mission on to my beta testers, you included if your up for it :P no pressure smile_o.gif

Share this post


Link to post
Share on other sites
Its to early to tell really, perhaps the CTD conditions were not fullfilled. Im to tired to beta test further tonight. But have sent the mission on to my beta testers, you included if your up for it :P no pressure smile_o.gif

Sounds good smile_o.gif

You got a PM.

Share this post


Link to post
Share on other sites

Ok we lowered the global variables considerably and seems ok.

I have another mission now that crashes 5 mins into the game after a load. Yet the ammount of variables isnt that high.

Im wondering do eventhandlers constitute/create a global variable?

I have over 80 units with event handlers spawning into the mission repeatedly (ie they respawn when dead)

50 of those have 2 eventhandlers.. so that makes 130-140 eventhandlers..

Can to many eventhandlers cause problems?

Share this post


Link to post
Share on other sites

If you don't assign a name to the eventandler then it wont be a global variable.

Taken from the wiki here.

Example 1 will create a global variable called 'EHkilled': <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">EHkilled = player addEventHandler ["killed", {_this exec "playerKilled.sqs"}]

Example 2 does not create a global variable: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["killed", {hint format["%1 killed by %2",_this select 0, _this select 1]}]

Any name that you create which can be accessed by any script and trigger in the mission is a global variable, although marker names given in the 'name' field in the mission editor don't seem to count as they are stored in a seperate place in the save file.

Share this post


Link to post
Share on other sites

hmmm... all my eventhandlers do not have variable names.. they just use "this"

I sense an ardous search lol.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×