OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: Homefry31464 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.
; 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!
-
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.
-
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
-
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?
-
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
-
Alright, thanks a bunch for testing this thing out.
-
o wait! i got this.....
_currentunit = (_units select _i): error zero divisor
after about 1 minute or more into it
-
; 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.
?_numunits > _i:goto "start"
should be:
?_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:
; 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?
-
[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
-
I think the line should be
?_numunits == _i then _i = 1
-
Thanks!
-
You`r welcome!
-
yup...good call Marvin :D ....== 2 of those for same as...didnt notice it :)
-
Updated Version:
Code:
; 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!
-
hmm it dont stop for me
-
That because I haven't figured out how, i'll probably just end it after a certain amount of loops.