OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Aldo15 on 31 Oct 2011, 22:26:03

Title: Mission Problem
Post by: Aldo15 on 31 Oct 2011, 22:26:03
Hi guys

I'm making a new mission but I've got problems wit it.

Objectives.

Destroy two shilkas, save a files on a USB and get out of there.

On Editor:

I've put two shilkas with name Zsu1 and Zsu2, and Computer with name Pc1. I wanted different ends (I did them)

Ends:

1. If the player didn't destroy anything
2. If the player destroyed a shilka but he doesnt save the file
3 If the player destroyed two shilkas but no file saved
4. If the player just saved the file.
5. If the player destroyed a shilka and saved the file on the USB
6. If the player did all objectives (counting two shilkas)

Well my problem is the the end #2 it always appear, other ends don't appear. I made those scripts for my mission I want to know what it's wrong.

1 Script: This script is to do the 2 objective "The file". If the player is near pc, he will get a action. this is paremeter---> On activation player addAction ["Conect USB" , "drive.sq"] Now the script


player removeaction 0


Code: [Select]
"2" obJstatus "done"
player AddRating 7000

poplachno = false
Poplach = true

Ah I forgot it: In a init.sqs file I put that : poplachno = true and Poplach = false. Well let's continue.

Well I don't put a trigger for the shilkas but wit the next script, the objective one can active.

I put a trigger with these paremeters:

Active by player ;
 type : Switch ;
condition: Player in thislist
On activation : [] exec "checkout.sqs"

Well this is fucker script who I cannot fix, I don't know what it's wrong. Check out.

Code: [Select]
_a = Zsu1
_b = Zsu2

#Check

if (Alive _a or Alive _b  && poplachno) then {goto "anything"}
if (not alive _a or not alive _b && poplachno) then {goto "AShilka"}
if (not alive _b && not alive _a && poplachno) then {goto "TwoShilka"}
if (poplach && alive _a && alive _b) then {goto "JustPc"}
if (not alive _b && not alive _a && poplach) then {goto "All"}
if (not alive _a or not alive _b && poplach) then {goto "Twoobjectives"}
goto "Check"

#AShilka

"1" objStatus "done"
"2" objStatus "failed"
"3" objStatus "done"

Fnu = true

goto "Exit"

#Anything

"1" objStatus "failed"
"2" objStatus "failed"
"3" objStatus "done"

Fnf = true

goto "Exit"

#TwoShilka

"1" objStatus "done"
"2" objStatus "failed"
"3" objStatus "done"

Fnd = true

goto "Exit"

#JustPc

"2" objStatus "done"
"1" objStatus "failed"
"3" objStatus "done"

Fnt = true

goto "Exit"

#All

"1" objStatus "done"
"2" objStatus "done"
"3" objStatus "done"

Fnc = true

goto "Exit"

#Twoobjectives

"1" objStatus "done"
"2" objStatus "done"
"3" objStatus "done"

Fns = true


#Exit

Exit

To finish I also put 6 ends

End #1 is actived by Fnu
End #2 is actived by Fnd
End #3 is actived by Fnt
End #4 is actived by Fnc
End #5 is actived by Fnf
End #6 is actived by Fns

That's all, please help me, If you can't understand those scripts tell me and I'll send my mission.

Cheers,
Aldo15
Title: Re: Mission Problem
Post by: Walter_E_Kurtz on 31 Oct 2011, 23:00:44
You need more brackets to better define your conditions. If you write "A or B and C", do you mean:
      "(A or B) and C"      which needs A and C in order to become true
OR  "A or (B and C)"      which becomes true with just A

Quote
if ((Alive _a && Alive _b) && poplachno) then {goto "anything"}
if ((not alive _a && not alive _b) && poplachno) then {goto "TwoShilka"}
if ((not alive _a or not alive _b) && poplachno) then {goto "AShilka"}
if ((alive _a && alive _b) && poplach) then {goto "JustPc"}
if ((not alive _a && not alive _b) && poplach) then {goto "All"}
if ((not alive _a or not alive _b) && poplach) then {goto "Twoobjectives"}

Edit: also moved the TwoShilka line ahead of AShilka - checks for both conditions (&&) should be done before those for either condition (or).
Title: Re: Mission Problem
Post by: Aldo15 on 03 Nov 2011, 20:56:43
Thanks WEK. Now it's work fine...  :good: