Home   Help Search Login Register  

Author Topic: Advanced help! (Need quickly)  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

Offline unleashed2k

  • Members
  • *
Advanced help! (Need quickly)
« on: 28 May 2007, 01:00:00 »
I am using Kegetys Spectating Script 1.2 1.4
This script (advanced) only works for both sides, the problem is I want each team to be limited to there side.

Quote
;
; Spectating script v1.4 by Kegetys <Kegetys@dnainternet.net>
; http://www.ofp.kege.cjb.net
;
; Requires Armed Assault Version 1.00 or up
;
; NV added by Solom

?(MySide==1): DeathCamArray=[b1,b2,b3,b4,b5,b6,b7,b8]
?(MySide==2): DeathCamArray=[a1,a2,a3,a4,a5,a6,a7,a8]
DeathCamArrayTemp = []
{if ((not isNull _x) and (alive _x)) then {DeathCamArrayTemp = DeathCamArrayTemp + [_x]}} foreach DeathCamArray
DeathCamArray = DeathCamArrayTemp
DeathCamNameCache = []
{if (name _x == "Error: No unit") then {DeathCamNameCache = DeathCamNameCache + ["object"]} else {DeathCamNameCache = DeathCamNameCache + [name _x]}} foreach DeathCamArray

DeathCamEventHandledVehicles = []

{DeathCamEventHandledVehicles = DeathCamEventHandledVehicles + [_x];_x addEventHandler["fired",{if ((_this select 0) == (vehicle DeathCamCurTarget)) then {_this exec "missileCam.sqs"}}]} forEach DeathCamArray

_seagull = _this select 2
_seagull setpos[0,0,0]

DeathCamCurCamTarget = "HeliHEmpty" CreateVehicle getpos player
_HeightDummy = "HeliHEmpty" CreateVehicle getpos player


~2.5
titleCut ["","BLACK OUT", 1.5]
~2
titleCut ["","BLACK IN", 4]


? count DeathCamArray == 0 : _vhltemp = player
? count DeathCamArray == 0 : goto "seagull"

DeathCamMissileCamEnabled = true
DeathCamNVGEnabled = false
DeathCamCineViewSpecial = 0
DeathCamComSpeed = 0.4
DeathCamRelPos = [0,-2,0.3]
DeathCamTarHeight = 1.7
DeathCamIndex = 0

DeathCamCurTarget = player
DeathCam = "camera" camCreate [(getpos player select 0)+2, (getpos player select 1)+2, 200 ]
DeathCam cameraEffect ["internal","front"]
DeathCam camSetTarget vehicle DeathCamCurCamTarget
DeathCam camSetPos [(getpos player select 0)+2, (getpos player select 1)+2, 500 ]
DeathCam camSetFOV 0.976
DeathCam camCommand "inertia on"
DeathCam camCommit 0

showCinemaBorder false



#start
_ok = false
_ok = createDialog "RscFDFDlgSpectateDeath"
ctrlShow [1046001,false];ctrlShow [1046002,false];ctrlShow [1046003,false];ctrlShow [1046004,false];ctrlShow [1046005,false];ctrlShow [1046006,false];ctrlShow [1046007,false];ctrlShow [1046008,true];ctrlShow [1046009,false];ctrlShow [1046010,false];ctrlShow [1046011,false];ctrlShow [1046012,false];ctrlShow [1046013,false];ctrlShow [1046014,false];ctrlShow [1046015,false];ctrlShow [1046016,false];ctrlShow [1046017,false];ctrlShow [1046018,false];ctrlShow [1046019,false];ctrlShow [1046020,false];ctrlShow [1046021,false];ctrlShow [1046022,false];ctrlShow [1046023,false];ctrlShow [1046024,false]
ctrlSetText [116969,name player]
ctrlShow [1047002,false];ctrlShow [1047001,false];ctrlShow [1048001,false]

sliderSetRange [1046010, 0.2, 7]
sliderSetPosition [1046010, 1]


kegfoo = 0
{_i = lbAdd [1047002, DeathCamNameCache select kegfoo];lbSetData [1047002, _i, format["%1",kegfoo]];if (side _x == west) then {lbSetColor[1047002, _i, [0.8,0.8,1,0.8]]};if (side _x == EAST) then {lbSetColor[1047002, _i, [1,0.8,0.8,0.8]]};if (side _x == GUER) then {lbSetColor[1047002, _i, [0.8,1,0.8,0.8]]};if ((name _x == format["%1","Error: No unit"]) and ((DeathCamNameCache select kegfoo) == "object")) then {lbSetColor[1047002, _i, [0,0,0,0.4]]};kegfoo = kegfoo + 1} foreach DeathCamArray
lbSetCurSel [1047002, 0]

kegfoo = 0
{if (player == _x) then {lbSetCurSel [1047002, kegfoo] };kegfoo = kegfoo + 1} foreach DeathCamArray



if !(_ok) then {hint "notok";exit}

#loop
kegfoo = 0
{if (not alive _x) then {lbSetColor[1047002, kegfoo, [0,0,0,0.4]]};kegfoo = kegfoo + 1} foreach DeathCamArray

? lbData[1047002,(lbCurSel 1047002)] != format["%1",DeathCamIndex] : _TargetChange = 1

? _TargetChange == 1 : DeathCamIndex = lbCurSel 1047002
? (_TargetChange == 1) and (dialog): 0 exec "nextCam.sqs"
_TargetChange = 0

_seagull setpos[0,0,(getpos _vhlTemp select 2)+15]
? !dialog : goto "seagull"

DeathCam camCommit DeathCamComSpeed
_vhlTemp = vehicle DeathCamCurTarget


;missileCam
if !(_vhlTemp in DeathCamEventHandledVehicles) then {DeathCamEventHandledVehicles = DeathCamEventHandledVehicles + [_vhlTemp];_vhlTemp addEventHandler["fired",{if ((_this select 0) == (vehicle DeathCamCurTarget)) then {_this exec "missileCam.sqs"}}]}

; NVG View ?
if DeathCamNVGEnabled then {camUseNVG true} else {camUseNVG false}

; Cinematic view?
? DeathCamCineViewSpecial == 1 : goto "camspecial"

; 1st Person view?
? DeathCamCineViewSpecial == 3 : goto "camspecial1st"

; Gunner view?
? DeathCamCineViewSpecial == 4 : goto "camspecialgunnerview"

; The following will reduce the effect of warping spectated object to the camera itself

_Divider = 100 - (speed _vhlTemp * 2)
? _Divider < 10 : _Divider = 10

_moX = (getpos DeathCamCurCamTarget select 0) + (((getpos _vhlTemp select 0) - (getpos DeathCamCurCamTarget select 0))/_Divider)
_moY = (getpos DeathCamCurCamTarget select 1) + (((getpos _vhlTemp select 1) - (getpos DeathCamCurCamTarget select 1))/_Divider)
_moZ = ((getpos DeathCamCurCamTarget select 2)-DeathCamTarHeight) + (((getpos _vhlTemp select 2) - ((getpos DeathCamCurCamTarget select 2)-DeathCamTarHeight))/_Divider)

; Workaround for an ofp "feature" with the setpos/getpos commands and roadway lods
_HeightDummy setpos [getpos _vhlTemp select 0,getpos _vhlTemp select 1,0]
_h2 = _vhlTemp distance _HeightDummy
_h1 = _h2 + DeathCamTarHeight
? vehicle DeathCamCurTarget == DeathCamCurTarget : _moZ = ((_h1)-DeathCamTarHeight) + (((_h2) - ((_h1)-DeathCamTarHeight))/_Divider)


DeathCamCurCamTarget setpos[_moX,_moY,_moZ  + DeathCamTarHeight]

DeathCamCurCamTarget setdir getdir _vhlTemp

; Top view?
? DeathCamCineViewSpecial == 2 : goto "camspecialTop"

_RealRelPos = [(DeathCamRelPos select 0) * (sliderPosition 1046010), (DeathCamRelPos select 1) * (sliderPosition 1046010), (DeathCamRelPos select 2) * ((sliderPosition 1046010)*2)]

? ((speed vehicle DeathCamCurTarget >= 150)) : _RealRelPos = [(DeathCamRelPos select 0) * (sliderPosition 1046010) * 5, (DeathCamRelPos select 1) * (sliderPosition 1046010) * 5, (DeathCamRelPos select 2) * ((sliderPosition 1046010)*2) * 5]

DeathCam camSetRelPos _RealRelPos



goto "loop"


; Cinematic view
#camspecial
DeathCamCurCamTarget setpos[getpos _vhlTemp select 0,getpos _vhlTemp select 1,(getpos _vhlTemp select 2) + DeathCamTarHeight]
DeathCamCurCamTarget setdir getdir _vhlTemp

; Reset cam if object is far away... if its a very fast object use a more distant view
? ((speed vehicle DeathCamCurTarget >= 150)) and (((DeathCam) distance (DeathCamCurCamTarget)) > 400) : DeathCam camSetRelPos [3,400.1,10.0]
? ((speed vehicle DeathCamCurTarget < 150)) and (((DeathCam) distance (DeathCamCurCamTarget)) > 100) : DeathCam camSetRelPos DeathCamRelPos

; Distance slider sets zoom (FOV) in cinematic view
DeathCam camSetFOV 0.976 * ((sliderPosition 1046010)/5)

goto "loop"

; Top view
#camspecialTop
DeathCamCurCamTarget setdir 0

DeathCam camSetPos [getpos DeathCamCurCamTarget select 0,getpos DeathCamCurCamTarget select 1,(getpos DeathCamCurCamTarget select 2)+(30 * sliderPosition 1046010 * 1.5)]

goto "loop"


; User pressed esc, return seagull control
#seagull

titleCut ["","BLACK IN", 0]
_seagull setpos [0,0,0]

_h = sqrt(((_vhlTemp distance _seagull) * (_vhlTemp distance _seagull)) - (sqrt(((getpos _vhlTemp select 0) * (getpos _vhlTemp select 0)) + ((getpos _vhlTemp select 1) * (getpos _vhlTemp select 1))) * sqrt(((getpos _vhlTemp select 0) * (getpos _vhlTemp select 0)) + ((getpos _vhlTemp select 1) * (getpos _vhlTemp select 1))))) + ((getpos _vhlTemp select 2)+15)
? _h > 80 : _h = 80


_seagull setpos [(getpos _vhlTemp select 0)-15+random 30, (getpos _vhlTemp select 1)-15+random 30,_h]

_seagull setvelocity[0,0,0]
_seagull switchCamera "INTERNAL"
_seagull cameraEffect ["terminate","FRONT"]
_seagull camCommand "manual on"

; Return back to spectating
@((getpos _seagull select 2) > 150) && (count DeathCamArray != 0)

titleCut ["","BLACK OUT", 0.5]
~0.5
titleCut ["","BLACK IN", 2]
DeathCam cameraEffect ["internal","front"]
goto "start"

#camspecial1st

closedialog 821151551
titleCut ["","BLACK IN", 1]
~0.1
_ok = createDialog "RscFDFDlgSpectateDeath1st"

hint " Press ESC to return "

_name = name (DeathCamArray select DeathCamIndex)
if (_name == "Error: No unit") then {_name = ""}
ctrlSetText [116969,_name]

#camspecial1stloop
~0.001
(vehicle DeathCamCurTarget) switchCamera "INTERNAL"
(vehicle DeathCamCurTarget) cameraEffect ["terminate","FRONT"]

? (DeathCamCineViewSpecial == 3) && (dialog) : goto "camspecial1stloop"
DeathCamCineViewSpecial = 0

titleCut ["","BLACK IN", 1]
closedialog 821151552
~0.1

DeathCam cameraEffect ["internal","front"]
goto "start"

#camspecialgunnerview

closedialog 821151551
titleCut ["","BLACK IN", 1]
~0.1
_ok = createDialog "RscFDFDlgSpectateDeath1st"

hint " Press ESC to return "

_name = name (DeathCamArray select DeathCamIndex)
if (_name == format["%1","error: no unit"]) then {_name = ""}
ctrlSetText [116969,_name]

#camspecialgunnerviewloop
~0.001
(vehicle DeathCamCurTarget) switchCamera "GUNNER"
(vehicle DeathCamCurTarget) cameraEffect ["terminate","BACK"]

? (DeathCamCineViewSpecial == 4) && (dialog) : goto "camspecialgunnerviewloop"
DeathCamCineViewSpecial = 0

titleCut ["","BLACK IN", 1]
closedialog 821151552
~0.1

DeathCam cameraEffect ["internal","front"]
goto "start"
that was onPlayerRespawnAsSeagull.sqs

Help?
« Last Edit: 28 May 2007, 04:13:48 by unleashed2k »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced help! (Need quickly)
« Reply #1 on: 28 May 2007, 01:12:16 »
What you need to do is remove entries from the death cam array based on side i.e.

Code: [Select]
DeathCamArray = [A1,A2,A3,A4,A5,A6,A7,A8,B1,B2,B3,B4,B5,B6,B7,B8]
{if (side _x != side player) then {DeathCamArray = DeathCamArray - [_x]}} forEach DeathCamArray;
urp!

Offline unleashed2k

  • Members
  • *
Re: Advanced help! (Need quickly)
« Reply #2 on: 28 May 2007, 01:48:40 »
I'm more of a php/sql kind of guy, its very hard for me to learn vbs code. :(

1-8: Names Members of each side (a1-a8, b1-b8)
A = OPFOR
B = BLUEFOR

A friend gave me a similar code like yours (Dont remember it) but I couldn't get it to work.

I have been looking in the biki on arma commands and other stuff, ive tried alot of things like creating varibles
like for example {if (side player == west) then {DeathCamArray1 = DeathCamArray}} forEach DeathCamArray;

With DeathCamArray1 showing the names of bluefor  DeathCamArray1 = [A1,A2,A3,A4,A5,A6,A7,A8]
But looking at it I believe i just did the opposite (opfor would be viewing bluefor in spect I think, but anyways it still doesnt work.)

Any help would be much awesome, while I wait I will try some more ways...

Offline unleashed2k

  • Members
  • *
Re: Advanced help! (Need quickly)
« Reply #3 on: 28 May 2007, 03:17:24 »
Update: I've been doing some googling and searching.

I have these varibles placed, but no luck, I go straight to bird.
?(side Player == West): MySide = 1
?(side Player == East):  MySide = 2
(in init.sqs)

DeathCamArray=[]
?(MySide==1): DeathCamArray=[W1,W2,W3,W4]
?(MySide==2): DeathCamArray=[E1,E2,E3,E4]
If anyone can correct to see what im doing wrong, ill give you a gold metal and a free cookie

::edit::
updated script to 1.4
« Last Edit: 28 May 2007, 04:18:14 by unleashed2k »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Advanced help! (Need quickly)
« Reply #4 on: 28 May 2007, 09:54:12 »
unleashed2k, do not double post.
If you have something to add to your post after a short period of time (a couple of days should pass first) edit your post instead of replying to yourself.
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced help! (Need quickly)
« Reply #5 on: 29 May 2007, 03:17:01 »
unleashed... did you even try my code?
urp!

Offline unleashed2k

  • Members
  • *
Re: Advanced help! (Need quickly)
« Reply #6 on: 04 Jun 2007, 01:00:19 »
Yes I have, but sadly it just returns me to seagull without a spectator menu.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Advanced help! (Need quickly)
« Reply #7 on: 04 Jun 2007, 03:52:39 »
Code: [Select]
?(MySide==1): DeathCamArray=[b1,b2,b3,b4,b5,b6,b7,b8]
?(MySide==2): DeathCamArray=[a1,a2,a3,a4,a5,a6,a7,a8]

Try replacing those lines with the code I gave you.

Edit: never mind.... I did not see that you have already altered the code. Try my code again but also print out the value of DeathCamArray afterwards to see what is in it.
« Last Edit: 04 Jun 2007, 04:05:59 by Mr.Peanut »
urp!

Offline DucusSumus

  • Members
  • *
  • I'm a llama!
Re: Advanced help! (Need quickly)
« Reply #8 on: 04 Jun 2007, 04:40:51 »
OFP scripting is closer to php than vbs...

Mr. Peanut's suggestions should work fine.