Home   Help Search Login Register  

Author Topic: Problem  (Read 1507 times)

0 Members and 1 Guest are viewing this topic.

Alex

  • Guest
Problem
« on: 23 Jan 2006, 20:19:05 »
Hi all, I have this error in my script... How can I fix it?



Here Is My Script:

Code: [Select]
;keep camera black for initilization
titleCut ["","black in",9999]

; Create camera
_cam = "camera" camCreate [0,0,0]
_cam cameraEffect ["internal","back"]

;give camera initial target (boat)
_cam camSetTarget boat
_cam camSetRelPos [25,6,-0.1]
_cam camCommit 0


; Move camera for effect
_cam camSetRelPos [-2, 60,0.3]
_cam camCommit 20

;fade in now everything's set
titleCut ["","black in",3]
titlecut ["RFK Assassination Project","plain down",2]

;wait and switch camera angle (with fade)
~16
titleCut["","black in",1]
titlecut ["By Alex Kane 8AM","plain down",2]

_cam camSetRelPos [-24,30,-0.5]
_cam camCommit 0

_cam camSetRelPos [10,100,0]
_cam camCommit 50

~13

titleCut ["","black in",1]
titlecut ["What Could Have Happened...","plain down",2]
_cam camSetRelPos [-3,45,0.1]
_cam camCommit 0

_cam camSetRelPos [-7,45,0.1]
_cam camCommit 8

; fade out when boat reaches trigger near waypoint
@boatAtDropOff



titleCut["","black out",3]
~3.1

officer unassignVehicle
u1 unassignVehicle
u2 unassignVehicle
u3 unassignVehicle
u4 unassignVehicle
u5 unassignVehicle
u6 unassignVehicle

officer action ["eject",boat]
u1 action ["eject",boat]
u2 action ["eject",boat]
u3 action ["eject",boat]
u4 action ["eject",boat]
u5 action ["eject",boat]
u6 action ["eject",boat]

~0.1

officer setPos [(getPos landLogic),(getPos landLogic),0]
u2 setPos [(getPos landLogic select 0),(getPos landLogic select 1)+2,0]
u3 setPos [(getPos landLogic select 0),(getPos landLogic select 1)+4,0]
u4 setPos [(getPos landLogic select 0),(getPos landLogic select 1)+6,0]
u5 setPos [(getPos landLogic select 0),(getPos landLogic select 1)+8,0]
u6 setPos [(getPos landLogic select 0),(getPos landLogic) select 1+10,0]

~0.1

; continue when units are off boat
titlecut ["Had The Kennedy's Not Been Killed....","plain down",2]

_cam camSetRelPos [0,0,0]
_cam camCommit 0

_cam camSetTarget g1
_cam camCommit 0

; delete boat
deleteVehicle boat

; tell group that camera is ready for group to move
groupMove = true

; short wait
~0.1

;fade back in
titlecut ["","black in",3]


~7
;final shot
titleCut ["","black in",1]
titlecut ["Would History Be Any Different?....","plain down",2]
_cam camSetTarget (getPos leader)
_cam camSetRelPos [4,10,-0.3]
_cam camCommit 0

~4

;fadeOut to end
titleCut ["","black out",5.5]

;fadeSound
5.5 fadeMusic 0
5.5 fadeSound 0

~6
;end
endGame = true

Thanks,

Alex

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Problem
« Reply #1 on: 23 Jan 2006, 20:45:27 »
It should be:

unassignVehicle unitname

http://www.ofpec.com/editors/comref.php?letter=U#unassignVehicle

So instead of:

u1 unassignVehicle
u2 unassignVehicle
u3 unassignVehicle
u4 unassignVehicle
u5 unassignVehicle
u6 unassignVehicle

Try:

{unassignVehicle _x} forEach [u1,u2,u3,u4,u5,u6]
« Last Edit: 23 Jan 2006, 20:46:34 by THobson »

Alex

  • Guest
Re:Problem
« Reply #2 on: 23 Jan 2006, 21:01:08 »
and for {unassignVehicle _x} forEach [u1,u2,u3,u4,u5,u6]  do I change any of it to name of my boat?

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Problem
« Reply #3 on: 23 Jan 2006, 22:50:24 »
No, unassignVehicle applies to whatever vehicle the unit is in so you need not name the vehicle.  The code that THobson is suggesting simplifies your script by shortening many lines into one line using the forEach command.  The _x in the command line applies to each element in the array, one element at a time.

{command _x} forEach arrayname

this executes the command on each element of arrayname.  In your case the array is the list of units in the vehicle: [u1, u2, u3 .....etc] and the command to be executed on each unit is unassignVehicle.
« Last Edit: 23 Jan 2006, 22:56:56 by Raptorsaurus »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Problem
« Reply #4 on: 23 Jan 2006, 22:57:00 »
Actually you could replace the whole of:

officer unassignVehicle
u1 unassignVehicle
u2 unassignVehicle
u3 unassignVehicle
u4 unassignVehicle
u5 unassignVehicle
u6 unassignVehicle

officer action ["eject",boat]
u1 action ["eject",boat]
u2 action ["eject",boat]
u3 action ["eject",boat]
u4 action ["eject",boat]
u5 action ["eject",boat]
u6 action ["eject",boat]


With:

{unassignVehicle _x;_x action ["eject",boat]} forEach [officer,u1,u2,u3,u4,u5,u6]

What that will do is unassign and eject each of the units in the list

It saves typing and so reduces the chance of a typo.

If all those units are in the same group then it gets even easier:

{unassignVehicle _x;_x action ["eject",boat]} forEach units group officer

I would not call a unit officer though - just in case it has a special meaning in OFP.
« Last Edit: 23 Jan 2006, 23:00:16 by THobson »