|
Post by finlander on Jan 14, 2014 18:23:48 GMT 1
Hi! I am testing a map in a campaign..I have reached a point where i have 2 last objectives. These are "take the town x and y". When i am reaching close to these two towns,the game crashes."memory error". I dont even reach the script area when this occurs. there is nothing specific happening at that point..no bombarding or planes attacking.. I just have to get close to these 2 areas and boom..! The map runs fine up to this point.
Any ideas..?
FIN
BTW what does this part of the script tell you...
function Back() if (GetNUnitsInArea(1,"Ort")<=0) or (GetNUnitsInArea(1,"Town")<=5) then RunScript("Gruppe1",2000); RunScript("Gruppe2",2000); RunScript("Gruppe3",2000); Suicide(); end; end;
function Gruppe1() Cmd(3,881,14756,12052); QCmd(3,881,9913,12551); QCmd(3,881,6178,10322); Suicide(); end;
function Gruppe2() Cmd(3,883,14353,12157); QCmd(3,883,9836,12451); QCmd(3,883,4456,12736); QCmd(3,883,3296,11136); Suicide(); end;
function Gruppe2() Cmd(3,885,21058,14226); QCmd(3,885,23882,15274); Suicide(); end;
I seem to have left out scrip id,s for the units 881 and 883. that should be the reason..?
|
|
bb
General
Blitzkrieg junkie (tried to quit several times).
Posts: 1,377
|
Post by bb on Jan 14, 2014 19:39:54 GMT 1
it sounds as a problem with the AI Zones, dont you have a defence area in those towns?
|
|
|
Post by Quintaxel on Jan 14, 2014 21:00:46 GMT 1
Finlander, you have 2 functions called called Gruppe2(). Last function should probably be called Gruppe3(), right?
Edit: In the function Back() you should put the Suicide(); as below; The script should run:
function Back() if (GetNUnitsInArea(1,"Ort")<=0) or (GetNUnitsInArea(1,"Town")<=5) then RunScript("Gruppe1",2000); RunScript("Gruppe2",2000); RunScript("Gruppe3",2000); end; -- end if Suicide(); end;
function Gruppe1() Cmd(3,881,14756,12052); QCmd(3,881,9913,12551); QCmd(3,881,6178,10322); Suicide(); end;
function Gruppe2() Cmd(3,883,14353,12157); QCmd(3,883,9836,12451); QCmd(3,883,4456,12736); QCmd(3,883,3296,11136); Suicide(); end;
function Gruppe3() Cmd(3,885,21058,14226); QCmd(3,885,23882,15274); Suicide(); end;
function Init() RunScript ("Back",4000); end;
|
|
|
Post by finlander on Jan 17, 2014 16:17:44 GMT 1
It worked..Thanks quintaxel..
Another problem that appears sometimes in chapters is the "you won" notice. In the beginning of the map, this happens altough the map(script) hasent even startted yet. I can tell for sure its not the BZM file or the script, take my word on this one. Can anyone tell why this happens and how is it fixed?..or is it?
There,s a sticky for ya again!
FIN
|
|
|
Post by Quintaxel on Jan 17, 2014 16:45:09 GMT 1
You're welcome Finlander. If the problem appears sometimes do mean that you get this 'You won' notice on the same map from time to time or that it occurs on different maps?
|
|
|
Post by fritzlang on Jan 17, 2014 17:37:16 GMT 1
It may be that you have assigned as a condition of victory, the elimination of units with an assigned script number, if this number does not appear from the beginning, the map gives you for winning, assume that you have eliminated these units
|
|
|
Post by Major Pain on Jan 17, 2014 17:40:19 GMT 1
finlander
If you did not set the objective values at the beginning of the script, they may be holding over values from somewhere else. Usually these are Global Variables that can migrate from map to map, or during a restart. You must set the objective values before you can runscript the Win function, or the first objective. If the objectives are run first, then a restart may cause a trigger. Sometimes transitioning from one map to another will also carry over the value needed for the win function to fire.
Since many Scripts use the same global variables, or the actual key variable name, like a letter or word, then you must reset the values to zero.
If you define the objective values as locals, you still have to make sure they are set to zero. If they are set to '1', then they trigger the Win function.
**
These objective values are usually checked in the script for a total of 1, by multiplying the objectives together.
If any single objective value is zero, then the product is zero and the Win function cannot fire. 1 * 1 * 1 * 0 = 0
If they produce a value of '1', then the Win function triggers. 1 * 1 * 1 * 1 = 1
Having said that... some scripts may count the completed objective by adding the total of the objective values. If there are three objectives, then once a total of '3' is detected, the win function fires. 1 + 1 + 1 = 3
Since I don't know exactly how you have structured your script, look at these values to see if they are causing the premature Win.
|
|
|
Post by finlander on Jan 17, 2014 18:38:21 GMT 1
Thanks guys..The case was as follows: I am creating a campaign..i am in the testing phase of a 2nd map,ok..the map had some crash issues as mentioned earlier. I ghanged the script and the map worked..i tested it trough! Then made some minor ghanges and startted to test it again(had to restart ofcourse) but then BOOM! YOU WON! This freaking map has given me more headache than any other chapter ever..but hey..no pain no gain..right?
|
|
|
Post by Quintaxel on Jan 17, 2014 20:40:44 GMT 1
Does this "You won' appear in the beginning of the game, right after the script runs? Without the script I can only guess what could trigger this condition. Indeed, debugging this BK Lua script sometimes feels like a punishment . At least I'm not the only one who's chewing on some piece of script. Let me know if I can do something.
|
|
|
Post by Major Pain on Jan 17, 2014 21:21:41 GMT 1
Writing Script is like chewing on glass sometimes...
|
|
|
Post by finlander on Jan 17, 2014 21:44:28 GMT 1
Thanks Doug and quint..chewing class..well you said it. Like said, the map and script worked before and now at the beginning before the script starts..I WINNNNNNN..!! Any reason to start the campaign from the start..with cheat..? Lets see.. Btw: the script will run anyways..
|
|