Home   Help Search Login Register  

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

0 Members and 2 Guests are viewing this topic.

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #15 on: 01 Jun 2005, 14:24:58 »
Hi again :)

Ok did try all that, but it's did't work :( :(

Got some error:

First i make a new sqs file called deathcam.sqs and added this on it:

Code: [Select]
#loop
? slow_mo_deathcam_on : goto "EH"
{this removeAllEventHandlers  _x} foreach units eastsnipe
~5
goto "loop"
#EH
{this addEventHandler [""killed"",{this exec ""\RAST\script\Death_Cam\rast_deathcam.sqs""}]" _x} foreach units eastsnipe
? slow_mo_deathcam_off : goto "loop"
~5
goto "EH"

Than i make another one called rast_deathcam.sqs and added this:

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

Than i added this into my config.cpp:

Code: [Select]
class UserActions
      {
      class DeathCamOn
         {
               displayName="Death Cam On";
               position="player";
         radius=999999;
               //condition="this";
         condition="(Format [{%1},Death_Cam] != {false}) && (player == this)";
         statement="eastsnipe=this list; this exec {\RAST\script\Death_Cam\deathcam.sqs}";
         };


i had to change the condition to make it visible on the Action Menu, like that pic a post.
With this condition="this"; nothing happend and i could't see the "Death Cam On" on the Action Menu :(
So i had to add this line:
Code: [Select]
condition="(Format [{%1},Death_Cam] != {false}) && (player == this)";

Than i got the "Death Cam On" in the Action Menu :)

When i press "Death Cam On" i got some errors:

Code: [Select]
'eastsnipe = this |#|list; this exec "RAST\script\Death_Cam\deathcam.sqs"': Error Uknown Operator list

So i remove this line from the statement and change it to:

Code: [Select]
statement="this exec {\RAST\script\Death_Cam\deathcam.sqs}";

Than i got this error:

Code: [Select]
'{|#|this {this removeAllEventHandlers _x} foreach units eastsnipe': Error Missing )

So i don't realy know what's the problem is, but i feel we all are realy close now :)

Thanks again for your help, both of you :)

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #16 on: 01 Jun 2005, 14:27:37 »
'eastsnipe = this |#|list; this exec "RAST\script\Death_Cam\deathcam.sqs"': Error Uknown Operator list

well to fix that i think it might be list this instead of this list try that. also make sure you have the variable globals right

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #17 on: 01 Jun 2005, 14:50:00 »
Hi 456820 :)

Ok, i change it to:

Code: [Select]
statement="eastsnipe = list this; this exec ""\RAST\script\Death_Cam\deathcam.sqs""";

Now i got this error:

Code: [Select]
'{this removeAllEventHandlers _x} foreach units eastsnipe|#|': Error units: Type Array, expected Object,Group

Here is the line from the deathcam.sqs:

Code: [Select]
#loop
? slow_mo_deathcam_on : goto "EH"
{this removeAllEventHandlers _x} foreach units eastsnipe
~5
.
.
.
.

maybe somthing wrong there?

Thanks :)

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #18 on: 01 Jun 2005, 15:31:27 »
most likely i did say syntax not guaranteed that was just to help get started or a push how ever you want to think about it anyway i would try and get a more experienced scripter to help you get the syntax right
im not sure what the error mesage stands for its just the problem is at the end of the line but that means i solved the first wrong line wich means event handlers are added they just wont be removed sooo.
get rid og the this at the begining of the line if that doesnt work just have a mess around by changing the line until you get an error message aboutsomething else.

Lean Bear

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #19 on: 01 Jun 2005, 17:50:00 »
I think I can help you out a bit here Maximus-Sniper,

I've fixed the removeAllEventHandlers line to a valid code. There was 2 problems with that:

1. The forEach command didn't have the right syntax, the _x should be first, followed by the command. I also didn't finish the eventhandlers part.

2. putting ... forEach units eastsnipe tells OFP that eastsnipe is a group, but it it should be an array of all enemy units.

(3.) You also left spaces in the syntax which probably didn't help :P

Maybe I'm missing something here, but when was slo_mo_deathcam_on and slo_mo_deathcam_off defined?

OFP will have a hard time switching it ona nd off if it doesn't know what it is.

Here's what I got for that part of the script anyway:

#loop

? slow_mo_deathcam_on : goto "EH"

{_x removeAllEventHandlers "killed"} foreach eastsnipe
~5

goto "loop"

#EH

{_x addEventHandler ["killed",{this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} foreach eastsnipe

? slow_mo_deathcam_off : goto "loop"
~5

goto "EH"


For the config.cpp, I don't think that the command list is the right one for the job.

I think that extra line you put in to make it work is fine :)

The only thing I'd change would be the statement line:

statement="this exec {\RAST\script\Death_Cam\deathcam.sqs}";

Should work ok. ;)

btw I don't know how you've been testing this, but for what I've put to work, you need to:

1. Make a new mission in OFP
2. Place some enemy units around and name them something like: "east1", "east2", "east3" - but don't group them!
3. In the mission folder, make an init.sqs and put:
eastsnipe = [east1, east2, east3] // I forget if you need quotation marks around them or not, try both
4. Save the init.sqs and start the mission - if there are no script or config errors it should work fine. :D

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #20 on: 01 Jun 2005, 18:07:24 »
Quote
slo_mo_deathcam_on and slo_mo_deathcam_off defined?
never im using that as an example

this does actually sound like a very interesting addon are you relasing it ?
« Last Edit: 01 Jun 2005, 18:09:36 by 456820 »

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #21 on: 01 Jun 2005, 18:38:10 »
Hi 456820 & Lean Bear :)

@Lean Bear

I try that you say to me, and i did't get any error now :) But Nothing happend  ???
I make a new mission, and added my sniper and added one eneme unit from east and named him to east1 :) And make that init.sqs file and added eastsnipe = [east1, east2, east3]
Than i shot that man and norhing happend  :-\

It's that possible to make this script in another way? As you see now i have to make a init.sqs all the time and name som units to east1 .......

I hope if it's possible to make all that included in a script ?? So i don't need to make that init.sqs and named some units :)


@ 456820 :)

Yes i gonna release this sniper pack later some time :) Still need some bug fix and some more scripts :)

I have some pic and movies in this page at the middle:
http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=1c93b255019b2ae3f54322e83f611bc2;act=ST;f=4;t=44830;st=1260

Thanks again for all help i got from you all :)

Maximus-Sniper :)

Lean Bear

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #22 on: 01 Jun 2005, 18:53:17 »
I had a feeling it wouldn't work:

never im using that as an example

:P

Also, I agree abou the int.sqs thing - but it could be hard to put it in the script. Which side will your sniper units be on? (eg. West, Res etc.)

btw there's not really any point in making 1 unit called east1, then putting:

eastsnipe = [east1,east2,east3]

when east2 and east3 don't even exist :P

The thing that means the script doesn't work is the main problem to fix though...

What 456820 put in the script:

? slow_mo_deathcam_on : goto "EH"

well, atm, it isn't defined. So the script will never run "EH".

So, you'll need to do that do get the script working.

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #23 on: 01 Jun 2005, 18:57:26 »
well when you switch your camera on make switch a variable to true an easier example
death cam = on             therefore
deathcam = true

death cam = off               therefore
deathcam = false

like that of course if you dont use deathcam as the variable change it to what you do use in the script i made then it should work fine

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #24 on: 01 Jun 2005, 19:32:20 »
Hi again mates :)

@Lean Bear

Well i gonna make this pack for WEST side :)

Quote
btw there's not really any point in making 1 unit called east1, then putting:

eastsnipe = [east1,east2,east3]

when east2 and east3 don't even exist  :P

hehe, i just run a fast test  :P  :P

Quote
? slow_mo_deathcam_on : goto "EH"

well, atm, it isn't defined. So the script will never run "EH".

So, you'll need to do that do get the script working.

Ok i understand :) So i have to define "slow_mo_deathcam_on"
So how do i define that? Well i'm not good in scripting, :( I only have work with script some few months  :-\ :-\


@456820

Quote
well when you switch your camera on make switch a variable to true an easier example
death cam = on            therefore
deathcam = true

death cam = off              therefore
deathcam = false

like that of course if you dont use deathcam as the variable change it to what you do use in the script i made then it should work fine

So you mean i can only copy and past that into the deathcam.sqs?

deathcam.sqs:

Code: [Select]
#loop
? slow_mo_deathcam_on : goto "EH"
{_x removeAllEventHandlers "killed"} foreach eastsnipe
~5
goto "loop"
#EH
{_x addEventHandler ["killed",{this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} foreach eastsnipe
? slow_mo_deathcam_off : goto "loop"
~5
goto "EH"

Where should i put that into this script ??

Thanks again :)

Hope we resolved this and it's gonna be funny to have this script working. :) :)  :P

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #25 on: 01 Jun 2005, 19:38:40 »
erm you dont put it in the deathcam.sqs you put it in the config file i think where you have the option to turn on and off.
when its turned on put
Code: [Select]
slow_mo_deathcam = trueand when you turn it off put
Code: [Select]
slow_mo_deathcam = flase
also
Code: [Select]
#loop
? slow_mo_deathcam_on : goto "EH"
{_x removeAllEventHandlers "killed"} foreach eastsnipe
~5
goto "loop"
#EH
{_x addEventHandler ["killed",{this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} foreach eastsnipe
? slow_mo_deathcam_off : goto "loop"
~5
goto "EH"

if thats the correct version your using at the moment change it to

Code: [Select]
#loop
? slow_mo_deathcam : goto "EH"
{_x removeAllEventHandlers "killed"} foreach eastsnipe
~5
goto "loop"
#EH
{_x addEventHandler ["killed",{this exec "\RAST\script\Death_Cam\rast_deathcam.sqs"}]} foreach eastsnipe
? slow_mo_deathcam !: goto "loop"
~5
goto "EH"

That should be all then try a demo mission and have a test and also fingers crossed

Maximus-Sniper

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #26 on: 01 Jun 2005, 20:54:17 »
Hi 456820 :)

Now we are realy close  :P :P :P :P

But still got some errors:

Error 1:

When i press "Death Cam On" in the Action Menu i got this error:

Code: [Select]
'slow_mo_deathcam |#|!': Error Uknown Operator

That error most have somthing with this line in the Class UserAction:
Code: [Select]
class UserActions
      {
      class DeathCamOn
         {
               displayName="Death Cam On";
               position="player";
         radius=999999;
         condition="(Format [{%1},slow_mo_deathcam] != {false}) && (player == this)";
         statement="slow_mo_deathcam=true; this exec {\RAST\script\Death_Cam\deathcam.sqs}";
         };

As you see I added "slow_mo_deathcam=true" into the statement= . I think that's is the right place for that, but maybe i have to add some more?? I don't know  ??? ??? ???

Error 2:

When i shot one of the enemy (i call them for east1, east2 and east3. i added 3 officer form east side) i got this error, see pic and look at the camera.



That point to the rast_deathcam.sqs:

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

Most be something wrong in the first line, maybe change it or add some more, i don't know.  ???

But we are closer now :)

Thanks :) :)

Lean Bear

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #27 on: 01 Jun 2005, 21:41:29 »
Yay! We're nearly there. Both those errors are very easy to fix.

1. This is infact from deathcam.sqs. I don't quite know what 456820 was trying to do, but !: is deffinately not a valid command. It means "not goto" ???

Umm, I guess he'd know what he meant by that and an alternative. But if you want to quickly test it, use the script you were using before that change.

2. This one is, as you rightly said, from the rast_deathcam.sqs.

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.

Unfortunately, even after these are corrected, I can tell we're gonna have more problems :P

Although, I have thought of a solution to the problem of using an init.sqs or naming all the enemy units each time.

If you make eastsnipe equal to all the units present on the map, it will work fine. Whether you shoot an ally or an enemy it doesn't really matter. You can choose to switch the deathcam on or off anyway.

So...  (btw for the final thing, I'd recommend going through everything you've done and change eastsnipe to something more recognisable and general, like enemy_units or something)

eastsnipe = east && resistance && west

Just an idea :)

Offline 456820

  • Contributing Member
  • **
Re:Death Camera On The Enemy(On/Off)?
« Reply #28 on: 02 Jun 2005, 09:17:04 »
thats weird it should target the person you killed becuase this select 0 in a killed EH is the person killed try
killed = _this select 0
and when you want to target the person whose noe dead use killed instead of this

oh yh and with the '!' command i think i might of put that in the wrong place try this
Code: [Select]
? ! slow_mo_deathcam : goto "loop"that should be in the right place if not out it right next to the slow like !slow thats if that idea doesnt work about the other message im not totally sure but at the top should work if notthen im out of ideas

Lean Bear

  • Guest
Re:Death Camera On The Enemy(On/Off)?
« Reply #29 on: 02 Jun 2005, 10:07:43 »
I can see what you're trying to do here 456820, but I don't think its gonna work anyway.

_this select 0 from the EH "killed" selects the killer, and that's the only argument stored in _this for that EH. :P

I think it does need to be right against it:

? !slow_mo_deathcam : goto "loop"

edit

Just looking around, I found that the "hit" EH stores what object caused the dammage as well! :)

This means we can run another EH when the unit is dead (cause that will activate the "killed" EH) to find out who did it.

I've got a few ideas for this. One which looks right, but will probably have bugs:

#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"


or, this much different one, but one I'm more certain would work:

#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"


Then, for the rast_deathcam.sqs:

_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
« Last Edit: 02 Jun 2005, 10:33:31 by Lean Bear »