Home   Help Search Login Register  

Author Topic: Dead unit can't surrender  (Read 1138 times)

0 Members and 1 Guest are viewing this topic.

Offline limmy3

  • Members
  • *
  • OFP crazy!
Dead unit can't surrender
« on: 13 Apr 2007, 00:58:13 »
Hello you all,

I am trying to write a scrip (with my very poor knowlege) for the Mission Failed!
Whitch means, are some of my men dead the failture varible is true and the rest of it shall surrender and a cutscene of the surrendering units will play. Then the debriefing apears and the intro loose.


Whitch will done with the count command or simular.
Code: [Select]
expCond="(Alive Leader groupRM) And ((Count Units groupRM) < 3)";     
The fact is that a dead unit can't surrender ... in real life.  :(  or he is a zombie  ;)
How can I check if the unit is dead,
  • if the unit is dead nothing will be done
  • if the unit is alive it shall drop it's weapon and surrender.
And all enemy units shall cease fire
Code: [Select]
?({alive East} thislist)
thislist_x SetCombatMode "BLUE"



Code: [Select]
; loose.sqs
LP_2 SetDammage 1.0

DisableUserInput false
cuttext ["","black in ", 5]
_cam = "camera" camCreate [10400.0,73.0,3000.0]
_cam cameraEffect ["internal", "front"]
CutText ["","black in ",1]
_cam CamSetTarget W_1
_cam camSetRelPos [0, 5, 2.75]
_cam camCommit 6
@camCommitted _cam
~6
_cam CamSetTarget W_5
_cam camSetRelPos [0, 5, 2.75]
_cam camCommit 4
@camCommitted _cam
TitleCut ["ROYAL MARINES cease fire.", "plain", 1]
W_5 PlayMove "CommandHoldFire"
~5
TitleCut ["There's no need to loose more lives.", "plain", 1]
~5
TitleCut ["You fought bravely.", "plain", 1]
~2
TitleCut ["DROP YOUR GEAR!", "plain", 1]
~2

;THIS DOES NOT WORK ????


#check_alive
?alive W_1 : goto "dWW1"
?alive W_2 : goto "dWW2"
?alive W_3 : goto "dWW3"
?alive W_4 : goto "dWW4"
?alive W_5 : goto "dWW5"
?alive W_6 : goto "dWW6"
?alive W_7 : goto "dWW7"
?alive W_8 : goto "dWW8"
;goto "check_alive"

#dWW1
W_1 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~1
W_1 action ["drop Weapon",Barrel,0,0,"ukf_browning"]
~1
W_1 SwitchMove "FXStandSurUniv"


#dWW2
W_2 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~2
W_2 SwitchMove "FXStandSur"

#dWW3
W_3 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~3
W_3 SwitchMove "FXStandSurUniv"
~1
_cam CamSetTarget W_4
_cam camSetRelPos [0, 5, 2.75]
_cam camCommit 4
@camCommitted _cam
#dWW4
W_4 action ["drop Weapon",Barrel,0,0,"UKF_GPMG"]
~2
W_4 SwitchMove "FXStandSurDown"


#dWW5
W_5 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~3
W_5 action ["drop Weapon",Barrel,0,0,"ukf_browning"]
~1
W_5 SwitchMove "FXStandSur"

#dWW6
W_6 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~1
W_6 SwitchMove "FXStandSurUniv"

#dWW7
W_7 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~2
W_7 SwitchMove "FXStandSurDown"

#dWW8
W_8 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~2
W_8 SwitchMove "FXWomanSur"


~2
_cam CamSetTarget W_1
_cam camSetRelPos [0, 2, 1.7]
_cam camCommit 10
@camCommitted _cam
~5


TitleCut ["","BLACK out",1]
~2
officergo = true
_cam cameraEffect ["terminate", "back"]
camDestroy _cam
_cam = "camera" camCreate [0,0,0]
_cam cameraEffect ["internal", "front"]
_cam CamSetTarget Flag_1
_cam camSetRelPos [0, 18, 5]
_cam camCommit 2
@camCommitted _cam
~0.5
TitleCut ["","BLACK in",2]
~10
_cam cameraEffect ["internal", "front"]
_cam CamSetTarget Flag_1
_cam camSetRelPos [0, 60, 50]
_cam camCommit 30
@camCommitted _cam
~2
TitleCut ["","BLACK out",2]
~3
camDestroy_cam
;EndLoose=true
Exit

All help is :welcome:

Regards limmy3
The only necessary for triumph of evil is for good men to do nothing.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Dead unit can't surrender
« Reply #1 on: 13 Apr 2007, 02:01:40 »
Can't you use countunits?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Dead unit can't surrender
« Reply #2 on: 13 Apr 2007, 18:08:51 »
limmy3, your problem lays in the fact that your script runs through to the very end no matter what because there is no instruction after any of the #dWW labels for the script to go anywhere else than straight down, and when the alive check reaches the first dead soldier the script will jump into the corresponding dWW label and run to the end from there without checking for any more dead soldiers..

I mean that if for example W_1 is dead your script will jump to the #dWW1 label and run through from there as it has nowhere else to go and thus all soldiers after W_1, dead or alive, will do the surrender stuff.

Add boolean variables in the beginning of your script for each of the #dWW labels, for example:
Code: [Select]
; loose.sqs
LP_2 SetDammage 1.0

dWW1_checked = false

Then modify the alive checks
Code: [Select]
?alive W_1 && !(dWW1_checked): goto "dWW1"Again, do this for each of the checks..

And finally, modify each of the dWW labels accordingly
Code: [Select]
#dWW1
dWW1_checked = true
W_1 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~1
W_1 action ["drop Weapon",Barrel,0,0,"ukf_browning"]
~1
W_1 SwitchMove "FXStandSurUniv"
goto "check_alive"

Should work..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline limmy3

  • Members
  • *
  • OFP crazy!
Re: Dead unit can't surrender
« Reply #3 on: 15 Apr 2007, 19:29:49 »
Thank you h-  :good:

it took me some hours to modify it to my necessity but I'm sadisfied.  :D

Know I need to to the some with the win.sqs. Then I'm a step further

Code: [Select]
; loose.sqs
LP_2 SetDammage 1.0

dWW1_checked = false
dWW2_checked = false
dWW3_checked = false
dWW4_checked = false
siChW5_checked = false
dWW5_checked = false
dWW6_checked = false
dWW7_checked = false
dWW8_checked = false

DisableUserInput false

cuttext ["","black in ", 5]
_cam = "camera" camCreate [10400.0,73.0,3000.0]
_cam cameraEffect ["internal", "front"]
CutText ["","black in ",1]
_cam CamSetTarget W_1
_cam camSetRelPos [0, 5, 2.75]
_cam camCommit 2
@camCommitted _cam
~2
_cam CamSetTarget W_5
_cam camSetRelPos [0, 5, 2.75]
_cam camCommit 3
@camCommitted _cam
~2
_cam CamSetTarget W_5
_cam camSetRelPos [0, 35, 20]
_cam camCommit 3
@camCommitted _cam




#check_alive
?alive W_5 && !(siChW5_checked): goto "siChW5"
?alive W_1 && !(dWW1_checked): goto "dWW1"
?alive W_2 && !(dWW2_checked): goto "dWW2"
?alive W_3 && !(dWW3_checked): goto "dWW3"
?alive W_4 && !(dWW4_checked): goto "dWW4"
?alive W_5 && !(dWW5_checked): goto "dWW5"
?alive W_6 && !(dWW6_checked): goto "dWW6"
?alive W_7 && !(dWW7_checked): goto "dWW7"
?alive W_8 && !(dWW8_checked): goto "dWW8"
;goto "check_alive"
~3
_cam CamSetTarget W_4
_cam camSetRelPos [0, 5, 2.75]
_cam camCommit 3
@camCommitted _cam
~1
_cam CamSetTarget W_2
_cam camSetRelPos [0, 15, 5]
_cam camCommit 3
@camCommitted _cam
4
_cam CamSetTarget W_6
_cam camSetRelPos [0, 15, 8]
_cam camCommit 3
@camCommitted _cam
~1
TitleCut ["","BLACK out",1]
~1
officergo = true
_cam cameraEffect ["terminate", "back"]
camDestroy _cam
_cam = "camera" camCreate [0,0,0]
_cam cameraEffect ["internal", "front"]
_cam CamSetTarget Flag_1
_cam camSetRelPos [0, 18, 5]
_cam camCommit 2
@camCommitted _cam
~0.5
TitleCut ["","BLACK in",2]
~5
_cam cameraEffect ["internal", "front"]
_cam CamSetTarget Flag_1
_cam camSetRelPos [0, 60, 50]
_cam camCommit 15
@camCommitted _cam
~2
TitleCut ["","BLACK out",2]
~3
EndLoose = true
~5
camDestroy_cam
Exit



#siChW5
siChW5_checked = true
;W_5 PlayMove "CommandHoldFire"
W_5 sideChat "ROYAL MARINES CEASE FIRE."
~3
W_5 sideChat "There's no need to loose more lives."
~3
W_5 sideChat "You fought bravely."
~2
W_5 sideChat "DROP YOUR GEAR!"
~2
goto "check_alive"

;GroupNorth_1 setCombatMode "BLUE"

#dWW1
dWW1_checked = true
W_1 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~1
W_1 action ["drop Weapon",Barrel,0,0,"ukf_browning"]
~3
W_1 SwitchMove "FXStandSurUniv"
goto "check_alive"



#dWW2
dWW2_checked = true
W_2 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~2
W_2 SwitchMove "FXStandSur"
goto "check_alive"

#dWW3
dWW3_checked = true
W_3 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~3
W_3 SwitchMove "FXStandSurUniv"
goto "check_alive"



#dWW4
dWW4_checked = true
W_4 action ["drop Weapon",Barrel,0,0,"UKF_GPMG"]
~2
W_4 SwitchMove "FXStandSurDown"
goto "check_alive"

#dWW5
dWW5_checked = true
W_5 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~3
W_5 action ["drop Weapon",Barrel,0,0,"ukf_browning"]
~3
W_5 SwitchMove "FXStandSur"
goto "check_alive"

#dWW6
dWW6_checked = true
W_6 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~1
W_6 SwitchMove "FXStandSurUniv"
goto "check_alive"

#dWW7
dWW7_checked = true
W_7 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~2
W_7 SwitchMove "FXStandSurDown"
goto "check_alive"

#dWW8
dWW8_checked = true
W_8 action ["drop Weapon",Barrel,0,0,"UKF_SA80"]
~2
W_8 SwitchMove "FXWomanSur"
goto "check_alive"

Regards limmy3  :)
The only necessary for triumph of evil is for good men to do nothing.