Home   Help Search Login Register  

Author Topic: Enemy Death Camera(Switch On/Off) In Action Menu?  (Read 10532 times)

0 Members and 2 Guests are viewing this topic.

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #45 on: 03 Jun 2005, 22:24:33 »
Yeah, 456820's right. There isn't really anything wrong with that script.

OK, 2 things. 1st keep the scripts you're using in the latest update but add this:

Code: [Select]
_unit = _this select 1

_cam="camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

; Slowdown time

setAccTime 0.2

_cam camSetTarget _unit
_cam camSetRelPos [3,5,3]
~3

exit

Then, if that doesn't work, try this...

I'd recomend trying what 456820 said before, using the "killed" EH. If the info he found is right, then using _this select 0 we can find out who is dead.

(oh btw 456820, the error that came up before about not being able to use this = _this select 0. It was the first "this" I was refering to - so the "killed" EH should work :) )

Code: [Select]
#loop

? slow_mo_deathcam : goto "EH"
{_x removeAllEventHandlers "killed"} forEach eastsnipe
~1

goto "loop"

#EH

{_x addEventHandler ["killed",{_unit = _this select 0; _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} forEach eastsnipe

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

Then, in "rast_deathcam.sqs":

Code: [Select]
_unit = _this select 0

_cam="camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

; Slowdown time

setAccTime 0.2

_cam camSetTarget _unit
_cam camSetRelPos [3,5,3]
~3

exit

Hope it works for you :)

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #46 on: 03 Jun 2005, 23:04:22 »
Hi mates :)

@456820

Ok i did that change and still the same, nothing happend :(

Thanks :)

@Lean Bear

Ok, i change the rast_deathcam.sqs to this:
Code: [Select]
_unit = _this select 1

_cam="camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

; Slowdown time

setAccTime 0.2

_cam camSetTarget _unit
_cam camSetRelPos [3,5,3]
~3

exit

But nothing happend, still the same when i kill a man :(

Ok, now i did the last change, used the killed, and change those two script to:

deatcam.sqs:
Code: [Select]
#loop

? slow_mo_deathcam : goto "EH"
{_x removeAllEventHandlers "killed"} forEach eastsnipe
~1

goto "loop"

#EH

{_x addEventHandler ["killed",{_unit = _this select 0; _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} forEach eastsnipe

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

And the rast_dethcam.sqs:
Code: [Select]
_unit = _this select 0

_cam="camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

; Slowdown time

setAccTime 0.2

_cam camSetTarget _unit
_cam camSetRelPos [3,5,3]
~3

exit

But nothing happend, the same. I kill him, and he died, but the camera did't start, hmmm

Ok... maybe it's some thing wrong with the Class UserActions:

Code: [Select]
class UserActions
      {
      class DeathCamOn
   Â Â Â Â Â Â {
               displayName="Death Cam On";
               position="";
         radius=99999;
         condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this)";
         statement="slow_mo_deathcam=true; this exec {\RAST\Script\Death_Cam\deathcam.sqs}";
   Â Â Â Â Â Â };

I feel it, we are realy close now  :P :P

EDIT:

btw, maybe somthing wrong with the init.sqs:
Code: [Select]
eastsnipe = [east1, east2, east3]

Maximus-Sniper
« Last Edit: 04 Jun 2005, 00:45:00 by Maximus-Sniper »

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #47 on: 04 Jun 2005, 00:54:40 »
Hi again :)

Last update of this script  ;D ;D

config.cpp @ Class UserActions:

Code: [Select]
   class UserActions
      {
      class DeathCamOn
   Â Â Â Â Â Â {
               displayName="Death Cam On";
               position="";
         radius=99999;
         condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this)";
         statement="slow_mo_deathcam=true; this exec {\RAST\Script\Death_Cam\deathcam.sqs}";
   Â Â Â Â Â Â };

and deathcam.sqs:

Code: [Select]
#loop

? slow_mo_deathcam : goto "EH"
{_x removeAllEventHandlers "killed"} forEach eastsnipe
~1

goto "loop"

#EH

{_x addEventHandler ["killed",{_unit = _this select 0; _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} forEach eastsnipe

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

and rast_deathcam.sqs:

Code: [Select]
_unit = _this select 0

_cam="camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

; Slowdown time

setAccTime 0.2

_cam camSetTarget _unit
_cam camSetRelPos [3,5,3]
~3

exit

and last the init.sqs:

Code: [Select]
eastsnipe = [east1, east2, east3]


But this not work   :( :(
So i think the problem maybe are something with the Class UserActions in the config.cpp or maybe the init.sqs in the mission  ??? ???

Thanks :)

Maximus-Sniper

EDIT 2:

GOOD NEWS
[/size]

Now it's allmost working, just a litle problem with the camera when i kill the enemy. Take a look at the picture :)


Ok :) Looks like the problem is now in the rast_deathcam.sqs maybe change some of the codes inside to make it work  ;)

EDIT 3:

GOOD NEWS AGAIN
[/size]

Ok, i did some change in the rast_deathcam.sqs to:

Code: [Select]
SetAccTime 0.2
_unit = _this select 0
_camPos = GetPos _unit
_cx = _camPos Select 0
_cy = _camPos Select 1
_cz = _camPos Select 2
_cam1 = "camera" CamCreate [_cx+2, _cy+1, _cz+2]
_cam1 CamSetTarget _unit
_cam1 CamSetFov 0.3
_cam1 CameraEffect ["Internal","Back"]
_cam1 CamCommit 2
@CamCommitted _cam1
SetAccTime 1.0

_cam1 CameraEffect ["Terminate","Back"]
CamDestroy _cam1

exit

Now we can see that man die in slow motion, hehe

But another problem, how do i turn OFF the Camara again? I only have "Death Cam On" in the Action Menu., When i press it, than the camara goes on and shows the Enemy Death cam all the time, how do i add the turn off in the Class UserActions in my config.cpp file?? hehe

BIG THANKS TO YOU ALL
[/size][/color]

Maximus-Sniper


EDIT 4:

Hi again :)

Ok i fix the "Death Cam Off" and now it's work to turn of and On the Enemy Death Cam  :P :P :P :P

So my Class UserActions in config.cpp looks like this now:

Code: [Select]
class UserActions
      {
      class DeathCamOn
         {
               displayName="Death Cam On";
               position="";
         radius=99999;
         condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this)";
         statement="slow_mo_deathcam=true; this exec {\RAST\Script\Death_Cam\deathcam.sqs}";
         };
      class DeathCamOff
         {
               displayName="Death Cam Off";
               position="";
         radius=99999;
         condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this)";
         statement="slow_mo_deathcam=false; this exec {\RAST\Script\Death_Cam\deathcam.sqs}";
         };

The Action Menu looks like this:

 ;D ;D ;D

But another thing, i know i have seen it befor, when you press the "......On" than it will show automatic "....OFF" As you see now, the "Death Cam On/OFF" are inn the Action Menu at the same time.. Maybe one of you may know how i can fix that??


Thanks :

Maximus-Sniper
« Last Edit: 04 Jun 2005, 01:41:22 by Maximus-Sniper »

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #48 on: 04 Jun 2005, 08:49:14 »
shame but good work
i could do that on/off thing as a script but i couldnt do it in a user actions thing
but it doesnt matter to much aslong as it works unless someone else knows the answer
good work hope to see a beta version soon

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #49 on: 04 Jun 2005, 09:21:59 »
Hi 456820 :)

I say good work to you and Lean Bear for helping with this script :)  :P

btw the On/Off Swith, what about to use class EventHandlers in the config.cpp file ?? In the "init=" field ??

Thanks :)

Maximus-Sniper

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #50 on: 04 Jun 2005, 09:28:11 »
im not to sure about that kind of file so i odnt know if its possible it could be though
lean bear might no he seems like he understands the user action file

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #51 on: 04 Jun 2005, 10:46:40 »
Hi :)

I'm not realy sure about that Class EventHandlers. But i did a try with another script i have, the bullet cam. :) So if i use the Bullet Cam script i got "Bullet Cam On" twise in the Actions Menu  :-\ if i add another sniper to. If you use 10 RAST snipers, you will got 10 "Bullet Cam On" in the Action Menu. So i think the right way maybe in the Class UserActions ???

I'm not sure, hope somebody know how to fix that in the Class UserActions  :P :P :P

Thanks :)

Maximus-Sniper

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #52 on: 04 Jun 2005, 12:43:13 »
Hey! Glad it finally works :D !!

With your class UserActions you need to put something in them (eg a variable) so that when it is true the other is false, and vica versa.

But this really depends on what you want.

Do you want it so when you have switched on "Death Cam On" you want it to be like that for every kill you make. And so after it is switched on you have the option to switch it off.

Or do you want the option to switch it off only when the death cam is running?

(I'd pressume the first - so I'll write the code for that :) )

edit

OK, here's all the code:

First, in your units' config.cpp, you'll need to make a class EventHandlers and modify the class UserActions

Code: [Select]
class Eventhandlers
{
   init="cam_enabled=true";
};

class UserActions
{
   class DeathCamOn
   {
      displayName="Death Cam On";
      position="";
      radius=99999;
      condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this) && cam_enabled";
      statement="slow_mo_deathcam=true; this exec {\RAST\Script\Death_Cam\deathcam.sqs}";
   };
     
   class DeathCamOff
   {
      displayName="Death Cam Off";
      position="";
      radius=99999;
      condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this) && !cam_enabled";
      statement="slow_mo_deathcam=false";
   };
};

This makes a new variable, cam_enabled which from when the unit is created is set to true: displaying the action "Death Cam On".

"Death Cam Off" will only be displayed when cam_enabled is false. Which only happens once the scipt "deathcam.sqs" is running thus hiding the action "Death Cam On" :)

"deathcam.sqs":

Code: [Select]
#loop

cam_enabled=true
? slow_mo_deathcam : goto "EH"
{_x removeAllEventHandlers "killed"} forEach eastsnipe
~1

goto "loop"

#EH

{_x addEventHandler ["killed",{_unit = _this select 0; _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} forEach eastsnipe
cam_enabled=false

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

"rast_deathcam.sqs":

Code: [Select]
SetAccTime 0.2
_unit = _this select 0
_camPos = GetPos _unit
_cx = _camPos Select 0
_cy = _camPos Select 1
_cz = _camPos Select 2
_cam1 = "camera" CamCreate [_cx+2, _cy+1, _cz+2]
_cam1 CamSetTarget _unit
_cam1 CamSetFov 0.3
_cam1 CameraEffect ["Internal","Back"]
_cam1 CamCommit 2
@CamCommitted _cam1
SetAccTime 1.0

_cam1 CameraEffect ["Terminate","Back"]
CamDestroy _cam1

exit

btw You'll probably be wanting a method now so that you don't need to make an init.sqs each time you want to use this, right?

I'll try and fix that up for you as well :)
« Last Edit: 04 Jun 2005, 13:03:37 by Lean Bear »

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #53 on: 04 Jun 2005, 13:24:01 »
Hi Lean Bear :)

Ok.. i'll try, but one problem, hehe
I have the class Eventhandlers in my config.cpp before and i use it, here take a look, and where should i add "cam_enabled=true" in that line?:
Code: [Select]
class EventHandlers
      {
      init="RAST_M82fx=loadFile ""\RAST\Script\M82A1_FX\m82fx.sqf""; [_This Select 0] Exec ""\RAST\Script\wbe_tracerfx\wbe_tracerfx.sqs""";
      //init="RAST_M82fx=loadFile ""\RAST\Script\M82A1_FX\m82fx.sqf""; [_This Select 0] Exec ""\RAST\Script\wbe_tracerfx\wbe_tracerfx.sqs""; this exec ""\RAST\Script\Bullet_Cam\sniperinit.sqs""; PosBullcam=loadFile ""\RAST\Script\Bullet_Cam\PosBullcam.sqf""";
      fired="if ((_this select 4) in [""AMMOM82APMag"",""AMMOM82ATMag""]) then {_this call RAST_M82fx}";
      };
   };

But i was working on another solution, hehe

I made two new sqs files and i call them for menu_1.sqs and menu_2.sqs

Take a look :)

menu_1.sqs
Code: [Select]
player addaction ["Enemy Death Cam","\RAST\Script\Death_Cam\menu_2.sqs"]
player addEventHandler _this exec "\RAST\script\Death_Cam\deathcam.sqs"   <----- Here is the big problem :( :( :( :(
track = false

and menu_2.sqs
Code: [Select]
_ID = _this select 2
player removeAction _ID
? !(track) : track = true ; player addaction ["Enemy Death Cam On", "\RAST\Script\Death_Cam\menu_2.sqs"];exit
? (track) : track = false; player addaction ["Enemy Death Cam Off", "\RAST\Script\Death_Cam\menu_2.sqs"]

Than i add this line at the end of my init= filed:

Code: [Select]
init="RAST_M82fx=loadFile ""\RAST\Script\M82A1_FX\m82fx.sqf""; [_This Select 0] Exec ""\RAST\Script\wbe_tracerfx\wbe_tracerfx.sqs""; this exec ""\RAST\Script\Death_Cam\menu_1.sqs""";

This works in the Action Menu. When i start the mission i have this "Enemy Death Cam" when i press it, i got this "Enemy Death Cam On" and Enemy Death Cam Off" when i press "Enemy Death Cam On" and kill the man, nothing happend, lol  ;D ;D ;D ;D

So the problem are in menu_1.sqs

But if you know how i can add "cam_enabled=true" in my class EventHandlers init field, mybe that's better  ;) ;)

Quote
btw You'll probably be wanting a method now so that you don't need to make an init.sqs each time you want to use this, right?

I'll try and fix that up for you as well

Yeah man, that's it's exactelly what i want. To remove the init.sqs and have that included in my addon for ever, hehe

Thank you so match if you can help me with that after we have fix this liltle problem in the Action Menu, hehe

Thanks :)

Maximus-Sniper
« Last Edit: 04 Jun 2005, 13:30:25 by Maximus-Sniper »

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #54 on: 04 Jun 2005, 13:26:22 »
@ Maximus-Sniper

Simple, just do this:

Code: [Select]
class EventHandlers
      {
      init="cam_enabled=true;RAST_M82fx=loadFile ""\RAST\Script\M82A1_FX\m82fx.sqf""; [_This Select 0] Exec ""\RAST\Script\wbe_tracerfx\wbe_tracerfx.sqs""";
      //init="RAST_M82fx=loadFile ""\RAST\Script\M82A1_FX\m82fx.sqf""; [_This Select 0] Exec ""\RAST\Script\wbe_tracerfx\wbe_tracerfx.sqs""; this exec ""\RAST\Script\Bullet_Cam\sniperinit.sqs""; PosBullcam=loadFile ""\RAST\Script\Bullet_Cam\PosBullcam.sqf""";
      fired="if ((_this select 4) in [""AMMOM82APMag"",""AMMOM82ATMag""]) then {_this call RAST_M82fx}";
      };
   };

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #55 on: 04 Jun 2005, 13:42:35 »
Hi Lean Bear :)

Ok i change the init= field and now it's works allmost, one problem, when i press the "Death Cam On" and kill that man, it's works, but when i Press "Death Cam Off" than it turn it off and disappear form the Action Menu  ??? ??? So now i could't see the "Death Cam On" anymore, hehe  ;D

Maximus-Sniper

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #56 on: 04 Jun 2005, 13:47:22 »
OK, did you replace the "deathcam.sqs" script?

Cause I double checked it and it all matches up fine.

Also, when you start the mission, what do you see in the action menu?

Do you only see "Death Cam On" or do you see both "Death Cam On" and "Death Cam Off"?

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #57 on: 04 Jun 2005, 13:53:34 »
Hi again :)

Yes i change the deathcam.sqs to :

Code: [Select]
#loop

cam_enabled=true
? slow_mo_deathcam : goto "EH"
{_x removeAllEventHandlers "killed"} forEach eastsnipe
~1

goto "loop"

#EH

{_x addEventHandler ["killed",{_unit = _this select 0; _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} forEach eastsnipe
cam_enabled=false

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

And when i start the test mission i see "Death Cam On" only, when i press it, than it change to "Death Cam Off" and it's works, but when i press the "Death Cam Off" than it's disappear and can't see the "Death Cam On" any more

Maybe somthing in the Class UserActions ??

Maximus-Sniper

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #58 on: 04 Jun 2005, 13:59:35 »
OK, try this in the class UserActions

Code: [Select]
class UserActions
{
   class DeathCamOn
   {
      displayName="Death Cam On";
      position="";
      radius=99999;
      condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this) && cam_enabled";
      statement="slow_mo_deathcam=true; this exec {\RAST\Script\Death_Cam\deathcam.sqs}";
   };
     
   class DeathCamOff
   {
      displayName="Death Cam Off";
      position="";
      radius=99999;
      condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this) && !cam_enabled";
      statement="slow_mo_deathcam=false; cam_enabled=true";
   };
};

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #59 on: 04 Jun 2005, 14:27:00 »
Hi :)

Ok i change the Class UserActions :)

But it's still the same, it's disappear when i turn it off  ???

Maximus-Sniper