Forum

> > Stranded II > Scripts > How can I use the camera
Forums overviewStranded II overview Scripts overviewLog in to reply

English How can I use the camera

5 replies
To the start Previous 1 Next To the start

old How can I use the camera

ModJuicer
Super User Off Offline

Quote
I have been working on making my own adventure map, and I don't know how the camera works.
I have tried to make sense of it by looking at other maps, but they are too garbled with a bunch of other codes and stuff.

old Re: How can I use the camera

JasJack67
Super User Off Offline

Quote
Hi Fresh,
Here is a Telescope script using the camera. It simply zooms the camera in to a distant place, a place ahead of the player where ever he is looking.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
### Screen Effect - Telescope
id=3815
name=Screen_Telescope
group=stuff
icon=gfx\blank.bmp
model=gfx\effects\screen_telescope.b3d
scale=1
alpha=1
col=0
mat=dust
autofade=2000
script=start
	on:create {
        timer "self",200,1,"timer1";
	}
    on:timer1 {
		local $x1,$y1,$z1,$x2,$y2,$z2,$yaw,$pitch,$radius,$info1,$info2;
		$x1=getx("unit",1);
		$y1=gety("unit",1);
		$z1=getz("unit",1);
		$x2=$x1;
		$y2=$y1;
		$z2=$z1;
		$y2+=16;
		$yaw=getyaw("unit",1);
		$pitch=getpitch("unit",1);
		$radius=1000;
		$x2-=((sin($yaw)*$radius)/100);
		$z2+=((cos($yaw)*$radius)/100);
		$y2-=((sin($pitch)*$radius)/100);
		$info1=create("info",40,$x2,$z2);
		setpos "info",$info1,"self",$y2,"self";
		$x2-=((sin($yaw)*$radius)/100);
		$z2+=((cos($yaw)*$radius)/100);
		$y2-=((sin($pitch)*$radius)/100);
		$info2=create("info",30,$x2,$z2);
		setpos "info",$info2,"self",$y2,"self";
		seqstart 1,1;
		setcam 0,$info1;
		cammode 0,1,"info",$info2;
		seqend 5000;
		timer "self",5200,1,"timer2";
	}
	on:timer2 {
	    free "self";
	}

The player has a Telescope. On:use, this screen effect is created. So that runs first above, on:create. Then the expiring timer starts the timer1 script.

Here, the camera moves straight out in front of the players view (center of screen). So the angles need to be set, yaw,pitch,sin,cos.

Info 40 is camera position in the infos.inf file. Info 30 is a flag placed on the map that the camera goes towards.

So the camera move in that direction for 5000 or 5 seconds. Then it is deleted "free "self"" and the player now returns to normal play camera view.

1
2
3
4
seqstart 1,1;
		setcam 0,$info1;
		cammode 0,1,"info",$info2;
		seqend 5000;

There is only 1 sequence, the camera moving from the player to the flag.
Setcam tells where the camera is going. To info1.
Cammode 0 moves the camera toward info2
Seqend tells the sequence to end in 5000/5 seconds.

Thus the timer to delete it's self right after it reaches 5 seconds away, is set at 5200.
edited 1×, last 27.10.17 02:00:47 am

old Re: How can I use the camera

Assassin moder
User Off Offline

Quote
It is easier than you might think. Do not try to code/script if you are going to surrender anyway. An you are calling yourself a Software? Ironic ..

old Re: How can I use the camera

ModJuicer
Super User Off Offline

Quote
Please guys, I would like a script that works and doesn't flip me upside down like the one jasjack showed me:
1
2
3
4
seqstart 1,1;
          setcam 0,$info1;
          cammode 0,1,"info",$info2;
          seqend 5000;

also I would like to know how to position it. Please make it simple.
edited 4×, last 05.05.18 11:23:59 pm

old Re: How can I use the camera

Nova
User Off Offline

Quote
Start a new map and place two infos at different places on the map. Which exactly doesn't matter, just take two camera infos because they fit so nice.
Now you write this into the global script of the map and then press F12:

1
2
3
4
5
6
7
8
9
10
11
12
on:start {
	seqstart;  // Start a sequence.
	cammode 0, 2;  // Set the camera into mode 2 at time 0 so it will
		// align with the infos we placed on the map.
	setcam 0, 1;  // Set the camera to the position of the info with the ID 1
		// at time 0.
	movecam 3000, 5000, 2;  // Move the camera from the current place,
		// starting at time 3000, to the info with the ID 2 until
		// the time reaches 5000.
	seqflash 4000;  // let the screen flash at time 4000.
	seqend 6000;  // end the sequence at time 6000.
}

All times are in milliseconds, so 1000 is exactly 1 second after the start of the sequence, 5000 ist 5 seconds after the start etc.
You will notice that the camera is really close to the ground in the sequence. That's because the infos are placed directly on the ground. To fix that, move your mouse pointer over one info and then press space. Now you will notice some lines and balls on that info. You can click and drag these to move and tilt the info. The middle green ball will move the whole info and the other balls rotate the info in some way. Try it out for yourself to get familiar with how they work.
Please note: The camera will be placed at the middle green ball and will look in the direction of the blue line. If you want the camera to look at the sky when at one node, click the red ball and rotate the node in such way that the blue line points at the sky.
IMG:https://fs5.directupload.net/images/user/180506/39jx3588.png
edited 2×, last 06.05.18 06:38:18 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview