Camera position issues...

NED

Well-known member
I encounter some camera initial position
In most of the regular levels/stages there is no problem, but with a stage with a big depth (Z axis), or big BG area, the camera cannot be set on a good way.

This is what I have at the start of this level
8F7MKuf.gif


I would like the camera to be in the center of the stage at the start.
Not trying to follow like that.

Some infos:
the level BG size is 1438 X 622

This is what I have on level's "header":
Code:
music		data/music/ringzic.bor#wrescrwd1#ring.bor#foule.bor#ring.bor#rushmore.bor
#bossmusic       data/music/empty.bor#win.bor#rclear.ogg
panel		data/bgs/1/ringc1.gif	none				none
order           A
spawn1  1100 111 30#195 0 0#x z a
#spawn1  195 0 0#145  110
#spawn2  175  110
#spawn3  155  115
#spawn4  185  115
#nohit   1
 settime  100#0
# notime  1
cameraoffset 0  -80#-50#-100
cameratype 1#0#1 0=follow horiz 1=follow hozi+verti(good pour stages non linéaires)
gravity  -15.8#-16
direction both
typemp 1#recover MP by hitting enemies

light -98 -55
at 0

shadowalpha  2
at  0

spawn  resetvar
	coords  100  268
	at  0

In level.txt
Code:
#--------------------------------------------------
set New_Ring
custfade 200#100
typemp  1#2
lives   10#99#1
credits 20
noshare 1

z 375 615#300 490#165 385
file	data/levels/ringc.txt

Is there a way to control camera starting position in Openbor?

Thanks
 
Sorry I don't know a solution, but that actually looks like a great effect IMO.  You get to see the crowd and arena briefly.  Like the camera man panned to show the crowd cheering. :)
 
ive set the camera position a few times
but i had to used an entity...

you could use the (referee) as a camera starting position?!
you can also just set (X) position to make the camera appear on top (Z) moving down
showing off the crowd until it reaches the player and maybe used the slowmotion script...

to change the cam position use this script in an entitie level spawn
spawn  ghosttime <----------(referee)
@script
void main()
{
    void self = getlocalvar("self"); //Get calling entity.

    changeopenborvariant("xpos", 1500);
    changeopenborvariant("ypos", 300);
}
@end_script
health  5220
coords  1350 240
at      0

you seem to have the player spawning in the right place
you can also change the player spawning position
spawn  empty
@script
void main()
{
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");
    void self = getlocalvar("self"); //Get calling entity.

    changeentityproperty(self, "position", 837, 177, 0);
    if(P1){
      changeentityproperty(P1, "position", 837, 177, 0);
      changeentityproperty(P1, "direction", 0); //Face left
    }
    if(P2){
      changeentityproperty(P2, "position", 837, 200, 0);
      changeentityproperty(P2, "direction", 0); //Face left
    }
    changeopenborvariant("xpos", 559);
}
@end_script
coords  430 200
at  0

the way i used it i only neened to set the camera in Z
spawn  ghosttime
@script
void main()
{
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");
    int P3 = getplayerproperty(2, "entity");
    void self = getlocalvar("self"); //Get calling entity.

    changeentityproperty(self, "z", 350);
    if(P1){
      changeentityproperty(P1, "z", 350);
    }
    if(P2){
      changeentityproperty(P2, "z", 350);
    }
    if(P3){
    changeentityproperty(P3, "z", 350);
    }
    changeopenborvariant("ypos", 350);
}
@end_script
health  20
coords  1350 240
at      0
i cant remember very well how got this to work since ive passed that level some time ago...
you can see this topic where i got the camera script
http://www.chronocrash.com/forum/index.php?topic=967.0
 
The solution jonsilva posted is the best one. Allow me to fix it a bit:

spawn  ghosttime <----------(referee)
@script
void main()
{
    changeopenborvariant("xpos", 1500);
    changeopenborvariant("ypos", 300);
}
@end_script
health  5220
coords  1350 240
at      0

Since the script doesn't alter the entity, you can declare this script in any spawns BUT if you want the script to work immediately as level starts, declare it in an entity which is spawned at 0

As for the correct value, you need to do trial and error to get it correct but worry not, it is level settings and you can replay the level after setting a pair of values to test them :)
 
I'm sorry to bump this old thread (wow! more than one year ago!!)

I finally tried this camera stuff, since NOT using it will cause major problems.

I added the camera script in some "axis" entity. (I'll make it empty later)

This is what I have now.

Code:
name	camaxis
type	obstacle
offscreenkill	90000#3000


anim spawn
	delay	5
	offset	15 14

@script
void main()
{
    changeopenborvariant("xpos", 1500);
    changeopenborvariant("ypos", 300);
}
@end_script

	sound	data/sounds/beep.wav
	frame	data/chars/misc/camaxis.gif


anim idle
	delay	50
	offset	15 14
	sound	data/sounds/0000debug.wav
	frame	data/chars/misc/camaxis.gif


anim fall
	delay	50
	offset	15 14
	sound	data/sounds/fallbrk.wav
	frame	data/chars/misc/camaxis.gif

But now, since I added the script part.
It crashes.

This is the message on logfile.

Code:
Fatal Error in load_cached_model, file: data/chars/misc/camaxis.txt, line 19, message: Error parsing function main of animation script in file '%s'!

I forgot something??
 
Silly me...
Thanks for pointing it out.

For some reason, I thinked all code have to be in entities files...

Anyway, I put the function on level file, this way:
Code:
spawn  camaxis# camera axis
@script
void main()
{
    changeopenborvariant("xpos", 1500);
    changeopenborvariant("ypos", 300);
}
@end_script
	flip 1
	coords  719 425
	at  0

I tried various value, but no effect at all.
Camera still move like the way it does in the gif I posted.
 
I tried various value, but no effect at all.
Camera still move like the way it does in the gif I posted.

Do you mean the camera never move to defined spot OR the camera did move there but it moves back to player's position?
 
I'm screwed. I tried it with a newer build... and there is a reaction (a weird one, but there is one at least)

Since most of my system is based on pre-2013 build ONLY, I cannot use your code BB.
Sorry for asking this without checking it.

Also I was going to work on In game VS screen. With this camera bug it will not be possible... I'm tired. I'll take some rest for the moment. :-[
 
nedflandeurse said:
I'm screwed. I tried it with a newer build... and there is a reaction (a weird one, but there is one at least)

Since most of my system is based on pre-2013 build ONLY, I cannot use your code BB.
Sorry for asking this without checking it.

Also I was going to work on In game VS screen. With this camera bug it will not be possible... I'm tired. I'll take some rest for the moment. :-[

Try my script in your level##.txt
Code:
levelscript @script
void main() {
	changelevelproperty("scrollspeed", 100);
}
@end_script

updatescript @script
void main() {
	int i, num_players = 0;

	if ( getlocalvar("level_flag") == NULL() ) { // It doesn't scroll at level beginning
		for (i = 0; i < openborvariant("maxplayers"); ++i) {
			void player = getplayerproperty(i, "entity");
			if ( !getentityproperty(player, "exists") ) continue;
			if ( getentityproperty(player, "animationid") != openborconstant("ANI_SPAWN") ) ++num_players;
		}
		if ( num_players == openborvariant("count_players") ) {
			changelevelproperty("scrollspeed", 1);
			setlocalvar("level_flag", 1);
		}
	}
}
@end_script

I hope it works into your openBOR version.
BTW I advice you to migrate in the last ver.
 
thanks!
I'll give it a try.

Changing the build would be great, but some of my coding don't work at all or is VERY buggy with post-2013 builds.
I tried various ways to fix them. I don't want to disturb skilled people for these builds problems.


EDIT : does your script need something else?
It seems to be a problem. I had a crash with this message "failed to load the script"
 
I forget from which build level script is supported but if you don't want to use level script as the above, you can paste the script in an entity like this:

Code:
name	camaxis
type	none
lifespan 1


anim idle
@script
    changeopenborvariant("xpos", 1500);
    changeopenborvariant("ypos", 300);
@end_script
	delay	5
	offset	15 14
	sound	data/sounds/beep.wav
	frame	data/chars/misc/camaxis.gif

The script will be run when this entity is spawned
 
Bloodbane said:
I forget from which build level script is supported but if you don't want to use level script as the above, you can paste the script in an entity like this:

Code:
name	camaxis
type	none
lifespan 1


anim idle
@script
    changeopenborvariant("xpos", 1500);
    changeopenborvariant("ypos", 300);
@end_script
	delay	5
	offset	15 14
	sound	data/sounds/beep.wav
	frame	data/chars/misc/camaxis.gif

The script will be run when this entity is spawned

Thanks a lot.
I will give it a try.
 
Back
Top Bottom