Home   Help Search Login Register  

Author Topic: Script checking if an objective is finished?  (Read 1026 times)

0 Members and 2 Guests are viewing this topic.

Offline Brian

  • Members
  • *
Script checking if an objective is finished?
« on: 18 Feb 2007, 00:55:44 »
Okay, here's the deal: I have a complicated mission set-up in which one trigger sets an objective as "Done" when it deactivates (it's activated by any East unit inside an area), and then a second trigger that sets a second objective as "Done" whenever all player-used vehicles are either returned to their proper position or destroyed. I need some way to have the game confirm when both objectives are completed and end the mission. However, I can't find any functions in the ComRef meant for use in conditionals. The only thing at all related to objectives was this:
Code: [Select]
"obj_1" objStatus "Done"... and that's only useful for setting the objectives, not checking if they're set. Help?

Offline Brian

  • Members
  • *
Re: Script checking if an objective is finished?
« Reply #1 on: 18 Feb 2007, 01:03:55 »
Oh, and also - I'd much rather this be done using the in-game editor, because I have a lot already set up using it and it's going to be difficult to switch things around.

Offline Brian

  • Members
  • *
Re: Script checking if an objective is finished?
« Reply #2 on: 18 Feb 2007, 02:36:43 »
Gaah. I'm troubleshooting the script that tells me if all planes are where they should be, and it keeps giving me an error. See if you can find the problem in this:

- falcon4 is one of the six vehicles that I need in their proper place.
- falcon4pad is the marker that I placed over the area falcon4 needs to be.

It's telling me the error is at the pound (#).

Code: [Select]
_veh = falcon4

? (damage _veh == 1): goto "dead"

_counter1 = 0
#check
~2
? (position _veh == getmarkerpos "falcon4pad")#: goto "add1"
goto "minus1"

#add1
? (_counter1 == 1): goto "check"
goto "do1"

#do1"
_counter1 = (_counter1 + 1)
counter6 = _counter1
goto "check"

#minus1
? (_counter1 == 0): goto "check"
goto "do2"

#do2
_counter1 = (_counter1 - 1)
counter6 = _counter1
goto "check"

#dead
counter6 = 1
exit

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Script checking if an objective is finished?
« Reply #3 on: 18 Feb 2007, 08:45:17 »
Edit your previous post (in this case the first) instead of posting multigigatude of posts in a row, please.  :dry:


Quote
It's telling me the error is at the pound (#)
That's because position is an array, like [162554,7653276,10], instead of a integer value and you can't check if an array is the same as another array with ==
You need to compare each of the elements in the arrays separately..

And that's not very clever way to do this because it's probably 1 to 10000000000000000000000000000000000000 that the plane will ever be at the exact same position as the marker..

You should use distance check instead. There is a function to convert two positions into a distance value in the Editor's Depot -> Functions, called distancepos.sqf (by snYpir), or distancePos3D.sqf (by Liquid_Silence).
With either one those you can have a distance check between the plane and the marker and once the plane is close enough to the marker all is dandy..


EDIT:
Quote
I need some way to have the game confirm when both objectives are completed and end the mission.
If you are using that script for this you are going waaaayyy too complicated routes here..  :whistle:

You say you have two trigger that set an objectives "done".
So why don't you just add two global variables and set those true in those same triggers and then have the end trigger condition matching those variables  ???

Trigger 1 On Act.
Code: [Select]
"1" objStatus "done"; MY_ObjOneDone = true

Trigger 2 On Act.
Code: [Select]
"2" objStatus "done"; MY_ObjTwoDone = true

End trigger Condition
Code: [Select]
MY_ObjOneDone && MY_ObjTwoDone
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.