scripted elevator problems.

Topics regarding Scripting with Reality Factory
Post Reply
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

scripted elevator problems.

Post by rgdyman »

Hey all.. hope everyone had a great holiday season :)

I could really use a helping hand with my scripted elevator if anyone has a minute or two. What I have thus far is this...
1) elevator act file up and running.

2) I have the script points in place ( 4 floors)

3) In the script I have it so the player can chosse what floor he/she wants and away the elevator goes. Going up works perfect. It will stop at the proper floor run all the animations through and the such.

Here's the problem. When the elevator goes down it will stop at the wrong location. It will be up to far. The right floor and all but not at the script point spot. It seems to get close and stop. The script is running in High and low.

Would anyone have any ideas how to fix this ? Cause Im stumped. :D
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

First of all, posting the script would really help. :P

The only thing I can think of is that the script thinks it is 'close enough' to the scriptpoint and stops.
I could probably say a lot more if you posted the script.
Pain is only psychological.
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

Post by rgdyman »

Here it is. :) TY for the help. .


SetUp[()
{
AttachCameraToEntity(self.EntityName,"");
PlayerMatchAngles(self.EntityName);
ShowText(1,"","","Floor?",8,"",350,275,"",255);
ShowText(2,"","","1 2 3 or 4",8,"",330,300,"",255);
PDIS=self.distancetopoint;
if(self.key_pressed=1)
{
FloorPoint=1;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
if(self.key_pressed=2)
{
FloorPoint=2;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
if(self.key_pressed=3)
{
FloorPoint=3;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
if(self.key_pressed=4)
{
FloorPoint=4;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
}]

Up2[()
{
Gravity(false);
SetNoCollision();
AnimationSpeed(0.6);
BoxWidth(1);
Delay("",1.0,"");
PlayAnimation(closing,true,"E_Door.wav");
PlayAnimation(closed,true,"");
SetEventState("shakeing",true);
NewPoint(FloorPoint);
MoveToPoint("",25,"elevator.wav");
SetEventState("shakeing",false);
Delay("",4.0,"");
PlayAnimation(opening,true,"E_Door.wav");
PlayAnimation(open,true,"");
Delay("",2.0,"");
LowLevel("SetUp");
Return();
}]
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Sorry for being so slow, but I haven't had much free time.

Your problem here is indeed very weird! It seems that the MoveToPoint() command ignores the Y-distance to the script point. If you place two script points so that the other one is exactly over the other (X and Z are same, but Y is different) the pawn won't move at all with MoveToPoint() :!: If the script points are not exactly on top of each other, then the pawn will move a little, but won't reach the script point. I think it's a bug of some sort. I tried looking into the source code, but heck, I'm no programmer and I can't really say if there's something wrong with the code.. :?

I don't think the problem is in the 'moving' part because if there is difference in the X or Z coordinates, the pawn will move up/down too.
So could it be because Y-distance isn't taken to account when calculating the distance to the script point, or something like that?
Pain is only psychological.
rgdyman
Posts: 84
Joined: Tue Jul 05, 2005 7:05 am

Post by rgdyman »

Well.. I have to admit that when it comes to source code its completely german to me.. :P

So all I ended up doing was add a TeleportToPpoint command in the script.
Its a little choppy and amature looking.. :P,, but.... it works.

Since I cant code in the source code to save my life... It will do. lol

( beggers cant be choosers)

thanks for the time and help anyway, juutis.

rgdyman
Post Reply