Home   Help Search Login Register  

Author Topic: Random Camera Script  (Read 3508 times)

0 Members and 1 Guest are viewing this topic.

Homefry31464

  • Guest
Random Camera Script
« on: 07 Feb 2004, 03:13:37 »
I've made a new script, actually my first.  It justs cycles units in a group, then randomizes the cam's relative position.  I need help with having to call "something", as it is the only way I could get the script to work.

AND: The camera never seems to look directly at the unit.  Actually, I hardly ever see the specified unit in a group.

Code: [Select]
; Random Camera Position Script
; Just call [groupname, something] exec "camrandoms.sqs"

_group = _this select 0
_justtypesomething = _this select 1
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

_units = units _group
_i = 0
_numunits = count _units

#start
_camaround = random 360
_camzoom = random 4
_camup = random 30
_currentunit = (_units select _i)
_cam camsettarget _currentunit
_cam camsetrelpos [_camaround, _camzoom, _camup]
_cam camcommit 0
~10
_i = _i + 1
?_numunits > _i:goto "start"
?_numunits = _i then _i = 1
goto "start"
~1
_cam cameraeffect ["terminate", "back"]
~1

exit


Oh, and I need help so when the player presses a key, the script ends.  

This was originally a way to take screenshots.  

Thanks to everyone who can help, and even those who can't!

Azraell

  • Guest
Re:Random Camera Script
« Reply #1 on: 12 Feb 2004, 01:36:24 »
ok, i had a look see...i named my group "test"  then called it with a radio trigger.....[test] exec "camrandoms.sqs"  ..... I removed  the "something" and "justtypesomething" parts, works just fine. im not sure about the pressing a key and script ends thingy. Maybe another timer script that makes a variable true, a variable that the cam script is waiting for so it can turn itself off.

« Last Edit: 12 Feb 2004, 01:48:10 by Azraell »

Azraell

  • Guest
Re:Random Camera Script
« Reply #2 on: 12 Feb 2004, 02:16:49 »
well, i messed with it for another hour (more like a half hour,seemed longer tho), trying to get it to recognize _alt or _shift or some other user input but without any luck :( .

Maybe some1 will come along that knows a fix for it.

Sorry i couldnt be of more help.

If i come across some info ill let you know.

Az
« Last Edit: 12 Feb 2004, 02:18:01 by Azraell »

Homefry31464

  • Guest
Re:Random Camera Script
« Reply #3 on: 12 Feb 2004, 04:36:12 »
Thanks for trying it out.  Maybe enableuserinput true (is that a command?  I think there is something similar.)

My main question is, did the script work, as in did you see the units in the group?

Azraell

  • Guest
Re:Random Camera Script
« Reply #4 on: 13 Feb 2004, 05:53:17 »
O yea...the script worked fine :)  ...diff angles and positions...alot of times it was postioned out a little too far for individual soilders, but that can be changed to user desire.


 enableuserinput true is a command, but i tried also when i tested the script....no luck :(  

intros stop when you hit a button...wonder how it achieves that?

AZ





Homefry31464

  • Guest
Re:Random Camera Script
« Reply #5 on: 13 Feb 2004, 05:54:48 »
Alright, thanks a bunch for testing this thing out.

Azraell

  • Guest
Re:Random Camera Script
« Reply #6 on: 13 Feb 2004, 06:03:21 »
o wait! i got this.....

_currentunit = (_units select _i): error zero divisor


after about 1 minute or more into it
« Last Edit: 13 Feb 2004, 06:05:52 by Azraell »

Homefry31464

  • Guest
Re:Random Camera Script
« Reply #7 on: 13 Feb 2004, 06:15:49 »
Code: [Select]
; Random Camera Position Script
; Just call [groupname, something] exec "camrandoms.sqs"

_group = _this select 0
_justtypesomething = _this select 1
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

_units = units _group
_i = 0
_numunits = count _units

#start
_camaround = random 360
_camzoom = random 4
_camup = random 30
_currentunit = (_units select _i)
_cam camsettarget _currentunit
_cam camsetrelpos [_camaround, _camzoom, _camup]
_cam camcommit 0
~10
_i = _i + 1
?_numunits > _i:goto "start"
?_numunits = _i then _i = 0
goto "start"
~1
_cam cameraeffect ["terminate", "back"]
~1

exit

Updated it a little, what do you think could be causing this?

EDIT: I think I got it.  
Code: [Select]
?_numunits > _i:goto "start"
should be:
Code: [Select]
?_numunits < _i:goto "start"
I think this was causing the script to go back to start once _i became greater than the number of the units in the group, thus causing the error.

Updated version below:

Code: [Select]
; Random Camera Position Script
; Just call [groupname, something] exec "camrandoms.sqs"

_group = _this select 0
_justtypesomething = _this select 1
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

_units = units _group
_i = 0
_numunits = count _units

#start
_camaround = random 360
_camzoom = random 4
_camup = random 30
_currentunit = (_units select _i)
_cam camsettarget _currentunit
_cam camsetrelpos [_camaround, _camzoom, _camup]
_cam camcommit 0
~10
_i = _i + 1
?_numunits < _i:goto "start"
?_numunits = _i then _i = 0
goto "start"
~1
_cam cameraeffect ["terminate", "back"]
~1

exit


How did you make it so I don't need the "something", and how do you call it ingame?
« Last Edit: 13 Feb 2004, 06:21:42 by Homefry »

Azraell

  • Guest
Re:Random Camera Script
« Reply #8 on: 13 Feb 2004, 06:52:09 »
[test] exec "camrandoms.sqs"  is what i put in the radio trig(test being my groups name).

Then i deleted "_justtypesomething = _this select 1" in the script.

Since your only passing 1 variable( the groupname) to the script, youll only need "_this select 0"


glad to helpout with whatever knowledge i have:)

AZ

Offline Marvin

  • Members
  • *
  • One day they will come
Re:Random Camera Script
« Reply #9 on: 13 Feb 2004, 09:10:30 »
I think the line should be

?_numunits == _i then _i = 1

Is there any games than Flashpoint?

Homefry31464

  • Guest
Re:Random Camera Script
« Reply #10 on: 13 Feb 2004, 15:32:20 »
Thanks!

Offline Marvin

  • Members
  • *
  • One day they will come
Re:Random Camera Script
« Reply #11 on: 13 Feb 2004, 15:49:41 »
You`r welcome!
Is there any games than Flashpoint?

Azraell

  • Guest
Re:Random Camera Script
« Reply #12 on: 14 Feb 2004, 04:56:14 »
yup...good call Marvin :D ....==  2 of those for same as...didnt notice it :)

Homefry31464

  • Guest
Re:Random Camera Script
« Reply #13 on: 16 Feb 2004, 22:03:31 »
Updated Version:

Code:
Code: [Select]
; Random Camera Position Script
; Just call [groupname, something] exec "camrandoms.sqs"

_group = _this select 0
_justtypesomething = _this select 1
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]

_units = units _group
_i = 0
_numunits = count _units
_stopper = 0
#start
_camaround = random 360
_camzoom = random 4
_camup = random 30
_currentunit = (_units select _i)
_cam camsettarget _currentunit
_cam camsetrelpos [_camaround, _camzoom, _camup]
_cam camcommit 0
~10
_i = _i + 1
?_numunits <> _i:_stopper = _stopper + 1 : goto "start"
?_numunits == _i then _i = 0
?_stopper == 5: end
goto "start"
~1
_cam cameraeffect ["terminate", "back"]
~1

exit


Thanks to everyone who tested it, let me know if you have any problems.

I added something that stops the script after it loops five times.

Thanks!

MattRochelle

  • Guest
Re:Random Camera Script
« Reply #14 on: 17 Mar 2004, 20:54:28 »
hmm it dont stop for me

Homefry31464

  • Guest
Re:Random Camera Script
« Reply #15 on: 18 Mar 2004, 03:44:49 »
That because I haven't figured out how, i'll probably just end it after a certain amount of loops.