OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 29 Dec 2005, 23:31:54

Title: The best way to mark objectives failed
Post 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.
Title: Re:The best way to mark objectives failed
Post by: Morglor9 on 29 Dec 2005, 23:51:36
I usually work it this way. in the same line that i put:
Code: [Select]
"1" objStatus "Done"I also put in
Code: [Select]
(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:
Code: [Select]
?(o1=true) : goto objective2
"1" objStatus "FAILED"

#objective2
?(o2=true) : goto objective3
"2" objStatus "FAILED"

#objective3
...
etc, etc, etc.

Syntax not garunteed.
Title: Re:The best way to mark objectives failed
Post by: penguinman on 30 Dec 2005, 02:09:54
ok, it works but I get an error for o6.


Code: [Select]
?(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
Title: Re:The best way to mark objectives failed
Post by: Morglor9 on 30 Dec 2005, 02:51:18
wow, my syntax was right and everything. just missed a couple of quotations.

What exactly is the error message?
Title: Re:The best way to mark objectives failed
Post by: The-Architect on 30 Dec 2005, 03:13:16
Won't the script go to the end by it's self? Do you need the goto "end" bit?
Title: Re:The best way to mark objectives failed
Post by: Morglor9 on 30 Dec 2005, 04:07:20
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.
Title: Re:The best way to mark objectives failed
Post by: Planck on 30 Dec 2005, 04:14:53
? !o1 : "1" objStatus "FAILED"
..
..
..
..
? !o6 : "6" objStatus "FAILED"

exit

Maybe???


Planck
Title: Re:The best way to mark objectives failed
Post by: penguinman on 30 Dec 2005, 21:44:48
well, everything is fine except for objective 6

It gives an error message with the

Quote
#objective6
?(o6|#=true) : goto "end"
"6" objStatus "FAILED"

I believe thats where it was
Title: Re:The best way to mark objectives failed
Post by: Pilot on 30 Dec 2005, 22:05:51
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
Title: Re:The best way to mark objectives failed
Post by: Morglor9 on 31 Dec 2005, 00:55:23
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:
Code: [Select]
#objective6
?(o6=true) : goto "finish"
"6" objStatus "FAILED"
exit

#finish
exit
I 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.
Title: Re:The best way to mark objectives failed
Post by: Planck on 31 Dec 2005, 01:05:31
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
Title: Re:The best way to mark objectives failed
Post by: penguinman on 31 Dec 2005, 01:36:04
plancks method dosent give any error message, and also dosent mark any objectives to failed.

Pilots method gives me an error

Code: [Select]
(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.
Title: Re:The best way to mark objectives failed
Post by: penguinman on 31 Dec 2005, 01:53:39
ok, Ive found it!
the winning combo

Quote
?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


Title: Re:The best way to mark objectives failed
Post by: Planck on 31 Dec 2005, 01:53:49
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