MODSonline
  Welcome Guest to MODSonline Home | Forums | Register | Login
Main-Menu
Home
Login
Register
Add Download
Add News
Add Tutorial *
Forums

Advertise
Affiliate Store US *
Affiliate Store UK *
Affiliate Store CA *
Angry Letter Generator
Avatar Upload
Calendar of Games
Contact
Downloads
FAQs
Forums
Member List
Member Projects
News
News Grabber *
Policy
Polls
Private Messages
Reviews
Screenshot Gallery
Search
Servers - Game
Store - Shirts *
Subscribe
Topics
Tutorials
Weblinks
Wiki *
Tutorials
CoD Mapping
CoDUO Mapping
CoD2 Mapping
CoD4 Mapping
CoD FAQs
HL2 Mapping
HL2 FAQs
SOF1 Mapping
Crysis Mapping
Q4 Mapping
Doom 3 Mapping
Doom 3 FAQs
UT2K3 Mapping
SOF2 Mapping
SOF2 FAQs

Lightray Modeling
General Modeling
General Modding
Adobe Photoshop
Common Mapping Errors

Readme.txt Generator
Members-Online
TBR479 [Downl]
Sevenz [Searc]
one_richard [Today]
ITOE_MC [Today]
Strelnieks [Proje]
khopki30 [Downl]
MonKeYPaWs [Searc]

7 Members and 11 Guests
Chat MODSonline
0 People Now Chatting
MODSOnline TeamSpeak

download TeamSpeak

In-The-News
Friday, Sep. 5th
W.@W. Beta in October!
Friday, Sep. 5th
MODSonair Episode 143
Thursday, Sep. 4th
SnA The Game!
Wednesday, Sep. 3rd
Battlefield Heroes - Victory Village Trailer
Sunday, Aug. 31st
MODSonair 143 LIVE
Latest Poll
Want a MODSonline Wiki for various games?
I think a Wiki would be a great addition to MODSonline. 77.94%
I could see a benefit of a Wiki. 3.43%
I think it would take away from the community. 4.9%
Wiki sites are never good. 3.43%
Wiki... isn't that Buck Roger's robot slave? 10.29%
Read More...
13 comments

Newsletter
Name:
Email:
Newsletter Archives
Your Membership
User Name:
Password:
Register.
In The Forums
help with fx
CoD 4 Level Desi.. Posts: (2) Views: (18) by xcp_naruto005
ambient sound ?
CoD 2 Level Desi.. Posts: (3) Views: (20) by liquidpredata
Destructible TV's
CoD 4 Level Desi.. Posts: (12) Views: (133) by MastaKwaa
EXPLODING TRUCK HELP
CoDUO Level Desi.. Posts: (10) Views: (75) by morgawr
Art of War Central Half-Life 2 Mods for Dummies
Tutorials: SOF1 Mapping
Mapping and modding for Soldier of Fortune.
Add your tutorial (registered users)

Rating:
Awful Rating Poor Rating Average Rating Good Rating Excellent Rating
Versions: You must be logged in to view history.
Moving Cameras
2006-10-20 16:02:55
Learn how to move cameras.

Make a folder in user/ds called "cam"
so now you have a user/ds/cam folder and we will put our script in it later. The script will be called "cams.os"


Make a large room map - maybe 512x512x256 and save it as "cams.map". You will need to make 3 func_remote cameras - put them about 128 units apart near the centre of the room and above the floor (64 units)

In the entity properties of each camera (press "N") set the flags/ tick the boxes where it says "SCRIPTED" and "NO_DELETE"

SCRIPTED makes the player invisible and invincible while the camera is on
NO DELETE just makes the camera remain in the map after a script has finished - maybe to be used a second time
ACTIVATOR_ON makes the camera show its picture only to the person who triggered it - not to all players in a map/game

Give each camera a targetname - cam1,cam2,cam3

Make 3 info_nulls for the cameras to point at - with targetnames - null1,null2,null3 and place them about 128 units from their cameras and above the floor (64 units)

target each camera to its correct null ( cam1 is targetted to null1 etc)

Don't forget to set a "volume" for the camera or else it will not work - volume = 2 is good
Don't forget to put some lighting in the map

I like to put something in the map as an indicator that the camera is moving - so, near the nulls, put items such as a vehicle or maybe a weapon or healthpack etc - it is also useful to texture each wall of the room with a contrasting texture

You will need your info_player_deathmatch and/or info_player_start and near these you will need a trigger_once targetted at a script_runner

Our script will be called cams.os and will be put in the ds folder called "cam" so our script_runner needs to have a key of script set to a value of cam/cams

ie in the script runner properties put the values...

key: script
value: cam/cams

When the script runner is triggered it will run the script called cams.os in the user/ds/cam folder

Let us make the script...

-------------------------------------------------

DECLARE / ASSIGN

As usual, every script begins with...

#include "../common/header.ds"
output "C://sample/ds/test"


For every camera we have 2 possible entities to manipulate - the camera itself and also the info_null that it is pointing at.
You will get different effects if you move the null or the camera - or if you move both together, maybe at different speeds etc

We have 6 entities to declare - namely all the cams and all the nulls...

local entity cam1
local entity cam2
local entity cam3

local entity null1
local entity null2
local entity null3

These are the names to be used in the script and just happen to be the same as the targetnames in the map

We now assign the names from the script to the actual targetnames in the map

cam1 = find entity with targetname "cam1"
cam2 = find entity with targetname "cam2"
cam3 = find entity with targetname "cam3"

null1 = find entity with targetname "null1"
null2 = find entity with targetname "null2"
null3 = find entity with targetname "null3"

Now for a special command - it makes the camera move with no clip - ie through walls etc and smoothly to its destination
If this command is not present the camera will "jerk" to it's destination

We need to write it for each camera and null

cam1.movetype = MOVETYPE_NOCLIP
cam2.movetype = MOVETYPE_NOCLIP
cam3.movetype = MOVETYPE_NOCLIP

null1.movetype = MOVETYPE_NOCLIP
null2.movetype = MOVETYPE_NOCLIP
null3.movetype = MOVETYPE_NOCLIP

That's it! - all the cameras are now set up and ready to move wherever you would like them to go - let us look at the whole script so far...

---------------------------------------------------


#include "../common/header.ds"
output "C://sample/ds/test"

local entity cam1
local entity cam2
local entity cam3

local entity null1
local entity null2
local entity null3


cam1 = find entity with targetname "cam1"
cam2 = find entity with targetname "cam2"
cam3 = find entity with targetname "cam3"

null1 = find entity with targetname "null1"
null2 = find entity with targetname "null2"
null3 = find entity with targetname "null3"


cam1.movetype = MOVETYPE_NOCLIP
cam2.movetype = MOVETYPE_NOCLIP
cam3.movetype = MOVETYPE_NOCLIP
null1.movetype = MOVETYPE_NOCLIP
null2.movetype = MOVETYPE_NOCLIP
null3.movetype = MOVETYPE_NOCLIP


----------------------------------------------------

MOVEMENT

For movement - everything is referred to by x,y,z co-ordinates that can easily be found from within Radiant when studying your map

There are 2 very different methods of moving something in a script - You can move something BY a certain amount - ie. move object by 10 units up - or you can move the object TO a very specific co-ordinate ie. move object to [0,0,0]

so if you move your camera BY [128,0,0] you will get a different result if you move your camera TO [128,0,0]

You first need to switch on a camera in the script - so type the line...

use entity cam1

Now we will move it forward (if you are looking at the top view of your map in Radiant then the camera will move up the screen)


move entity cam1 by [0,128,0] at 30 speed


Notice obviously the speed parameter which can be changed for practically any number

speed 30 is reasonably slow - up to 100 is good for most camera work- sometimes I have found it necessary to move a null at 1200 speed

We now need to switch off cam1 and switch on cam2 - by "using" cam1 for a second time, it is switched off

use entity cam1
use entity cam2



..and now we will move cam2 to the left (in same Radiant view)


move entity cam2 by [-128,0,0] at 30 speed


But wait... here is an important point - the script has not been told to wait for cam1 to finish it's movement before it switches off and then cam2 is switched on

We need to delay the next command to give the camera time to complete the move

So-we add a simple wait command of say 3 seconds

The whole script now looks like this...

-----------------------------

#include "../common/header.ds"
output "C://sample/ds/test"

local entity cam1
local entity cam2
local entity cam3

local entity null1
local entity null2
local entity null3


cam1 = find entity with targetname "cam1"
cam2 = find entity with targetname "cam2"
cam3 = find entity with targetname "cam3"

null1 = find entity with targetname "null1"
null2 = find entity with targetname "null2"
null3 = find entity with targetname "null3"


cam1.movetype = MOVETYPE_NOCLIP
cam2.movetype = MOVETYPE_NOCLIP
cam3.movetype = MOVETYPE_NOCLIP
null1.movetype = MOVETYPE_NOCLIP
null2.movetype = MOVETYPE_NOCLIP
null3.movetype = MOVETYPE_NOCLIP



move entity cam1 by [0,128,0] at 30 speed

wait 3 seconds

use entity cam1

use entity cam2

move entity cam2 by [-128,0,0] at 30 speed

wait 3 seconds

use entity cam2

exit

----------------------------------------------

If you understand so far you should be able to try switching on / moving / switching off cam3

Also try this in your script - the camera and null moving together...

---------------------------

use entity cam1

move entity cam1 by [256,100,128] at 30 speed
move entity null1 by [0,256,0] at 10 speed
wait 10 seconds
use entity cam1
exit

------------------------------------


SIGNALLING

Now - you may have noticed in the above scripts that if you alter the speed of movement of the camera, that you would also need to change the delay time to give the camera the correct amount of time to complete it's movement

Well - there is a much easier way to control the delay - we can tell the script to wait for the camera to finish moving

This is done with a "signal". A signal is just a number or integer that is used to signal something - ie the signal is 0 (zero) if it is unset, and if it is set then it changes to a 1 (one) - same as on/off

we need to create the integer signal in the script by typing in the declaration section (near the top of the script)


local int sig1


So we now have a signal we can use called "sig1"
if we now put...


move entity cam1 by [128,0,0] at 30 speed signaling sig1
wait for all clearing sig1



...then the camera changes sig1 from zero to one during its movement
After it has finished moving,it will "unset" sig1 and return it to zero

The script is told to wait on the next line until sig1 is reset and then it gets sig1 ready for use again in the script - the same signal is used over and over again if needed

So - notice that we do not need to know any timings. If the speed is changed to 80 thus...


move entity cam1 by [128,0,0] at 80 speed signaling sig1
wait for all clearing sig1


Then the script will still wait until the camera has finished moving before carrying out the next command

NB - Signalling is spelt with 1 letter L in the script ie signaling NOT signalling - it is the same with Targetting and Targeting


We can now write a much better movement script - try this for one camera....


--------------------------------------------------


#include "../common/header.ds"
output "C://sample/ds/test"


local entity cam1

local int sig1

cam1 = find entity with targetname "cam1"

cam1.movetype = MOVETYPE_NOCLIP




move entity cam1 by [0,128,0] at 30 speed signaling sig1
wait for all clearing sig1


move entity cam1 by [128,0,0] at 50 speed signaling sig1
wait for all clearing sig1


move entity cam1 by [0,-128,0] at 80 speed signaling sig1
wait for all clearing sig1


move entity cam1 by [-128,0,0] at 20 speed signaling sig1
wait for all clearing sig1




move entity cam1 by [0,0,128] at 30 speed signaling sig1
wait for all clearing sig1


move entity cam1 by [128,0,0] at 60 speed signaling sig1
wait for all clearing sig1


move entity cam1 by [0,0,-128] at 80 speed signaling sig1
wait for all clearing sig1


move entity cam1 by [-128,0,0] at 40 speed signaling sig1
wait for all clearing sig1




exit

-----------------------------------------------


Notice I am not moving the null in the above script so I have not bothered to declare it at all - even though the camera will be pointing to a info_null in the map

Use the above script but try changing the speed and the co-ordinates - you can try them all in one script by just repeating many many lines in the script and moving the cameras all over the place....don't forget to experiment with moving the nulls also

You move both the null and camera together by only putting the signal on one line like so....




move entity null1 by [0,256,0] at 30 speed
move entity cam1 by [-128,0,0] at 50 speed signaling sig1
wait for all clearing sig1


So the null begins moving, then the camera begins moving, then the script waits for the camera to finish moving

The signal is used in the same way in other scripts to control the timing of movements/animations or events


Hope this helps

Have Fun !

Demise RDAM

All logos and trademarks and information in this site are property of MODSonline LLC © 2008.
The comments are property of their posters.
RSS news feeds for MODSonline can be found News.php.
Art of War Central
Partners
modbase.be
XoXide
Frag Universe
Battle for Europe COD2
Call of Duty Headquarters
The Firing Box
Ask About
Advertising
Friends
Great Gamer
SOF2 Files and Downloads
Canada Kicks Ass Clan
Ask About
Advertising
Link to Us
MODSonair
View in iTunes
Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above.
MODSonair Releases
MODSonair Episode 143
MODSonair Episode 142
MODSonair Episode 141
MODSonair Episode 140
MODSonair Episode 139
Next Show
The next MODSonair show will air LIVE on:
09/07/2008 11:00 EDT

Time remaining:
Copyright © 2008 MODSonline
Tresware Content Management System Copyright © 2008 Tresware
Website Designed and Hosted   Tresware