bmgarcangel 0 Posted November 20, 2003 Hey guys, How do I get my cam, like for a cam, to lock on a target, while its moving, but stay with that target, aka following it or just circling around it, but while its moving? Someone said this might work but its confusing me out: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;Cutscene after 2nd mission, for Visnorsk Campaign, made by Brendan G. <bmgarcangel> ;********************************************************Part1**************************** ************************************ ;At Black Ops hiding space in the woods near hill 69. Â Also scene of RRF attack being launched ;***************************************************************************************** ************************************* disableUserInput false setacctime 1.0 setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _camera camSetTarget [(getMarkerPos "tt" select 0),(getMarkerPos "tt" select 1),1.5] _camera camSetFOV 0.7 _camera camCommit 0 ~6 #Loop1 _camera camSetPos [(getPos ttt select 0),(getPos ttt select 1) - 2,1.5] _camera camCommit 4 ? (UnitReady ResA1) : goto "EndLoop1" goto "Loop1" #EndLoop1 Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 20, 2003 basically, you create a camera, set camera's target, and set the position of camera, and loop it so that it updates its position, so in human eyes, it will seem like it is moving along with the vehicle. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">disableUserInput false setacctime 1.0 setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] this creates the camera at 0,0,0 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_camera camSetTarget [(getMarkerPos "tt" select 0),(getMarkerPos "tt" select 1),1.5] _camera camSetFOV 0.7 _camera camCommit 0 camera now focusses on position marked with a marker named 'tt', with Field Of Vision at 0.7, and camera will turn to "tt" from 0,0,0 position immediately. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~6[/CODE] waits 6 seconds #Loop1_camera camSetPos [(getPos ttt select 0),(getPos ttt select 1) - 2,1.5]_camera camCommit 4? (UnitReady ResA1) : goto "EndLoop1"goto "Loop1"#EndLoop1sets camera at position of an object named "ttt"(or close to it.) but takes 4 seconds to get there from previous position. if the unit named ResA1 is ready, the loop will end, if not, keep looping Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 20, 2003 Ok then, so it would look like this. Now what would happen is that the cam would start whereever, then it would target someone, then it would go to the position like near someone, follow that target but keep locked on the tt target while close to the ttt pos, then to end it dogma has to be ready, right?? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> disableUserInput false setacctime 1.0 setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _camera camSetTarget [(getMarkerPos "tt" select 0),(getMarkerPos "tt" select 1),1.5] _camera camSetFOV 0.7 _camera camCommit 0 ~6 #Loop1 _camera camSetPos [(getPos ttt select 0),(getPos ttt select 1) - 2,1.5] _camera camCommit 4 ? (UnitReady dogma) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~6 @unitready dogma Now, how does this work out with helicopters, I need it to work with them, but it doesn't look at the flying helo, it just looks at the ground were the shadow is!!!!! Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 20, 2003 isntead of <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_camera camSetPos [(getPos ttt select 0),(getPos ttt select 1) - 2,1.5] try <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_camera camSetPos [(getPos ttt select 0),(getPos ttt select 1) - 2,(getPos ttt select 0)] Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 20, 2003 oh.......the other one doesn't work?? Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 20, 2003 I noticed that my ofp doesn't like _camera command. It only likes _cam command for some odd reason. Â so it will look like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> disableUserInput false setacctime 1.0 setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _camera camSetTarget [(getMarkerPos "tt" select 0),(getMarkerPos "tt" select 1),1.5] _cam camSetFOV 0.7 _cam camCommit 0 ~6 #Loop1 _cam camSetPos [(getPos ttt select 0),(getPos ttt select 1) - 2,(getPos ttt select 0)] _cam camCommit 4 ? (UnitReady dogma) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~6 @unitready dogma Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 20, 2003 the other one looks at from height of 1.5 meters. the editted one(mine) looks from the height of the object tt Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 20, 2003 lol hehe I put the edited one in the coding sample above your last post Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 21, 2003 Ok i got another problem with it. Now since I put the unit ready stuff, you know this part <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ~0 #Loop1 _cam camSetPos [(getPos d1 select 0)- 1,(getPos d1 select 1) + -11,40] _cam camCommit 0 _cam camsetrelpos [8,-9,3] ? (UnitReady dog) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~9 Problem with it is that UnitReady part, whenevers its in over there than it doesn't loop, even though <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> @UnitReady dog hasn't been activated yet. here is what I have so far: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _cam camsettarget dogma _cam camCommit 0 ~1 _cam camSetTarget d1 _cam camCommit 0 ~0 #Loop1 _cam camSetPos [(getPos d1 select 0)- 1,(getPos d1 select 1) + -11,40] _cam camCommit 0 _cam camsetrelpos [8,-9,3] ? (UnitReady dog) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~9 @unitReady Dog _cam camSetTarget [(getMarkerPos "d1" select 0),(getMarkerPos "d1" select 1),1.5] _cam camCommit 0 ~0 Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 22, 2003 if the loop is not happening, maybe "unitready dog" returns true, so the unit named Dog might be in ready situation. "@unitready dog" will wait until dog is ready, so if it was ready in the loop, it should bypass it. a question: is there a unit named dog, or did you forget and wrote it instead of "dogma"? Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 22, 2003 I changed dogma to dog Ok now, so if the unit is basically ready for action then he will be ready. So if I moved him a few miles from action then he'd be ready when the script tells him to? Share this post Link to post Share on other sites
crashdome 3 Posted November 22, 2003 This is alot easier but less pretty: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam = <NameOfUnitToWatch> #loop _cam cameraeffect ["Around","FRONT"] _cam camcommit 0 ~9 ?(!<condition>):goto "loop" exit It takes about 9 seconds to loop around and view goes back to player, so loop it every 9 secs until a <condition> The only problem is it stutters at beginning and end of every loop. I would get dizzy after 9 secs of looping anyway so maybe you want to switch between different view types or units instead of looping around same unit. Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 22, 2003 arrgh This is what I was asking I changed dogma to dog Ok now, so if the unit is basically ready for action then he will be ready. So if I moved him a few miles from action then he'd be ready when the script tells him to? Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 23, 2003 he'll be ready when all the orders are complete. it's not the matter of distance. Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 23, 2003 Can I send it to you to look at then??? cause I mean look: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _cam camsettarget dogma _cam camCommit 0 ~1 _cam camSetTarget d1 _cam camCommit 0 ~0 #Loop1 _cam camSetPos [(getPos d1 select 0)- 1,(getPos d1 select 1) + -11,40] _cam camCommit 0 _cam camsetrelpos [8,-9,3] ? (UnitReady dog) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~9 @unitReady Dog _cam camSetTarget [(getMarkerPos "d1" select 0),(getMarkerPos "d1" select 1),1.5] _cam camCommit 0 ~0 The moment it gets to <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ~0 #Loop1 _cam camSetPos [(getPos d1 select 0)- 1,(getPos d1 select 1) + -11,40] _cam camCommit 0 _cam camsetrelpos [8,-9,3] ? (UnitReady dog) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~9 It won't loop. Instead it just looks at it!!! Instead its supposed to stop looping when it gets here: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> @unitReady Dog Right man?? Can you tell me why it ain't listening to the script properlly? Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 23, 2003 rename "dog" to "dog_1" and also try fillowing code. i'm busy in my real life so i can't test the code. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _cam camsettarget dog_1 _cam camCommit 0 ~1 _cam camSetTarget d1 _cam camCommit 0 ~0 #Loop1 _cam camsetrelpos [8,-9,3] _cam camCommit 0 ? (UnitReady dog_1) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~9 @unitReady dog_1 _cam camSetTarget [(getMarkerPos "d1" select 0),(getMarkerPos "d1" select 1),1.5] _cam camCommit 0 ~0 Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 24, 2003 following the code?? Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 25, 2003 What do you mean by following the code or fillowing the code? Share this post Link to post Share on other sites
ralphwiggum 6 Posted November 25, 2003 following code. i.e. the code i posted on my last post. try that one out. Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 25, 2003 this one?? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> setviewdistance 2000 _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] _cam camsettarget dog_1 _cam camCommit 0 ~1 _cam camSetTarget d1 _cam camCommit 0 ~0 #Loop1 _cam camsetrelpos [8,-9,3] _cam camCommit 0 ? (UnitReady dog_1) : goto "EndLoop1" goto "Loop1" #EndLoop1 ~9 @unitReady dog_1 _cam camSetTarget [(getMarkerPos "d1" select 0),(getMarkerPos "d1" select 1),1.5] _cam camCommit 0 ~0 Sorry. I'm confused Share this post Link to post Share on other sites
bmgarcangel 0 Posted November 26, 2003 Itsn ot working. It just goes up next to the helo or soldier, doesn't follow it, but lets it pass by it as the unit continues its fricken waypoint. Anyone want to look at this mission? Share this post Link to post Share on other sites