Folgore
General
(Once) BK Translator
Posts: 1,431
|
Post by Folgore on Mar 22, 2010 20:45:19 GMT 1
Hi, Flak and me are practicing on making maps. Here above there is a link for a map that runs fine but doesn't display objectives Maybe is something related to the .lua file? The 1.xml seems working since purple arrow are displayed... Any help will be appreciated. Thanks in advance. Map specs: - Single player
- 10 x 10
- HRA mod ver. 1.1
- Not historical but late war based
- AI = German
www.mediafire.com/?y5mjqjz1yz2
|
|
|
Post by LouisXIV on Mar 23, 2010 12:29:59 GMT 1
At the end of some of your DisplayTrace's, you have not put in a semi-colon. That's most likely your problem.
function StartObjective0() DisplayTrace("Devi conquistare il ponte") <<<< ObjectiveChanged(0,0); RunScript("CheckObjective0", 5000); Suicide(); end;
I also found an "end" missing in the CounterAttack01 function:
function CounterAttack01() if GetNUnitsInArea(0, "Enter01") => 2 then RunScript("PushThemBack01", 1000); end; as well as in CounterAttack02 and ToLose
You also had three => statements; they have to be >=
Some Suicide's were missing.
I would also suggest GiveCommand and GiveQCommand instead of Cmd and QCmd. The short versions sometimes give problems.
If you use the SciTE Editor, do you use the F5 function? It's very helpful.
Here is the corrected version of your script file.
|
|
Folgore
General
(Once) BK Translator
Posts: 1,431
|
Post by Folgore on Mar 23, 2010 21:15:33 GMT 1
Thank you very much Louis! You have been very fast and helpful, now everything it's OK. Just for my curiosity: This is the CounterAttack02 (CounterAttack01 is alike)
function CounterAttack02() if GetNUnitsInArea(0, "Enter02") >= 2 then RunScript("PushThemBack02", 1000); end; end;
And this is CounterAttack03
function CounterAttack03() if GetNUnitsInArea(0, "Enter03") >= 2 then RunScript("PushThemBack03", 1000); Suicide(); end; end; There is a Suicide() missing in CounterAttack02 and 01? Or is something related to scripting rules? Thanks again.
|
|
|
Post by LouisXIV on Mar 24, 2010 3:17:12 GMT 1
If you don't put a Suicide in CounterAttack02 then it will keep running over and over again. Every time it runs and detects your troops in zone Enter02 it will run PushThemBack02. Putting a Suicide inside the if section will stop the function running the first time it detects troops in Enter02 after it starts PushThemBack02 once.
If you want something to run over and over again until it detects a certain action and then stop, you can phrase it like this:
RunScript("DoItAgain",2000);
function DoItAgain() if GetNUnitsInArea(0,"Target") >= 1 then Suicide(); end; LandReinforcement(1000); end;
The Suicide command is tricky. I had trouble with it for a long time until I caught on. All it does is stop a function from running or repeating. If you don't put it into a function, the function will repeat once it is called until the script itself finally stops running.
|
|
Ocelo
General
Map Artist/Eastern Front enthusiast
Posts: 1,400
|
Post by Ocelo on Mar 30, 2010 1:40:21 GMT 1
Use the glow text option next time, Louis. All I can say is use trial and error. Start with a simple generated script via the generator made by Lee. Then edit the script, add functions to the end, learn new commands by examining the LUAs of simpler missions which do the particular thing you want in your mission.
|
|
|
Post by LouisXIV on Mar 30, 2010 11:58:21 GMT 1
Okay. So where's the glow text function?
It always helps to know what a command does.
Calvin's Blitzkrieg Scripting Guide and the Basic Scriping Lessons are very useful. You'll find them in the fifth post of this CDV Forum thread.
|
|