OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 29 Dec 2005, 23:31:54
-
hello,
What is the best way, at the end of the mission, to mark all the objectives the player didnt complete as failed.
-
I usually work it this way. in the same line that i put:
"1" objStatus "Done"I also put in (some unused variable)=true and do so for each objective. For instance, objective one might be o1, objective two o2, etc. make sure to set all the variables to false in init.sqs.
then, at the end of a mission, write a script that checks if the different variables are true. for any that are still false, have it do "#" objStatues "FAILED"
something like this:
?(o1=true) : goto objective2
"1" objStatus "FAILED"
#objective2
?(o2=true) : goto objective3
"2" objStatus "FAILED"
#objective3
...etc, etc, etc.
Syntax not garunteed.
-
ok, it works but I get an error for o6.
?(o1=true) : goto "objective2"
"1" objStatus "FAILED"
#objective2
?(o2=true) : goto "objective3"
"2" objStatus "FAILED"
#objective3
?(o3=true) : goto "objective4"
"3" objStatus "FAILED"
#objective4
?(o4=true) : goto "objective5"
"4" objStatus "FAILED"
#objective5
?(o5=true) : goto "objective6"
"5" objStatus "FAILED"
#objective6
?(o6=true) : goto "end"
"6" objStatus "FAILED"
#end
exit
-
wow, my syntax was right and everything. just missed a couple of quotations.
What exactly is the error message?
-
Won't the script go to the end by it's self? Do you need the goto "end" bit?
-
yes, but if o6=true, the script needs to skip the "6" objStatus "FAILED" part, because that means that the player has completed objective six.
-
? !o1 : "1" objStatus "FAILED"
..
..
..
..
? !o6 : "6" objStatus "FAILED"
exit
Maybe???
Planck
-
well, everything is fine except for objective 6
It gives an error message with the
#objective6
?(o6|#=true) : goto "end"
"6" objStatus "FAILED"
I believe thats where it was
-
All of the objectives have a problem. They should by using two equal signs:
?(o6==true) : goto "end"
Or just do it the way Planck said.
-Pilot
-
really? two eqaul signs? i've always worked this kind of thing with only one. perhaps because it is asking if o6=true, it doesn't matter. besides, if that were the reason it should be screwing up objectives 1-5 too.
about the script, i really have no idea. maybe try this overly complicated jibberish:
#objective6
?(o6=true) : goto "finish"
"6" objStatus "FAILED"
exit
#finish
exitI have no idea if that will do anything for you. since all the rest seems to work, i may suggest that you check carefully for any spelling or syntax errors in the last section of your script.
-
When comparing values using if(?) you must use '=='.
The single '=' is used for assigning values, for example:
myvariable = 10
and for comparisons:
? myvariable == 10 : dosomething
Planck
-
plancks method dosent give any error message, and also dosent mark any objectives to failed.
Pilots method gives me an error
(o6==true)|#: "6" objstatus "FAILED" error: type any expected number,somthing, somthing, somthing
and marks all to failed weather their completed or not
im a little suprised that nobody has made a script or anything for this, I thought it was kind of mission essential.
-
ok, Ive found it!
the winning combo
?o1: goto "obj2"
"1" objstatus "FAILED"
#obj2
?o2: goto "obj3"
"2" objstatus "FAILED"
#obj3
?o3: goto "obj4"
"3" objstatus "FAILED"
#obj4
?o4: goto "obj5"
"4" objstatus "FAILED"
#obj5
?o5: goto "obj6"
"5" objstatus "FAILED"
#obj6
?o6 : exit
"6" objstatus "FAILED"
exit
-
I don't think it is failing only on o6, I think it fails on all of them, but it only reports the last error which happens to be o6.
Try removing the line dealing with o6 and you will get the error for o5 instead.
Edit: Good show. :)
Perhaps my example above needed brackets.
Planck