Advertisement
Faguss

OFP Crates In Open Truck

Jan 25th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. ; Script that I'm using in my "Convoy" mission to place crates in the truck
  2. ; If crates were loaded to open truck then show that they're inside
  3.  
  4.  
  5.  
  6. ; Create dummy crates
  7.  
  8. ~1
  9. _crate1a = "unimogadd_crate" camCreate [0,0,0]
  10. _crate2a = "unimogadd_crate" camCreate [0,0,0]
  11. _crate3a = "unimogadd_crate" camCreate [0,0,0]
  12. _crates = [_crate1a,_crate2a,_crate3a]
  13.  
  14.  
  15.  
  16. ; Wait for player to load crates to open truck
  17.  
  18. #WaitToLoad
  19. @Crate_Vehicle in [t1,t3,t4]
  20. _anchor = Crate_Vehicle
  21.  
  22. ? _anchor == t1 : _CoordsX=[-0.461914,0.53125,-0.0126953]; _CoordsY=[-1.86377,-1.87866,-1.96484]; _CoordsZ=[1.72502,1.73502,2.11004]; _dirs=[273.866,270.366,359.866]
  23. ? _anchor in [t3,t4] : _CoordsX=[-0.0625,-0.0644531,-0.0625]; _CoordsY=[-1.46631,0.691406,-0.415771]; _CoordsZ=[1.5351,1.58001,1.90002]; _dirs=[269.866,269.866,269.866]
  24.  
  25. _i = 0
  26. ~3
  27.  
  28.  
  29. ; Place dummy crates in the truck
  30.  
  31. #SetPosLoop
  32. ? Crate_Vehicle != _anchor : {_x setPos [0,0,0]} forEach _crates; goto "WaitToLoad"
  33.  
  34. _crate = _crates select _i
  35. _dir = getDir _anchor
  36. _A = _CoordsX select _i
  37. _B = _CoordsY select _i
  38.  
  39. _X = (getpos _anchor select 0) + _B*(sin _dir) + _A*(cos _dir)
  40. _Y = (getpos _anchor select 1) + _B*(cos _dir) - _A*(sin _dir)
  41. _Z = (getpos _anchor select 2) + (_CoordsZ select _i)
  42.  
  43. _crate setPos [_X, _Y, _Z]
  44. _crate setDir _dir + (_dirs select _i)
  45.  
  46. ? _i < (count _crates)-1 : _i=_i+1; goto "SetPosLoop"
  47.  
  48. ~0.01
  49. _i = 0
  50. goto "SetPosLoop"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement