Home   Help Search Login Register  

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

0 Members and 2 Guests are viewing this topic.

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #30 on: 02 Jun 2005, 18:58:39 »
Hi again :)

I see you both are fighting  :P :P

Ok.. i try your new idea @Lean Bear :)

First i add this into my deathcam.sqs:

Code: [Select]
#loop

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

goto "loop"

#AddKilledEH

{_x addEventHandler ["killed",{goto "AddHitEH"}]} forEach eastsnipe

#AddHitEH

{_x addEventHandler ["hit",{_this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} forEach eastsnipe

? !slow_mo_deathcam : goto "loop"
~1

goto "AddKilledEH"

And change the rast_deathcam.sqs to:

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

Than i start my demo test mission  :P
I still have the init.sqs inside the mission folder :)

Than i start the mission, and pressed the "Death Cam On" and shot one man (east1), nothing happend :(

So i try the another ida :)
I change the deathcam.sqs to:
Code: [Select]
#loop

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

goto "loop"

#EH

{_x addEventHandler ["hit",{goto "CheckDead"}]} forEach eastsnipe

#Check Dead

_dammage = _this select 1
_dammage >= 1 : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
_dammage < 1 : goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

And did nothing with the rast_deathcam.sqs now :)

Than i try the mission again :)
When i press the "Death Cam On" i got this error:

Code: [Select]
'_dammage < 1 |#|: goto "loop": Error Uknown Operator

Looks like we missed something in the deathcam.sqs this line:

Code: [Select]
_dammage < 1 : goto "loop"

Thanks :)

Maximus-Sniper

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #31 on: 02 Jun 2005, 19:20:29 »
okay the error message
to be truthull i dont know

the line you are using only checks if the target is wounded i dont think it will detect if hes dead but im not totally sure try instead
_dammage == 1
that should check when the dammage equals oris the same as one not totally sure but if its right it might also get rid of the error message

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #32 on: 02 Jun 2005, 19:57:36 »
Hi 456820 :)

I change that, but i almost got the same error:

Code: [Select]
'_dammage ==1 |#|: goto "loop": Error Uknown Operator

So i don't realy know what the problem are :(


btw 456820 :) I'll try your "Suprise Suprise" mission, realy good work man :) Maybe some day you can make a Sniper Mission, with my sniper pack  :P :P

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #33 on: 02 Jun 2005, 22:26:47 »
@ 456820

That part of the code is to check if the unit is only wounded, as suppsoed to dead. Any value less than one (completely dead) will make it loop again.

I put that in cause we don't want the deathcam running when the enemy get's shot in the foot.

The line checking if the unit is dead is:

_dammage >= 1 : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"

In which case the rast_deathcam.sqs would be run.

But I don't know why the error comes up, its a perfectly valid command :P

@ Maximus-Sniper

Try it this way instead:

(_dammage < 1): goto "loop"

Keep using the init.sqs for now :) Its the safer method. We can fix the selecting units bit after the death cam works ;)


Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #34 on: 02 Jun 2005, 23:50:36 »
Hi again :)

@Lean Bear

Ok, i change the line to:

Code: [Select]
#loop

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

goto "loop"

#EH

{_x addEventHandler ["hit",{goto "CheckDead"}]} forEach eastsnipe

#CheckDead

_dammage = _this select 1
_dammage >= 1 : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
(_dammage < 1): goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

But got the same error:

Code: [Select]
'(_dammage < 1)|#|: goto "loop": Error Uknown Operator

Hmmm, i'm not realy sure what the problem is, maybe because we are using two  :goto "loop" in here:

Code: [Select]
#CheckDead

_dammage = _this select 1
_dammage >= 1 : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
(_dammage < 1): goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

i'm not sure  ???

btw ,take a look Here :)
« Last Edit: 03 Jun 2005, 00:06:50 by Maximus-Sniper »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #35 on: 03 Jun 2005, 00:01:20 »
I don't see this:

(_dammage ==1)

In any part of your script, if that was part of the error message, what is it refering to, not that script anyway.   ;D


Planck
I know a little about a lot, and a lot about a little.

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #36 on: 03 Jun 2005, 00:13:03 »
Hi Planck :)

Do you maybe now where i should put that in my script?
My deathcam.sqs looks like this now:
Code: [Select]
#loop

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

goto "loop"

#EH

{_x addEventHandler ["hit",{goto "CheckDead"}]} forEach eastsnipe

#CheckDead

_dammage = _this select 1
_dammage >= 1 : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
(_dammage < 1): goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

Where should i put this
Code: [Select]
(_dammage ==1)into that script ??

Thanks :)

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #37 on: 03 Jun 2005, 00:19:59 »
I think you should change these 2 lines:

_dammage >= 1 : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
(_dammage < 1): goto "loop"

To read:

?(_dammage >= 1) : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
?(_dammage < 1): goto "loop"

Try that anyway.......


Planck
I know a little about a lot, and a lot about a little.

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #38 on: 03 Jun 2005, 00:27:32 »
Hi Planck :)

I did change those two lines :)

Now i got a new error:

Code: [Select]
'_dammage = _this select 1|#|': Error select: Type Object, expected Array

Hmm, maybe you know the problem  ??? :)

Thanks for helping :)

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #39 on: 03 Jun 2005, 08:55:57 »
@ Planck

Aww, I was just about to say that :P

btw Yes that is the correct syntax, I can't believe I missed that out ::)

@ Maximus-Sniper

For some reason, OFP seems to be expecting an array of numbers - which is odd, cause its just a float value of how much damage has been caused :P

edit

Hmm, I think I see another problem.

There is no loop or pause between adding the EH and checking if the unit is dead, which could lead to all sorts of problems. I also changed the script a bit, see if it works now:

#loop

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

goto "loop"

#EH

{_x addEventHandler ["hit",{_dammage = _this select 1; goto "CheckDead"}]} forEach eastsnipe

#Wait

~3

goto "Wait"

#CheckDead

?(_dammage >= 1): _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
?(_dammage < 1): goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"


edit 2

Hang on :P

If that doesn't work, then I think I might know what the problem is. OFP was expecting an array (which we want) but it got an object.

In the "Hit" EH, the arguments: "CausedBy" and "HowMuch" are stored in _this.

AFAIK to get "causedBy" you would use _this select 0 right? That's an object.

To get the value of "HowMuch" you'd use _this select 1 right? This is a scalar ammount (can be an array).

So if OFP is getting an object, then maybe its _this select 1 for "causedBy" and _this select 2 for "HowMuch".

Just to see, try using this script as well:

#loop

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

goto "loop"

#EH

{_x addEventHandler ["hit",{goto "CheckDead"}]} forEach eastsnipe

#Wait

~3

goto "Wait"

#CheckDead

_dammage = _this select 2;
?(_dammage >= 1): _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
?(_dammage < 1): goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"
« Last Edit: 03 Jun 2005, 09:14:39 by Lean Bear »

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #40 on: 03 Jun 2005, 11:18:31 »
Quote
You can't use this = _this select 0. So we'll have to find a method of selecting the unit that's just been killed and run the script from him.

actually i just checked a tutorial on event handlers and for killed it says this
Quote
"killed" (addable to men or vehicles) :
_this select 0 : who's dead ;
_this select 1 : whodunnit (say, the killer) ;

so you should be able to use _this select 0
wich also means all the hit event handlers and codes to check dammage were basically a waste of time but it might depend what version you have im not sure

Lean Bear

  • Guest
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #41 on: 03 Jun 2005, 17:53:21 »
I hope you're right, it would make this a lot easier to do :P

btw I got my info from the Offical and Unoffical ComRefs. Where did you find this tut?

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #42 on: 03 Jun 2005, 18:00:14 »
the editors depot just search in event and theres one about event handlers

Maximus-Sniper

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

@Lean Bear

Ok i did the last edit 2 from you :)

The good news is, i did't get any error now when i press "Death Cam On" in my test mission  :D

Bad news is, nothing happend when i kill the man (east1)  ???

Looks like the script did't call for the camera script (rast_deathcam.sqs)

I'm not  realy sure what the problem are now... hmm

But just take a look now to my scripts:

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

deathcam.sqs:
Code: [Select]
#loop

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

goto "loop"

#EH

{_x addEventHandler ["hit",{goto "CheckDead"}]} forEach eastsnipe

#Wait

~3

goto "Wait"

#CheckDead

_dammage = _this select 2;
?(_dammage >= 1): _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
?(_dammage < 1): goto "loop"

? !slow_mo_deathcam : goto "loop"
~1

goto "EH"

Than the Class UserActions in config.cpp:

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}";
         };


That's  the last update we got :)  :P

Thanks :)

Maximus-Sniper

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(Switch On/Off)?
« Reply #44 on: 03 Jun 2005, 19:58:16 »
ermm to me it looks perfect and should work
one thing where you have
Quote
?(_dammage >= 1): _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
?(_dammage < 1): goto "loop"

 i usually use spaces that might be the problem but i doubt it try

Code: [Select]
?(_dammage >= 1) : _this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"
?(_dammage < 1) : goto "loop"

apart from that it should work everything seems to be called right and if theres no error messages theres no reason for it not to work