OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: typhoon123 on 05 Sep 2005, 12:38:07

Title: need help with loop
Post by: typhoon123 on 05 Sep 2005, 12:38:07
Could someone please explain to me how #loop works here is my script
Quote
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal","back"]
_camera settarget a1
_camera setrelpos [6,6,6]
_camera camcommit 0
what i am wanting to do is get that camera to stay at that position while he is running how would i do that :) any help is appreciated
Title: Re:need help with loop
Post by: 456820 on 05 Sep 2005, 13:09:12
#loop is not a dommand it is just a bookmark for example but it is commonly used in loops i dont know why
the '#' creates a bookmark so you can go to that point using the command goto "name of bookmark here" when using goto do not put the # in the brackets

okay but anyway on to your question

Quote
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal","back"]

#loop start
_camera settarget a1
_camera setrelpos [6,6,6]
_camera camcommit 0
~0.0
? moveon : goto "next" else goto "loop start"

#next
; here you can place the rest of your camera script

as you can see that will refresh the camera every 0.0 seconds you can change it to what you want 0.0 works best but can cause lag
when moveon = true it will carry on with the script if you want you can change the condition moveon to suit your needs i usually actiavate the condition for the script to carry on using a trigger or a waypoint

hope this helps
also syntax for above i am 100% sure its correct
Title: Re:need help with loop
Post by: MrN on 05 Sep 2005, 13:12:14
Rather than doing it yourself, search for Snypir's vehiclecam script in the Editor's depot.  :)

If you have a look in that script you also might be able to work loops out.  ;)
Title: Re:need help with loop
Post by: typhoon123 on 05 Sep 2005, 13:16:44
thanks a lot it is much appreciated i can now create the part of my cutscene ive been trying to create for days ;D
Title: Re:need help with loop
Post by: typhoon123 on 05 Sep 2005, 13:22:33
oh ps i also would like to know how to quit the loop after its started going
Title: Re:need help with loop
Post by: 456820 on 05 Sep 2005, 13:24:00
i said above with a condition when that condition is true it will go to the next part of the script in my example i used 'moveon'
Title: Re:need help with loop
Post by: typhoon123 on 05 Sep 2005, 13:25:42
 ;D ;D ;D ;Dthanks ill give it a try  ;D ;D