Home   Help Search Login Register  

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

0 Members and 2 Guests are viewing this topic.

Maximus-Sniper

  • Guest
Enemy Death Camera(Switch On/Off) In Action Menu?
« on: 24 May 2005, 01:02:35 »
Hi all :)

It's that possible to make a kill cam of one man?
I mean if i kill a officer, than i want a script to start a deth cam of the officer, when my bullet hit him, so i can see in slow motion fall down to the ground.

So i like to make a class UserActions so i can activate/deactivate the "Kill Cam" is that possible??

Sincerely, Maximus-Sniper :)
« Last Edit: 04 Jun 2005, 16:16:22 by Maximus-Sniper »

Offline 456820

  • Contributing Member
  • **
Re:Kill-Camera of one man(enemy)
« Reply #1 on: 24 May 2005, 20:28:23 »
very very simple when you know what youre doing but then i supose everything is anyway theres 2 ways.
1st way
create a .sqs called onplayerkilled for example
onplayerkilled.sqs
this detects when the player is dead and runs what evers in the script it also returns 2 arrays aoutomatically theses are
_player     =       The player
_killer        =       The killer
now just create the script and to target the player its
_camera CamSetTarget (vehicle _player)
and target the killer its
_camera CamSetTarget (vehicle _killer)

NOTE for that the cam neads to be caled Camera.
there you go that should get you started as long as you can do camera scripting

Lean Bear

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #2 on: 27 May 2005, 09:04:25 »
Hmm, I think this should really be in the Scripting Section - you'd probably have more luck there.

But, not to spoil the party...

If you want to target the unit you killed, you'd do something like this:

First, make the script.

_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] //adjust this to whatever you want

exit


That's just a really basic template to work from. Then you need to add you userActions:

class UserActions
{
   class DeathCamOn
   {
      displayName="Death Cam On";
      ~~~~~~~~~
      condition="this";
      statement="_unit addEventHandler [""killed"",{_unit exec ""deathcam.sqs""}]";
   };

   class DeathCamOff
   {
      displayName="Death Cam Off";
      ~~~~~~~~~
      statement="_unit RemoveEventHandler [""killed"",0]";
   };
};


I'm sure you can figure out the other bits and bobs, but hopefully a mod will move this thread to the right section so you can find your answer :)
« Last Edit: 27 May 2005, 09:05:37 by Lean Bear »

Offline 456820

  • Contributing Member
  • **
Re:Kill-Camera of one man(enemy)
« Reply #3 on: 27 May 2005, 19:57:30 »
Quote
If you want to target the unit you killed
Erm i thought Maximus-Sniper wanted a death cam where when your dead it shows who killed you and so on. and als you then go to say
Quote
_unit = _this select 0
wich i beleive in the onplayerkilled.sqs script is the player wich is now dead _this select 1 is the killer but you have no need to say that so you can use _killer and player becuase these have already been passed through the onplayerkilled.sqs script

Maximus-Sniper

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #4 on: 28 May 2005, 00:13:07 »
Hi all:)

Thanks for helping me :) I gonna try what you all say :D Hope it's gonna work :)

Thanks again :)

Maximus-Sniper

Lean Bear

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #5 on: 28 May 2005, 11:45:12 »
@ 456820

Quote
I mean if i kill a officer, than i want a script to start a deth cam of the officer, when my bullet hit him, so i can see in slow motion fall down to the ground.

Thats why I was using _this select 0 cause it wouldn't be using the onPlayerKilled.sqs. ;)

Maximus-Sniper

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #6 on: 30 May 2005, 20:29:08 »
Hi Lean Bear :)

I try your script, but when i press "Death Cam On" i gor this error:

Code: [Select]
'_unit|#| addEventHandler ["Killed",{_unit exec {RAST\script\rast_deathcam.sqs}}]'; Error Local variable in global space

And i had to change the

Class UserActions
      {
      class DeathCamOn
         {
               displayName="Death Cam On";
               position="";
         radius=1.00000;
               //condition="this";
         condition="(Format [{%1},Death_Cam_On] != {false}) && (player == this)";
               statement="_unit addEventHandler [""killed"",{_unit exec {\RAST\script\rast_deathcam.sqs}}]";
         };

Maybe it's something wrong with that  :-\

Offline 456820

  • Contributing Member
  • **
Re:Kill-Camera of one man(enemy)
« Reply #7 on: 30 May 2005, 20:38:37 »
well i think the thing is since this isnt rn through a script or atleast i dont think so its has no unit to add an event handler to so try this
Code: [Select]
this addEventHandler ["Killed",{_unit exec {RAST\script\rast_deathcam.sqs}}]';now simply add that line into the soldiers init filed and then have a go also you have the cript n the right place by the looks of it its going to be in a folder

Maximus-Sniper

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #8 on: 30 May 2005, 21:02:49 »
Hi 456820 :)

I try that, but don't work. :(
And i don't want to add anything in the init filed on the enemy. I want that script to know that. When i press "Death Cam On" i want that script to run the Death cam on every enemy i kill.

The rast_deathcam.sqs looks like this:

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]

exit

And in my config.cpp:

Code: [Select]
class UserActions
      {
      class DeathCamOn
         {
               displayName="Death Cam On";
               position="";
         radius=1.00000;
               //condition="this";
         condition="(Format [{%1},Death_Cam_On] != {false}) && (player == this)";
               statement="this addEventHandler [""killed"",{_unit exec {\RAST\script\rast_deathcam.sqs}}]";
         };

i tryed, i think all in the statement=_unit, unit, _this and this but nothing work :(

Maximus-Sniper

Offline 456820

  • Contributing Member
  • **
Re:Kill-Camera of one man(enemy)
« Reply #9 on: 31 May 2005, 08:04:55 »
well this would be tricky  well for me it would be becuase im not a to good a scripter
okay anyway ill make it up for you using what youve got and post it up later.

Lean Bear

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #10 on: 31 May 2005, 08:58:59 »
Maximus-Sniper

I'm sure you've tried this already, but did you replace both the _unit with this?

Also, with that camera script, it was only meant to be a template :P and it won't really work if you use it as it is. If you want to use it, that's fine with me - but I'd recommend adding this to the end:

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

~3 // this will cause a delay in between the exit command so you can actually see the unit die in slo-mo.

exit

Just thought of something else, with the class UserActions, what do you mean that its in a config.cpp? Did you make an addon?

Offline 456820

  • Contributing Member
  • **
Re:Kill-Camera of one man(enemy)
« Reply #11 on: 31 May 2005, 10:04:03 »
why have you edited the config.cpp file i would find it easier to create a script with a radio message wich turns it on and then every unit the plaer shoots shows them fall in slo mo,

Maximus-Sniper

  • Guest
Re:Kill-Camera of one man(enemy)
« Reply #12 on: 31 May 2005, 16:09:28 »
Hi Lean Bear and 456820 :)

Yes i have made a new Addon, my own ;) I have made a Sniper Pack :) :)
So i like to add that into my addon :) If it's possible? :)

yes i replaced both _unit with this in the statement:

Code: [Select]
statement="this addEventHandler [""killed"",{this exec {\RAST\script\rast_deathcam.sqs}}]";

And did the same in the script:

Code: [Select]
this = _this select 0

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

; Slowdown time

setAccTime 0.2

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

exit

But nothing happend :(
Here is a pic of the "Action Menu" or "User Action" i don't remember the name, hehe


Maximus-Sniper
« Last Edit: 31 May 2005, 16:42:44 by Maximus-Sniper »

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #13 on: 31 May 2005, 18:58:41 »
okay well this could be difficult
try this exatly like this

create a rigger 9999 x 99999 to cover the whole map and if the sniper's west set the trigger to east present,
condition = true
activation = eastsnipe = this list
/\ i think thats right.
then in that script put this  (note syntax not guarantted at all)

Code: [Select]
#loop
? slow_mo_deathcam_on : goto "EH"
{this <line to remove event handler's here> _x} foreach units eastsnipe
~5
goto "loop"
#EH
{this addEventHandler [""killed"",{this exec {\RAST\script\rast_deathcam.sqs}}]" _x} foreach units eastsnipe
? slow_mo_deathcam_off : goto "loop"
~5
goto "EH"

Hopefully that should be right let me walk you through it to make sure you understand

firstline detects if slow_mo_deathcam_on is on obdviously cahnge it to a variable you are using. next line gets rid of EH if they have them,
then it loops that until the death cam is turned on.
then it adds event handler's fired to all east units, then loops that until the death cam is turned off
then when it is goes back to begining

Hopeully you understanc that NOTE-i ont know how to remove event handlers
hope this works and good luck with your addon cya

Lean Bear

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #14 on: 01 Jun 2005, 09:06:36 »
@ Maximus-Sniper

Oh, ok. Since you're making you're own addon that's ok. Also, to save making a huge trigger on every mission you ever use (and having to adapt the existing missions) why not try this in the config:

class UserActions
{
   class DeathCamOn
   {
      displayName="Death Cam On";
      position="player";
      radius=99999;
      condition="this";
      statement="eastsnipe = this list; this exec ""RAST\script\rast_deathcam.sqs""";
   };
};


This will basically make a "trigger" 99,999m around the player (should cover the whole map :D) then in the script put what 456820 said.

Missing line:

{this removeAllEventHandlers _x} foreach units eastsnipe

/\ to remove all the event handlers of the units.